Skip to content

Instantly share code, notes, and snippets.

@aditya0811
Last active June 4, 2019 08:07
Show Gist options
  • Save aditya0811/f856c1910845e1c85d042c055656fb4c to your computer and use it in GitHub Desktop.
Save aditya0811/f856c1910845e1c85d042c055656fb4c to your computer and use it in GitHub Desktop.
student ttest_auto
import numpy as np
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,23])
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])
from scipy.stats import ttest_ind
stat, p = ttest_ind(a, b,equal_var=True)
print(stat)
>>>-2.0754319784177606
#Though here variance of sample is not equal but we assumend it to be equal for conducting students t-test,
#(for unequal variance we will discuss Welsch's t-test later)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment