I want to ask if I can use the NormalPValue[val] the same way for lower-tail and upper-tail hypothesis tests or if there is something I need to watch out for? Personally, my gut feeling is that I need to substract the P-Value from 1 for the other kind of test.
Here's an example to show what I'm talking about:
A software reduced the amount of spam of 100 messages to 11%. This is better than the goal of 20%. Based on a significance level of 0.05, is this significant or not? I.e. buy the software or not?
- We state the following hypotheses:
H0: p >= p0 = 0.20
H1: p < p0 = 0.20
Further use [Alpha] = 0.05.
Since we test a proportion we have to use the z-statistic:
phead = 0.11;
p0 = 0.20;
n = 100;
zcalc = (phead - p0) / (Sqrt[p0 * (1 - p0) / n])
-2.25
Calculate the P-Value Needs["HypothesisTesting`"];
NormalPValue[zcalc]
OneSidedPValue -> 0.0122245
Compare P-Value to [Alpha]
Since The P-Value of 0.0122245 is smaller than our [Alpha] = 0.05, we reject H0 and accept the alternative hypothesis H1. The manager should buy the software.
My question now is, if we were to use the following H0/H1 instead (for a different kind of task, of course):
H0: p <= p0 = 0.20
H1: p > p0 = 0.20
Am I correct that in this case, I would receive the P-Value as follows:
1 - 0.0122245 = 0.9877755
And would therefore not be able to reject H0?
CDF[BinomialDistribution[100, 0.2], 11]
. For the second set of hypotheses the answer is1 - CDF[BinomialDistribution[100, 0.1], 10]
which is not "1 minus the first probability". A "P-value" is the probability of obtaining at least as extreme a value as observed. (I've ignored the complication that you have a compound hypothesis for the null hypothesis.) $\endgroup$ – JimB Mar 20 '17 at 0:07LocationTest
which does have an option for a one-sided alternative hypothesis. $\endgroup$ – JimB Mar 20 '17 at 0:09