Z - Test

Z Test for Testing Means

One Sample Z Test

Two Sample Z Test

import numpy as np

def TwoSampZTest(samp_mean_1, samp_mean_2, samp_std_1, samp_std_2, n1, n2):
    denominator = np.sqrt((pow(samp_std_1, 2) / n1) + (pow(samp_std_2, 2) / n2))
    z_score = (samp_mean_1 - samp_mean_2) / denominator
    return z_score

When series data is given use following code

from statsmodels.stats import weightstats as stests
z_score, p_value = stests.ztest(list_1, list_2, alternative ='smaller')

Proportion test

2 sample z proportion test

The Quidditch teams at Hogwarts conducted tryouts for two positions: Chasers and Seekers.

In Group Chasers, out of 90 students who tried out, 57 were selected. In Group Seekers, out of 120 students who tried out, 98 were selected.

Is there a significant difference in the proportion of students selected for Chasers and Seekers positions?

Conduct a test at 90% confidence level.

Using Formula

Using Scipy package

As a product manager, you want to evaluate the user satisfaction for two different seasons of Naruto Shippuden (Season 1 and Season 2).

You collected feedback from 250 viewers who watched Season 1 of Naruto Shippuden, and 120 expressed satisfaction. Similarly, for Season 2, you gathered data from 300 viewers, and 150 of them expressed satisfaction.

Conduct an appropriate test at a 95% confidence interval to determine if there's a higher user satisfaction for Season 2 than for Season 1.

Last updated