The Null Hypothesis Part 2
Solution
import numpy as np
mean = np.mean(pts)
std = np.std(pts)
t = (mean-400)/(std/len(pts)**.5)
print(t)
By applying the formula, we can get the t value to use. If we want the bounds….
SE = std/(len(pts)**.5)
bounds = (mean-SE*t,mean+SE*t)
print(bounds)
Notice that the left side of the bound is 400, which is equal to the null hypothesis. Let’s find a confidence level from this t-score. If we want to turn a z or t score into the percentage under it, we can use scipy.stats.norm.cdf(). We will get the cdf for -t, and from there we can get the percentage under the curve.
(.5-scipy.stats.norm.cdf(-t))*2
So here we say that the percentage likelihood that the null hypothesis is not true is a little over 50%. This isn’t a great percent, usually we would want it to be 95% or 99%.
What about a null hypothesis of a mean of 385?
t = (mean-385)/(std/len(pts)**.5)
print(t)
print((.5-scipy.stats.norm.cdf(-t))*2)
Now, we can see that the t value is higher, we are a lot more certain that 385 is not the true mean. We are about 98% sure that the true mean is something different.