Confidence
  • Documentation
  • Blog
  • Bootcamp
  • Status
  • Confidence Bootcamp
    • My learning
    • Intro to experimentation
      • Introduction
      • Lesson 1: Why you should experiment
      • Lesson 2: Experiment hypothesis
      • Lesson 3: Success and guardrail metrics
      • Lesson 4: Success metrics
      • Lesson 5: Set up your experiment
      • Lesson 6: Calculation frequency
      • Lesson 7: Target audience
      • Lesson 8: Sample size
      • Lesson 9: Quality assurance
      • Lesson 10: Run your experiment
      • Lesson 11: Evaluate your experiment and make a decision
      • Lesson 12: A/B tests and rollouts
      • Course wrap up
    • Intro to metrics
      • Introduction
      • Lesson 1: What is a metric?
      • Lesson 2: Metric roles
      • Lesson 3: Time considerations
      • Lesson 4: Capturing behavior
      • Lesson 5: Strategic metrics
      • Lesson 6: Interpretability
      • Lesson 7: Feasibility and sensitivity
      • Lesson 8: Variance reduction
      • Lesson 9: Select metrics
      • Lesson 10: Segment-level analysis
      • Course wrap up
    • Scientific product development
      • Introduction
      • Lesson 1: Why you should experiment
      • Lesson 2: The scientific method
      • Lesson 3: Randomized controlled trials
      • Lesson 4: Experiment hypothesis
      • Lesson 5: Case study
        • Case study
        • Answers to case study
      • Lesson 6: Why do we need statistics?
      • Lesson 7: Success metrics
      • Lesson 8: Detectable effects and sample size
      • Lesson 9: Make a decision
      • Course wrap up
    • A primer on hypothesis testing
      • Introduction
      • Lesson 1: Introduction to hypothesis testing
      • Lesson 2: True vs estimated effects
      • Lesson 3: Sampling distribution of the difference-in-means estimator
      • Lesson 4: Z-tests and how to reject the null hypothesis
      • Lesson 5: False postive rate and alpha
      • Lesson 6: True positive rate, MDE, and power
      • Course wrap up
    • Intro to Feature Flags
      • Introduction
      • Lesson 1: What is a feature flag?
      • Lesson 2: Lifecycle of a feature flag
      • Lesson 3: Clients
      • Lesson 4: Evaluation context and targeting
    • Sample size calculation - I
      • Introduction
      • Lesson 1: What is the required sample size?
      • Lesson 2: Alpha and power
      • Lesson 3: Baseline mean and variance
      • Lesson 4: Sample size playground - I
    • Sample size calculation - II
      • Introduction
      • Lesson 1: Multi-metric decision making
      • Lesson 2: Number of success metrics
      • Lesson 3: Number of guardrail metrics
      • Lesson 4: Number of comparisons
      • Lesson 5: Sample size playground - II
    • Sample size calculation - III
      • Introduction
      • Lesson 1: Binary metrics
      • Lesson 2: Treatment group proportions
      • Lesson 3: Variance reduction
      • Lesson 4: Sequential testing and sample size
      • Lesson 5: Sample size playground - III
    • Advance your experimentation
      • Introduction
      • Lesson 1: Guardrail metrics with non-inferiority margins
      • Lesson 2: Choose evaluation frequency
      • Lesson 3: Metrics' roles in experiments
      • Lesson 4: Cumulative holdback evaluations
    • Experimentation culture
      • Introduction
      • Lesson 1: Onboarding into experimentation
      • Lesson 2: Empowering experimentation champions
      • Lesson 3: Sustaining the experimentation culture
    • Videos

Lesson 1: Binary metrics

Summary

This lesson explains how binary metrics differ from continuous metrics in sample size calculations. For binary metrics, the variance under the alternative is know, this is not the case for continuous metrics.


Variance of a binary metric

Binary metrics, such as whether a user clicked a button or made a purchase, have specific properties. The variance of a binary metric is a deterministic function of the mean (proportion of ones) of the metric.

Let p represent the proportion of ones in the metric. Then the variance of the metric is calculated as Variance = p * (1 - p).

For example, assume we have a metric measuring whether a user clicked a button. The mean of the metric is the proportion of users who clicked the button.

  • If the mean is p = 0.5, the variance is 0.5 * (1 - 0.5) = 0.25

  • If the mean is p = 0.1, the variance is 0.1 * (1 - 0.1) = 0.09


Variance in the treatment group

For continuous metrics, the best guess of the variance in the treatment group is typically the same as the variance in the control group. This is not because we might expect the variance to be the same, but because it is hard to make an informed guess about how a treatment effect of size MDE (Minimum Detectable Effect) would affect the variance.

For binary metrics, the situation is different. Since the variance of a binary metric is a function of its mean, we can determine the variance in the treatment group under a treatment effect of size MDE. Let p represent the proportion of ones in the control group. Then the variance in the treatment group is calculated as Treatment Variance = (p + MDE) * (1 - (p + MDE)).

For example, if p = 0.3 and the MDE is 0.1, then the treatment group variance would be (0.3 + 0.1) * (1 - (0.3 + 0.1)) = 0.4 * 0.6 = 0.24


Reader exercise

How is the variance of a binary metric calculated?

Reader exercise

How does the calculation of variance differ between binary and continuous metrics?

Reader exercise

How is the variance in the treatment group for a binary metric determined under a treatment effect of size MDE?


Note for nerds

For guardrail metrics, the alternative hypothesis used in sample size calculations assumes that the proportion in the treatment group is the same as in the control group.

Variance of Binary Metrics

Technically, the variance in the treatment group used in the sample size calculation should therefore vary depending on whether the metric is a guardrail metric or a success metric.

In practice, the difference is often small enough to ignore, but Confidence's sample size calculator corrects for this.

Was this page helpful?

PreviousIntroduction
NextLesson 2: Treatment group proportions

© Copyright 2026. All rights reserved.

Follow us on TwitterFollow us on GitHub

On this page

  1. Variance of a binary metric

  2. Variance in the treatment group

  3. Note for nerds