Project 38: One Prop Z-Test
Suppose a carnival director claims that contestants have a 60% chance of winning a certain game at the carnival. We believe that the true proportion of winning the game is less than this and plan to test our hypothesis at the .05 level.
Ho: p = .6
Ha: p < .6
We decide to play the game 60 times and we win 28 times.
phat = 28/60 = .467
Explanation: If p really were .6 and we were to play 60 times, the sampling distribution of phat would be approximately normal (60*.6 = 36 >10 AND 60*.4 = 24 >10). The mean of the sampling distribution would be .6 and the standard deviation would be sqrt(.6*.4/60) = .063
The p-value for the test would be .0174. This is less than .05 so we would reject Ho and get evidence that the true proportion of times a contestant would win this game is less than .6
Project 38: Variables 'po', 'x', 'n', 'haDirection' have been initialized. Working methods called normalcdf and invNorm are available.
po represents the hypothesized proportion
n represents the sample size
x represents the number of successes in the sample
haDirection represents the direction of the alternative hypothesis (1:<, 2: >, 3 ≠)
Review projects 2-5 if you need a reminder of how normalcdf and invNorm work.
Task: Initialize values for 'z' and 'pValue' that represent the test statistic (z-score) and p-value for the given test.
**If your code works for 5 test cases, you can enter your e-mail address
Universal Computational Math Methods:
pow(5,2) returns 25.0
abs(-3.0) returns 3
sqrt(49.0) returns 7.0