tylerdurdenX
tylerdurdenX

Reputation: 21

Hypothesis testing in python not equal sizes

I have two samples(n1= 25, n2= 35) with N(mu = 70, sd =10) and I am trying to test

H0:mu1-mu2=0

for variances unknown. This is the code I am working on it but I can not get the result because of inequal lengths.

rvs1 = stats.norm.rvs(loc=70,scale=10,size=25)
rvs2 = stats.norm.rvs(loc=70,scale=10,size=35)
stats.ttest_rel(rvs1,rvs2)

Upvotes: 0

Views: 886

Answers (1)

Aysu Sayın
Aysu Sayın

Reputation: 301

I think what you need is stats.ttest_ind instead of stats.ttest_rel. stats.ttest_rel is for related samples and stats.ttest_ind is for independent samples. Since you have two different values for the size they are two independent samples. They may be coming from the same population but they are different so you need to use stats.ttest_ind.

Upvotes: 2

Related Questions