Inference for Proportions

Applied Statistics

MTH-361A | Spring 2025 | University of Portland

March 19, 2025

Objectives

Previously… (1/3)

The guiding principle of statistics is statistical thinking.

Statistical Thinking in the Data Science Life Cycle

Statistical Thinking in the Data Science Life Cycle

Previously… (2/3)

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)

Previously… (3/3)

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\)

Case Study I

Two scientists want to know if a certain drug is effective against high blood pressure.

  1. The first scientist wants to give the drug to 1000 people with high blood pressure and see how many of them experience lower blood pressure levels.
  2. The second scientist wants to give the drug to 500 people with high blood pressure, and not give the drug to another 500 people with high blood pressure, and see how many in both groups experience lower blood pressure levels.

Which is the better way to test this drug?

\(\star\) Answer: The second scientist that want 500 get the drug, 500 don’t.

Case Study I: Results from the GSS

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

Case Study I: Parameter and Point Estimate

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?

Case Study I: Inference on a 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}}.\]

Case Study I: Central Limit Theorem for Proportions

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:

Case Study I: Infering the True Proportion

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.

Case Study I: Confidence Interval

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?

  1. \(0.85 \pm 1.65 \times \sqrt{\frac{0.85 \times 0.15}{670}}\)
  2. \(0.85 \pm 1.96 \times \sqrt{\frac{0.85 \times 0.15}{670}}\)
  3. \(0.85 \pm 1.96 \times \frac{0.85 \times 0.15}{\sqrt{670}}\)
  4. \(571 \pm 1.96 \times \sqrt{\frac{571 \times 99}{670}}\)

\(\star\) Answer: \(0.85 \pm 1.96 \times \sqrt{\frac{0.85 \times 0.15}{670}} \longrightarrow (0.82,0.88)\)

Case Study I: Choosing a sample size

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.

Parameter Estimation for One Proportion

Conditions

Confidence Intervals for One Proportion

\[\hat{p} \pm z^{\star} SE_{\hat{p}}\]

Parameter Estimation for Two Proportions

Conditions

Confidence Intervals for Two Proportions

\[\hat{p}_B - \hat{p}_A \pm z^{\star} SE_{\hat{p}_B - \hat{p}_A}\]

Case Study II

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.

Case Study II: Define Hypotheses

Let \(p\) represent the true proportion of satisfied customers.

\(\star\) This is a one-tailed test because the \(H_A\) is using the \(<\) sign.

Case Study II: Compute the Test Statistic

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.

Case Study II: Determine the P-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.

Case Study II: Make a Conclusion

We compare the p-value to our chosen significance level of \(\alpha = 0.05\).

Conclusion:

\(\star\) Since \(0.0238 < 0.05\), we reject the null hypothesis (\(H_0\)).

Case Study II: What does the Significance Level Mean?

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.

Case Study II: One Proportion Confidence Interval

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.

Hypothesis Testing for One Proportion (1/2)

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.

Hypothesis Testing for One Proportion (2/2)

Compute the Test Statistic

\[z = \frac{\hat{p}-p_0}{SE_p}\]

Determine the P-Value

Make a Decision and conclusion

Hypothesis Testing for Two Proportions (1/2)

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.

Hypothesis Testing for Two Proportions (2/2)

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

Activity: Rock-Paper-Scissors Hypothesis Testing

  1. Make sure you have a copy of the W 3/19 Worksheet. This will be handed out physically and it is also digitally available on Moodle.
  2. Work on your worksheet by yourself for 10 minutes. Please read the instructions carefully. Ask questions if anything need clarifications.
  3. Get together with another student.
  4. Discuss your results.
  5. Submit your worksheet on Moodle as a .pdf file.

RPS Wins Data

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\)

RPS Proportion of Wins Data

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\)

References

Diez, D. M., Barr, C. D., & Çetinkaya-Rundel, M. (2012). OpenIntro statistics (4th ed.). OpenIntro. https://www.openintro.org/book/os/
Speegle, Darrin and Clair, Bryan. (2021). Probability, statistics, and data: A fresh approach using r. Chapman; Hall/CRC. https://probstatsdata.com/