-
-
Save aditya0811/26a7a32c6a325f4ca1340f9daf552538 to your computer and use it in GitHub Desktop.
welsh's
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a=np.array([27.5, 21.0, 19.0, 23.6, 17.0, 17.9, 16.9, 20.1, 21.9, 22.6, 23.1, 19.6, 19.0, 21.7, 21.4]) | |
b=np.array([27.1, 22.0, 20.8, 23.4, 23.4, 23.5, 25.8, 22.0, 24.8, 20.2, 21.9, 22.1, 22.9, 20.5, 24.4]) | |
num_a,num_b=len(a),len(b) | |
print(a.var(),b.var()) | |
>>>7.342933333333334, 3.5584888888888906 | |
dof=((a.var()/num_a) + (b.var()/num_b))**2/((a.var()**2/(num_a**2 * (num_a-1)))+(b.var()**2/(num_b**2 * (num_b-1)))) | |
print(dof) | |
>>>24.988 | |
from scipy.stats import ttest_ind | |
stat, p = ttest_ind(a, b,equal_var=False) | |
print(stat) | |
>>>-2.455356398286006 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment