Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen z-test Means | Additional Tests
Applied Hypothesis Testing & A/B Testing

bookz-test Means

The z-test for means is a statistical method used to determine whether the means of two large, independent samples are significantly different from each other.

Key requirements:

  • Large sample sizes (typically n > 30 for each group);
  • Known population variances;
  • Independent samples.

The z-test is preferred over the t-test when the population variances are known and sample sizes are large. This situation is common in industrial or scientific settings where reliable historical data is available.

The z-test relies on the Central Limit Theorem, which states that the sampling distribution of the mean approaches a normal distribution as the sample size increases, regardless of the population's distribution. This means you can use the z-test when your data are approximately normally distributed, or when the sample size is large enough for the normal approximation to hold.

Test statistic:

The z-statistic for comparing two means is calculated as:

z=xˉ1xˉ2σ12n1+σ22n2z = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{\frac{\sigma_1^2}{n_1} + \frac{\sigma_2^2}{n_2}}}

Where:

  • xˉ1\bar{x}_1, xˉ2\bar{x}_2 are the sample means;
  • σ12\sigma_{\raisebox{-1pt}{$1$}}^{\raisebox{1pt}{$2$}}, σ22\sigma_{\raisebox{-1pt}{$2$}}^{\raisebox{1pt}{$2$}} are the known population variances;
  • n1n_1, n2n_2 are the sample sizes.

The resulting z-statistic measures how many standard errors the observed difference in means is away from the null hypothesis (usually that the means are equal). You then compare this value to the standard normal distribution to determine significance.

12345678910111213141516171819202122
import numpy as np from scipy.stats import norm # Sample data: means, known variances, and sample sizes mean1 = 105 mean2 = 100 var1 = 25 # Known variance of sample 1 var2 = 16 # Known variance of sample 2 n1 = 100 # Sample size 1 n2 = 120 # Sample size 2 # Calculate the standard error se = np.sqrt(var1 / n1 + var2 / n2) # Calculate the z-statistic z = (mean1 - mean2) / se # Calculate the two-tailed p-value p_value = 2 * (1 - norm.cdf(abs(z))) print(f"Z-statistic: {z:.2f}") print(f"P-value: {p_value:.4f}")
copy
question mark

Which of the following are required conditions for using a z-test for means?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 1

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

Awesome!

Completion rate improved to 3.23

bookz-test Means

Swipe um das Menü anzuzeigen

The z-test for means is a statistical method used to determine whether the means of two large, independent samples are significantly different from each other.

Key requirements:

  • Large sample sizes (typically n > 30 for each group);
  • Known population variances;
  • Independent samples.

The z-test is preferred over the t-test when the population variances are known and sample sizes are large. This situation is common in industrial or scientific settings where reliable historical data is available.

The z-test relies on the Central Limit Theorem, which states that the sampling distribution of the mean approaches a normal distribution as the sample size increases, regardless of the population's distribution. This means you can use the z-test when your data are approximately normally distributed, or when the sample size is large enough for the normal approximation to hold.

Test statistic:

The z-statistic for comparing two means is calculated as:

z=xˉ1xˉ2σ12n1+σ22n2z = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{\frac{\sigma_1^2}{n_1} + \frac{\sigma_2^2}{n_2}}}

Where:

  • xˉ1\bar{x}_1, xˉ2\bar{x}_2 are the sample means;
  • σ12\sigma_{\raisebox{-1pt}{$1$}}^{\raisebox{1pt}{$2$}}, σ22\sigma_{\raisebox{-1pt}{$2$}}^{\raisebox{1pt}{$2$}} are the known population variances;
  • n1n_1, n2n_2 are the sample sizes.

The resulting z-statistic measures how many standard errors the observed difference in means is away from the null hypothesis (usually that the means are equal). You then compare this value to the standard normal distribution to determine significance.

12345678910111213141516171819202122
import numpy as np from scipy.stats import norm # Sample data: means, known variances, and sample sizes mean1 = 105 mean2 = 100 var1 = 25 # Known variance of sample 1 var2 = 16 # Known variance of sample 2 n1 = 100 # Sample size 1 n2 = 120 # Sample size 2 # Calculate the standard error se = np.sqrt(var1 / n1 + var2 / n2) # Calculate the z-statistic z = (mean1 - mean2) / se # Calculate the two-tailed p-value p_value = 2 * (1 - norm.cdf(abs(z))) print(f"Z-statistic: {z:.2f}") print(f"P-value: {p_value:.4f}")
copy
question mark

Which of the following are required conditions for using a z-test for means?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 1
some-alt