Project 37: One Prop Z-Interval
Suppose we want to estimate the proportion of students at a certain high school that are on TikTok. We plan to construct a 90% confidence interval (confidence level = .9)
We randomly select 81 students in the high school and 27 claim they are on TikTok.
pHat = 27/81 = .333
sdPHat = sqrt(.333*.667/81) = .052
critical value = 1.65 (based on .9 confidence level)
margin of error = .052*1.65 = .086
confidence interval = [.333 - .086, .333 + .086] = [.247, .419]
We are 90% confident that the true proportion of students at this school that claim to be on TikTok is between .247 and .419.
Project 37: Variables 'x', 'n', 'confidenceLevel' have been initialized. There are also working methods called normalcdf and invNorm.
x is the number of successes in the sample (27 in the example above)
n is the sample size (81 in the example above)
confidenceLevel is how confident we are in our interval (.9 in the example above)
Note: The confidence level is a number between 0 and 1 (not between 0 and 100 like a percentage)
Review projects 2-5 if you need a reminder of how normalcdf and invNorm work.
Task: Appropriately assign the values of 'lower' and 'upper' that represent the lower and upper bounds of the given confidence interval.
**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