Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Confidence Intervals | Statistical Analysis of A/B
Applied Hypothesis Testing & A/B Testing

bookConfidence Intervals

Understanding confidence intervals is essential for interpreting the results of A/B tests. A confidence interval provides a range of values that is likely to contain the true value of a population parameter, such as a mean or proportion, with a certain level of confidence (commonly 95%). Instead of reporting only a single estimate, like the difference in conversion rates between two groups, you use a confidence interval to express the uncertainty around that estimate. This helps you understand not just the observed effect, but also the possible range of the true effect based on your data.

A confidence interval for the mean is typically calculated as:

xˉ±tsn\bar{x} \pm t^* \cdot \frac{s}{\sqrt{n}}

Where:

  • xˉ\bar{x} is the sample mean;
  • tt^* is the critical value from the t-distribution;
  • ss is the sample standard deviation;
  • nn is the sample size.

For a proportion, the confidence interval is:

p±zp(1p)np \pm z^* \cdot \sqrt{\frac{p(1-p)}{n}}

Where:

  • pp is the sample proportion;
  • zz^* is the critical value from the normal distribution;
  • nn is the sample size.

In A/B testing, confidence intervals are especially important because they help you determine whether a result is statistically significant and how much you can trust the observed difference. If the confidence interval for the difference between groups does not include zero, you have evidence that the groups are truly different at your chosen confidence level. However, if zero is within the interval, the difference may be due to random chance.

123456789101112131415161718192021
import numpy as np from scipy import stats # Confidence interval for the mean data = [12, 14, 15, 16, 14, 13, 15, 16, 17, 18] confidence = 0.95 mean = np.mean(data) sem = stats.sem(data) interval = stats.t.interval(confidence, len(data)-1, loc=mean, scale=sem) print("Confidence interval for the mean:", interval) # Confidence interval for a proportion # Suppose 200 users, 54 converted (successes) n = 200 successes = 54 p_hat = successes / n z = stats.norm.ppf(1 - (1-confidence)/2) se = np.sqrt(p_hat * (1 - p_hat) / n) lower = p_hat - z * se upper = p_hat + z * se print("Confidence interval for the proportion:", (lower, upper))
copy
question mark

How do confidence intervals help you make decisions in A/B testing experiments?

Select the correct answer

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 5. Kapittel 4

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

Awesome!

Completion rate improved to 3.23

bookConfidence Intervals

Sveip for å vise menyen

Understanding confidence intervals is essential for interpreting the results of A/B tests. A confidence interval provides a range of values that is likely to contain the true value of a population parameter, such as a mean or proportion, with a certain level of confidence (commonly 95%). Instead of reporting only a single estimate, like the difference in conversion rates between two groups, you use a confidence interval to express the uncertainty around that estimate. This helps you understand not just the observed effect, but also the possible range of the true effect based on your data.

A confidence interval for the mean is typically calculated as:

xˉ±tsn\bar{x} \pm t^* \cdot \frac{s}{\sqrt{n}}

Where:

  • xˉ\bar{x} is the sample mean;
  • tt^* is the critical value from the t-distribution;
  • ss is the sample standard deviation;
  • nn is the sample size.

For a proportion, the confidence interval is:

p±zp(1p)np \pm z^* \cdot \sqrt{\frac{p(1-p)}{n}}

Where:

  • pp is the sample proportion;
  • zz^* is the critical value from the normal distribution;
  • nn is the sample size.

In A/B testing, confidence intervals are especially important because they help you determine whether a result is statistically significant and how much you can trust the observed difference. If the confidence interval for the difference between groups does not include zero, you have evidence that the groups are truly different at your chosen confidence level. However, if zero is within the interval, the difference may be due to random chance.

123456789101112131415161718192021
import numpy as np from scipy import stats # Confidence interval for the mean data = [12, 14, 15, 16, 14, 13, 15, 16, 17, 18] confidence = 0.95 mean = np.mean(data) sem = stats.sem(data) interval = stats.t.interval(confidence, len(data)-1, loc=mean, scale=sem) print("Confidence interval for the mean:", interval) # Confidence interval for a proportion # Suppose 200 users, 54 converted (successes) n = 200 successes = 54 p_hat = successes / n z = stats.norm.ppf(1 - (1-confidence)/2) se = np.sqrt(p_hat * (1 - p_hat) / n) lower = p_hat - z * se upper = p_hat + z * se print("Confidence interval for the proportion:", (lower, upper))
copy
question mark

How do confidence intervals help you make decisions in A/B testing experiments?

Select the correct answer

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 5. Kapittel 4
some-alt