6. Inference Models
Math 115 - Examples for Topic 6
These worked examples demonstrate how to use the normal distribution for inference about a single proportion.
Example 1: Hypothesis Test Using Normal Distribution
Scenario: A health researcher wants to know if the majority of college students get adequate sleep (at least 7 hours per night). She surveys a random sample of 400 college students and finds that 228 report getting at least 7 hours of sleep per night.
Research Question: Is there evidence that the majority of college students get adequate sleep?
Significance level: α = 0.05
Step 1: State hypotheses
Let \(p\) = the true proportion of college students who get at least 7 hours of sleep per night.
- \(H_0: p = 0.5\)
- \(H_A: p > 0.5\) (majority gets adequate sleep)
This is a one-sided (upper-tail) test because we’re asking if the proportion is greater than 0.5.
Step 2: Check conditions for using normal model
Independence:
- Random sample of students ✓
Success-Failure Condition (using \(p_0 = 0.5\) from null hypothesis):
- Expected successes: \(n \times p_0 = 400 \times 0.5 = 200 \geq 10\) ✓
- Expected failures: \(n \times (1-p_0) = 400 \times 0.5 = 200 \geq 10\) ✓
Both conditions are met, so we can use the normal model.
Step 3: Calculate test statistic
Sample proportion: \[\hat{p} = \frac{228}{400} = 0.57\]
Standard error (using \(p_0\)): \[SE = \sqrt{\frac{p_0(1-p_0)}{n}} = \sqrt{\frac{0.5 \times 0.5}{400}} = \sqrt{\frac{0.25}{400}} = \sqrt{0.000625} = 0.025\]
Z-score: \[Z = \frac{\hat{p} - p_0}{SE} = \frac{0.57 - 0.5}{0.025} = \frac{0.07}{0.025} = 2.8\]
Step 4: Calculate p-value using Jamovi
Randomize module → Model-Based Inference
To calculate the p-value in Jamovi:
- Under Distribution, choose Standard normal (Z)
- Check “Calculate area (p-value)”
- Enter the Z-score: 2.8
- Select tail direction: Right (for \(H_A: p > p_0\))
Jamovi will display the p-value ≈ 0.0026
Step 5: Interpret the p-value
Interpretation: If the true proportion of students getting adequate sleep is 0.5, there is approximately a 0.26% chance of observing a sample proportion of 0.57 or higher in a random sample of 400 students.
Step 6: Make decision
Compare p-value to significance level α = 0.05:
- P-value = 0.0026
- Is 0.0026 < 0.05? YES
Decision: We reject \(H_0\) at the α = 0.05 level.
Step 7: State conclusion
The data provide convincing evidence that the majority of college students get adequate sleep. The observed sample proportion of 57% is significantly higher than 50% (Z = 2.8, p-value = 0.0026), suggesting that more than half of college students report getting at least 7 hours of sleep per night.
Example 2: Confidence Interval Using Normal Distribution
Scenario: A city is considering a new public transportation initiative. A polling organization surveys a random sample of 650 registered voters, and 403 say they support the initiative.
Question: Construct a 95% confidence interval for the true proportion of voters who support the initiative.
Step 1: Check conditions
Independence:
- Random sample of voters ✓
Success-Failure Condition (using \(\hat{p}\), not \(p_0\)):
Sample proportion: \[\hat{p} = \frac{403}{650} = 0.62\]
- Observed successes: 403 ≥ 10 ✓
- Observed failures: 650 - 403 = 247 ≥ 10 ✓
Conditions are met for using the normal model.
Step 2: Calculate standard error
For confidence intervals, use \(\hat{p}\) in the SE formula (not \(p_0\)):
\[SE = \sqrt{\frac{\hat{p}(1-\hat{p})}{n}} = \sqrt{\frac{0.62 \times 0.38}{650}} = \sqrt{\frac{0.2356}{650}} = \sqrt{0.0003625} = 0.0190\]
Step 3: Find critical value using Jamovi
Randomize module → Model-Based Inference
To find \(z^*\) in Jamovi:
- Under Distribution, choose Standard normal (Z)
- Check “Calculate CI multiplier”
- Enter confidence level: 95
Jamovi returns: \(z^* = 1.960\)
Step 4: Calculate confidence interval
Margin of error: \[ME = z^* \times SE = 1.960 \times 0.0190 = 0.0372\]
Confidence interval: \[\text{CI} = \hat{p} \pm ME = 0.62 \pm 0.0372 = (0.583, 0.657)\]
Detailed calculation:
- Lower bound: \(0.62 - 0.0372 = 0.583\)
- Upper bound: \(0.62 + 0.0372 = 0.657\)
Step 5: Interpret the interval
Interpretation: We are 95% confident that the true proportion of registered voters who support the new public transportation initiative is between 58.3% and 65.7%.
What this means: If we repeated this sampling process many times and calculated a 95% confidence interval each time, about 95% of those intervals would contain the true proportion of all voters who support the initiative.
Example 3: One Dataset, Two Checks
Scenario: A hardware store believes 25% of paint purchases include a primer add-on. In a random sample of 48 purchase records, 7 included primer. Two normal-model analyses are on the table:
- a confidence interval for the true add-on proportion, and
- a hypothesis test of \(H_0: p = 0.25\) vs. \(H_A: p < 0.25\).
Question: Run the success-failure check for each analysis. Can each one use the normal model? If one cannot, what should be done instead?
The two checks are different checks.
The confidence interval’s check uses the observed counts. The CI is built around \(\hat{p}\), so the sample itself must carry enough of both outcomes:
- Observed successes: 7
- Observed failures: \(48 - 7 = 41\)
Here 7 < 10 — the CI’s check fails. ✗
The hypothesis test’s check uses the expected counts under \(H_0\). The test asks what samples look like if \(H_0\) is true, so the check uses what \(H_0\) expects:
- Expected successes: \(48 \times 0.25 = 12\) ≥ 10 ✓
- Expected failures: \(48 \times 0.75 = 36\) ≥ 10 ✓
Both clear 10 — the test’s check passes.
Same 48 records, opposite verdicts — which is the point: which counts you check depends on which analysis you are running. The normal-model test can proceed. For the interval, the fallback is the simulation tool from topic 4: a bootstrap percentile interval, which never relied on the normal approximation.
Common error: running the test’s expected-count check for the CI. It isn’t wrong arithmetic — it’s the wrong check.
Example 4: Normal Probability Calculations
Scenario: A wildlife biologist studying Eastern gray squirrels measures body length (nose to base of tail) for a large population. The lengths are approximately normally distributed with:
- Mean (μ) = 25 cm
- Standard deviation (σ) = 2 cm
Use the 68-95-99.7 rule to answer the following questions about squirrel lengths.
Background: The 68-95-99.7 Rule
For a normal distribution:
- About 68% of values fall within 1 standard deviation of the mean
- About 95% of values fall within 2 standard deviations of the mean
- About 99.7% of values fall within 3 standard deviations of the mean
Question A: What range contains the middle 68% of squirrel lengths?
The middle 68% falls within 1 standard deviation of the mean.
Calculation:
- Lower bound: \(\mu - 1\sigma = 25 - 2 = 23\) cm
- Upper bound: \(\mu + 1\sigma = 25 + 2 = 27\) cm
Answer: Between 23 cm and 27 cm
Question B: What proportion of squirrels are longer than 29 cm?
First, convert 29 cm to a Z-score:
\[Z = \frac{29 - 25}{2} = \frac{4}{2} = 2\]
So 29 cm is 2 standard deviations above the mean (Z = 2).
From the 68-95-99.7 rule: About 95% of values fall between Z = -2 and Z = 2.
This means:
- 95% of squirrels fall between 21 cm and 29 cm
- The remaining 5% fall in the two tails combined
- By symmetry: 2.5% fall above Z = 2 and 2.5% fall below Z = -2
Answer: Approximately 2.5% of squirrels are longer than 29 cm.
Question C: What proportion of squirrels have lengths between 23 cm and 29 cm?
Convert both values to Z-scores:
For 23 cm: \[Z = \frac{23 - 25}{2} = \frac{-2}{2} = -1\]
For 29 cm: \[Z = \frac{29 - 25}{2} = \frac{4}{2} = 2\]
So we need the proportion between Z = -1 and Z = 2.
Using the 68-95-99.7 rule:
- About 68% fall between Z = -1 and Z = 1 (this is the middle 68%)
- About 95% fall between Z = -2 and Z = 2
Since we want between Z = -1 and Z = 2, we need to think about this in pieces:
- From Z = -1 to Z = 0: half of the middle 68% = 34%
- From Z = 0 to Z = 2: half of 95% = 47.5%
- Total: 34% + 47.5% = 81.5%
Answer: Approximately 81.5% of squirrels have lengths between 23 cm and 29 cm.
Note: This question requires combining parts of the empirical rule, making it more advanced than simple applications.
Question D: What is unusual about a squirrel measuring 18 cm?
Convert to Z-score:
\[Z = \frac{18 - 25}{2} = \frac{-7}{2} = -3.5\]
This squirrel is 3.5 standard deviations below the mean.
From the 68-95-99.7 rule:
- About 99.7% of squirrels fall between Z = -3 and Z = 3
- This means about 0.3% fall outside this range
- Since Z = -3.5 is beyond 3 standard deviations below the mean, this squirrel is in the extreme lower tail
More precisely:
- About 0.15% of squirrels are shorter than Z = -3 (below 19 cm)
- A squirrel at Z = -3.5 (18 cm) is even more unusual
- Such a squirrel would be in approximately the lowest 0.02% of all squirrels (about 2 in 10,000)
Answer: An 18 cm squirrel is extremely unusual – it falls 3.5 standard deviations below the mean, making it shorter than approximately 99.98% of squirrels.
Key Takeaways
Formula Summary
Standard Error:
- For H-test: \(SE = \sqrt{\frac{p_0(1-p_0)}{n}}\) (use null value)
- For CI: \(SE = \sqrt{\frac{\hat{p}(1-\hat{p})}{n}}\) (use observed value)
Test Statistic:
\[Z = \frac{\hat{p} - p_0}{SE}\]
Confidence Interval:
\[\text{CI} = \hat{p} \pm z^* \times SE\]
Important Reminders
- Always check conditions before using the normal model
- Use correct value in SE formula: \(p_0\) for H-tests, \(\hat{p}\) for CIs
- Use the matching success-failure check: expected counts (\(np_0\) and \(n(1-p_0)\)) for H-tests, observed counts for CIs
- Match tail direction to alternative hypothesis: Right tail for \(H_A: p > p_0\), left tail for \(H_A: p < p_0\)
- 68-95-99.7 rule provides quick approximations for integer Z-scores
- Jamovi can calculate p-values and critical values using Model-Based Inference tool