code: def z_score(self):
          
          control = VariantStat(self.experiment.control, self.experiment)
  
          alternative = self
  
          if control.name == alternative.name:
              return 'N/A'
  
          conv_c = control.conversion_rate
          conv_a = alternative.conversion_rate
  
          num_c = control.participant_count
          num_a = alternative.participant_count
  
          if conv_c == 0 or conv_a == 0:
              return 0
  
          numerator = conv_a - conv_c
  
          frac_c = (conv_c * (1 - conv_c)) / float(num_c)
          frac_a = (conv_a * (1 - conv_a)) / float(num_a)
  
          if frac_c + frac_a == 0:
              # square root of 0 is 0, so no need to calculate
              return 0
          elif frac_c + frac_a < 0:
              # can't take a square root of a negative number,
              # so return 'Invalid'
              return 'Invalid'
  
          return numerator / math.sqrt((frac_c + frac_a))
docs: Calculate the Z-Score between this alternative and the project control.
  
          Statistical formulas based on:
          http://20bits.com/article/statistical-analysis-and-ab-testing