MTH-361A | Spring 2025 | University of Portland
March 19, 2025
The guiding principle of statistics is statistical thinking.
Statistical Thinking in the Data Science Life Cycle
Types of Inference
Parameter Estimation | Hypothesis Testing | |
---|---|---|
Goal | Estimate an unknown population value | Assess claims about a population value |
Methods | Point Estimation: A single value estimate (e.g., sample
mean) Interval Estimation: A range of plausible values (e.g., confidence interval) |
State a null and an alternative hypothesis Compute a test statistic and compare it to a threshold (p-value or critical value) |
Key Concept | Focuses on precision in estimation (confidence intervals) | Focuses on decision-making based on evidence (reject or fail to reject the null hypothesis) |
Types of Decision Errors
Reality/Decision | Reject \(H_0\) | Fail to reject \(H_0\) |
---|---|---|
\(H_0\) is true | Type I error with probability \(\alpha\) (significance level) |
Correct decision with probability \(1-\alpha\) (confidence level) |
\(H_0\) is false | Correct decision with probability \(1-\beta\) (power of test) |
Type II error with probability \(\beta\) |
Two scientists want to know if a certain drug is effective against high blood pressure.
Which is the better way to test this drug?
\(\star\) Answer: The second scientist that want 500 get the drug, 500 don’t.
The GSS (General Social Survey) asks the same question, below is the distribution of responses from the 2010 survey:
Answer | Count |
---|---|
All 1000 get the drug | 99 |
500 get the drug 500 don’t | 571 |
Total | 670 |
We would like to estimate the proportion of all Americans who have good intuition about experimental design, i.e. would answer “500 get the drug 500 don’t”? What are the parameter of interest and the point estimate?
Parameter of interest: proportion of all Americans who have good intuition about experimental design. \[p \longrightarrow \text{a population proportion}\]
Point estimate: proportion of sampled Americans who have good intuition about experimental design. \[\hat{p} \longrightarrow \text{a sample proportion}\]
What percent of all Americans have good intuition about experimental design, i.e. would answer “500 get the drug 500 don’t”?
We can answer this research question using a confidence interval, which we know is always of the form \[\text{point estimate} \pm z^{\star} \times \text{SE}.\]
Standard error (SE) of a sample proportion \[SE_{\hat{p}} = \sqrt{\frac{p(1-p)}{n}}.\]
Sample proportions will be nearly normally distributed with mean equal to the population mean, \(p\), and standard error equal to \(\sqrt{\frac{p(1-p)}{n}}\).
This is true only under certain conditions:
Note:
The GSS found that 571 out of 670 (85%) of Americans answered the question on experimental design correctly. Estimate (using a 95% confidence interval) the proportion of all Americans who have good intuition about experimental design?
Given: \(n = 670\), \(\hat{p} = 0.85\). First check conditions.
We are given that \(n = 670\), \(\hat{p} = 0.85\), we also just learned that the standard error of the sample proportion is \[SE_{\hat{p}} = \sqrt{\frac{p(1-p)}{n}}.\]
Which of the below is the correct calculation of the 95% confidence interval?
\(\star\) Answer: \(0.85 \pm 1.96 \times \sqrt{\frac{0.85 \times 0.15}{670}} \longrightarrow (0.82,0.88)\)
Previously, for \(n=670\) the margin of error is \(1.96 \times \sqrt{\frac{0.85 \times 0.15}{670}} \approx 0.027\).
How many people should you sample in order to cut the margin of error of a 95% confidence interval down to 0.01?
\[z^{\star} \times SE_{\hat{p}}\]
\[ \begin{aligned} 1.96 \times \sqrt{\frac{0.85 \times 0.15}{n}} & \le 0.01 \\ 1.96^2 \times \frac{0.85 \times 0.15}{n} & \le 0.01^2 \\ n & \ge \frac{1.96^2 \times 0.85 \times 0.15}{0.01^2} \\ n & \ge 4898.04 \end{aligned} \]
\(\star\) The sample size should be at least 4,899 to have a 0.01 margin of error for 95% confidence interval.
Conditions
Confidence Intervals for One Proportion
\[\hat{p} \pm z^{\star} SE_{\hat{p}}\]
Conditions
Confidence Intervals for Two Proportions
\[\hat{p}_B - \hat{p}_A \pm z^{\star} SE_{\hat{p}_B - \hat{p}_A}\]
Customer Satisfaction at a Coffee Shop
Background: A local coffee shop prides itself on high customer satisfaction. The shop’s management claims that at least 85% of its customers are satisfied with their service. A market research firm is hired to assess this claim by conducting a survey.
Data Collection: The research firm randomly surveys 200 customers who visited Brew Haven in the past month. Among them, 160 reported being satisfied with the service.
Objective: Use hypothesis testing for one proportion to determine whether the claim that at least 85% of customers are satisfied is supported by the survey data.
Let \(p\) represent the true proportion of satisfied customers.
Null Hypothesis \(H_0\): \(p = 0.85\) (The satisfaction rate is equal to 85%.)
Alternative Hypothesis \(H_A\): \(p < 0.85\) (The satisfaction rate is less than 85%.)
Choose Significance Level: A significance level of \(\alpha = 0.05\) is chosen.
\(\star\) This is a one-tailed test because the \(H_A\) is using the \(<\) sign.
The sample proportion is \[\hat{p} = \frac{160}{200} = 0.80.\]
Test statistic formula for one proportion: \[z = \frac{\hat{p} - p_0}{SE_{p}}\]
Substituting values: \[z = \frac{0.80 - 0.85}{\sqrt{\frac{0.85(1-0.85)}{200}}} \approx -1.9803\]
\(\star\) The standard error formula \(SE_{p}\) is the Binomial standard error and here we used the null value.
Determine the probability associated with the computed test statistic.
Using R:
pe <- 0.80 # point estimate
p_0 <- 0.85 # null value
n <- 200 # sample size
SE_p <- sqrt((p_0*(1-p_0))/(n)) # standard error
Z <- (pe-p_0)/SE_p # test statistic
# p-value
pnorm(Z,0,1)
## [1] 0.02383519
\(\star\) The p-value is the probability \(P(Z \le -1.9803) = 0.0238\) using \(Z \sim N(0,1\), the standard normal distribution. Since this is one-tailed test, we only use the left tail probability.
We compare the p-value to our chosen significance level of \(\alpha = 0.05\).
Conclusion:
If \(\text{p-value} < \alpha\), reject the null hypothesis and conclude that the satisfaction rate is significantly less than 85%.
If \(\text{p-value} \ge \alpha\), do not reject the null hypothesis; there is not enough evidence to claim that the satisfaction rate is lower than 85%.
\(\star\) Since \(0.0238 < 0.05\), we reject the null hypothesis (\(H_0\)).
Remember that we defined \(\alpha = 0.05\) arbitrarily before we conducted the hypothesis test.
The significance value \(\alpha\) is related to the confidence level of the confidence interval of the point estimate, which is \(1-\alpha\).
\(\star\) Key Idea: The significance level \(\alpha\) is the probability of rejecting the null hypothesis when it is actually true. In other words, it is the probability of making an error.
If we set a significance level \(\alpha = 0.05\), then the confidence level for the sample proportion is \(1-\alpha = 1 - 0.05 = 0.95\).
That is a 95% confidence interval of the sample proportion \(\hat{p} = 0.80\).
\(\star\) Key Idea: The null value of \(0.85\) is not within the 95% confidence interval. We would reject the null hypothesis at the 5% significance level.
Let \(p\) be the population parameter and \(p_0\) be the null value.
State Hypotheses
\(\star\) Note: The alternative hypothesis can be \(\ne\) (two-sided) and \(<\) or \(>\) (one-sided) depending on context.
Set Significance Value \(\alpha\)
Common values are \(\alpha = 0.10, 0.05, 0.01\). Note that \(\alpha\) is the Type I error rate.
Compute the Test Statistic
\[z = \frac{\hat{p}-p_0}{SE_p}\]
Determine the P-Value
Make a Decision and conclusion
Let \(p_A\) and \(p_B\) be the population parameters for groups \(A\) and \(B\) respectively and \(p_0\) be the null value.
State Hypotheses
\(\star\) Note: The alternative hypothesis can be \(\ne\) (two-sided) and \(<\) or \(>\) (one-sided) depending on context.
Set Significance Value \(\alpha\)
Common values are \(\alpha = 0.10, 0.05, 0.01\). Note that \(\alpha\) is the Type I error rate.
Compute the Test Statistic
\[z = \frac{\left(\hat{p}_B-\hat{p}_A\right)-p_0}{SE_{p_B - p_A}}\]
Determine the P-Value
Make a Decision and conclusion
.pdf
file.Data collection was done on 3/19/2025
Number of Wins
Blind (\(A\)) | Non-Blind (\(B\)) | Difference (\(B\)-\(A\)) | |
---|---|---|---|
Demonstration | \(6\) | \(5\) | \(-1\) |
Group 1 | \(8\) | \(4\) | \(-4\) |
Group 2 | \(6\) | \(5\) | \(-1\) |
Group 3 | \(7\) | \(5\) | \(-2\) |
Group 4 | \(4\) | \(6\) | \(2\) |
Total | \(31\) | \(25\) | \(-6\) |
Data collection was done on 3/19/2025
Proportions
Each group played 15 rounds for blind and 15 rounds for non-blind.
Blind (\(A\)) | Non-Blind (\(B\)) | Difference (\(B\)-\(A\)) | |
---|---|---|---|
Demonstration | \(\hat{p}_A = \frac{6}{15} \approx 0.40\) | \(\hat{p}_B = \frac{5}{15} \approx 0.3333\) | \(\hat{p}_B - \hat{p}_A = \frac{-1}{15} \approx -0.0667\) |
Group 1 | \(\hat{p}_A = \frac{8}{15} \approx 0.5333\) | \(\hat{p}_B = \frac{4}{15} \approx 0.2667\) | \(\hat{p}_B - \hat{p}_A = \frac{-4}{15} \approx -0.2667\) |
Group 2 | \(\hat{p}_A = \frac{6}{15} = 0.40\) | \(\hat{p}_B = \frac{5}{15} \approx 0.3333\) | \(\hat{p}_B - \hat{p}_A = \frac{-1}{15} \approx -0.0667\) |
Group 3 | \(\hat{p}_A = \frac{7}{15} \approx 0.4667\) | \(\hat{p}_B = \frac{5}{15} \approx 0.3333\) | \(\hat{p}_B - \hat{p}_A = \frac{-2}{15} \approx -0.1333\) |
Group 4 | \(\hat{p}_A = \frac{4}{15} \approx 0.2667\) | \(\hat{p}_B = \frac{6}{15} = 0.40\) | \(\hat{p}_B - \hat{p}_A = \frac{2}{15} \approx 0.1333\) |
Overall | \(\hat{p}_A = \frac{31}{75} \approx 0.4133\) | \(\hat{p}_B = \frac{25}{75} \approx 0.3333\) | \(\hat{p}_B - \hat{p}_A = \frac{-6}{75} \approx -0.08\) |