stat_analysis Flashcards
1
Q
Suppose we want to simulate the probability of flipping a fair coin 20 times, and getting a number greater than or equal to 15.
Use Numpy to do 10,000 simulations of flipping a fair coin 20 times, then see what proportion of the simulations are 15 or greater.
A
x = np.random.binomial(20, .5, 10000)
print((x>=15).mean())
2
Q
Use Numpy to get the standard deviation for a variable ‘distribution’
A
np.st(distribution)
3
Q
Given two DataFrames(early[‘assignment1_grade’], late[‘assignment2_grade’]), how do you use scipy to get the t-statistic and the pvalue?
A
from scipy import stats
stats.ttest_ind(early[‘assignment1_grade’], late[‘assignment_grade’])