One Tail Test Part 2
The t score from before is going to be the same, this does not change. What does change is the p-value associated with it because there is only one tail. The test from before was…
t = (mean-385)/(std/len(pts)**.5)
print(t)
print((.5-scipy.stats.norm.cdf(-t))*2)
Let’s change the test to be H
A
> H
0
What changes is how we find the p-value. In this cases we want to find the cdf to the left, and then get 1-cdf to find our p-value to the right.
print(scipy.stats.norm.cdf(t))
Because the area under the curve now includes the left, our total area under the curve increases. Let’s check out the p-values.
print(1-(.5-scipy.stats.norm.cdf(-t))*2)
print(1-scipy.stats.norm.cdf(t))
Notice that as we go to a one tail test, our p value is cut in half.
Let’s see how to test proportions. The equation is….
Challenge
Let’s say we think the true percentage chance of an event A is 50%, but we tested it and got 56% when we ran 100 tests. What is the z value and p value for the two tail test, and one tail test that H
A
> H
0
?
For the two tail test:
(.56-.5)/((.5*.5)/100)**.5
Our z value is 1.2, what are the related p values?
print(1-(.5-scipy.stats.norm.cdf(-1.2))*2)
print(1-scipy.stats.norm.cdf(1.2))
Source Code