This week, we've talked about confidence intervals, with a focus on means coming from numerical data. Today, we'll do something quite similar for proportions that arise from categorical data.
Like, last Wednesday's presentation, this is related to sections 5.1 and 5.2 of our text but follows that even more closely.
Suppose we take a random sample of 100 North Carolinians and check whether they are left handed or right handed. If 13 of them are left handed, we would say that the proportion of them who are left handed is $13\%$. That $13\%$ is a sample proportion $\hat{p}$ that estimates the population proportion $p$.
Note that a proportion is a numerical quantity, even though the data is categorical. Thus, we can compute confidence intervals in a very similar way. Just as with sample means, the sampling process leads to a random variable and, if certain assumptions are met, then we can expect that random variable to be normally distributed.
One notable computational difference between finding confidence intervals for propritions as compared to those for means is how we find the underlying standard deviation. For numerical data, we simply estimate the population standard deviation with standard deviation for the sample. For a sample proportion, if we identify success (being left handed, for example) with a $1$ and failure as a $0$, then (as we know from our discussion of the binomial distribution) the resulting standard deviation is
$$\sigma = \sqrt{p(1-p)}.$$It follows that the standard error is
$$SE = \frac{\sigma}{\sqrt{n}} = \sqrt{\frac{p(1-p)}{n}}.$$In the NC left/right handed example we have $$SE = \sqrt{\frac{p(1-p)}{n}} = \sqrt{\frac{0.13\times0.87}{100}} \approx 0.0336303.$$
Suppose we draw a random sample of 132 people and find that 16 of them have blue eyes. Use this data to write down a $95\%$ confidence interval for the proportion of people with blue eyes.
Solution: We have $\hat{p}=16/132 \approx 0.1212$ and
$$SE(\hat{p}) = \sqrt{(16/132)\times(116/132)/132} \approx 0.02840718.$$Thus, our confidence interval is
$$0.1212 \pm 2\times0.0284 = [0.0644, 0.178].$$If you read the details of political surveys, you're likely to come across the term "margin of error" at some point. I did a Google news search for "margin of error" just yesterday (2/24/22), for example, and the first political story was this one from The Hill which discusses political poles in Texas. In that story, we find
Texas Gov. Greg Abbott (R) tops his primary challengers and leads Democrat Beto O’Rourke in the Lone Star State's 2022 gubernatorial race, according to a new poll released Thursday.
Abbott currently leads O’Rourke in the poll by seven points, with 52 percent to those surveyed supporting Abbott and 45 percent supporting O’Rourke. Three percent are unsure of their vote.
How happy should Governor Abbott be with 52 percent of the survey?
In the same survey we find:
The Democratic primary sample surveyed 388 likely voters with a margin of error of plus or minus 4.9 percentage points.
The poll surveyed 522 likely voters in the Republican primary with a margin of error of 4.2 percentage points.
The general election sample surveyed 1,000 likely voters with a margin of error of plus or minus 3 percentage points.
With 52 percent support but a margin of error of $\pm 3\%$, I guess that Governor Abbott looks strong but doesn't have the race locked up.
As students of statistics, we'd like to know more precisely where phrases like "margin of error of plus or minus 3 percentage points" comes from and what it means.
When we write a confidence interval as $$s \pm z^* \times SE,$$ Then, $z^* \times SE$ is the margin of error. Geometrically, it's the distance that the interval extends in either direction from the measured statistic $s$.
So, where's the $\pm 3\%$ or $\pm 4.2\%$ or whatever come from?
Suppose we're writing down a confidence interval for a proportion. In this case, approve or disapprove. If the actual proportion is $p$ and our sample size is $n$, then the standard error is
$$\sqrt{\frac{p(1-p)}{n}}.$$In the Texas poll comparing both Abbott and O'Rourke, $n = 1000$. Furthermore the biggest that $p(1-p)$ can be is $1/4$. You can see this by taking a look at a graph:
In the Texas poll, the sample size was 1000. Thus, the standard error is at most
$$SE \leq \sqrt{\frac{1/4}{1000}} \approx 0.0158.$$Now, for a $95\%$ confidence interval, we could take $z^* = 1.96$ so that our margin of error is at most
$$ME \leq 1.96\times0.0158 \approx 0.03099.$$There's your 3 percentage points.
FiveThirtyEight, keeps track of a large collection of polls. The Hill article we just examined was run by a research group at Emerson college which has a A- rating from FiveThirtyEight. This same group conucted a survey last week that studied (among other things) President Biden's approval rating. The found that the President has a 42% approval rating among 1138 likely voters.
Problem: Use the results of this survey to write down a 95% confidence interval for Biden's approval rating.
We have
$$SE \leq \sqrt{\frac{1/4}{n}} = \sqrt{\frac{1/4}{1138}}\approx0.01482.$$Thus, our confidence interval is
$$0.42 \pm 2\times0.01482 = [0.390357,0.449643].$$We have $\hat{p}=0.42$ yielding an estimate of the standard error of
$$SE = \sqrt{\frac{\hat{p}(1-\hat{p})}{n}} = \sqrt{\frac{0.42\times0.58}{1138}}\approx0.00722.$$According to our Normal Calculator, $z^*=1.959964$. Thus, our confidence interval should be
$$0.42 \pm 1.959964\times0.00722 = [0.405849,0.434151].$$Recall that the margin of error generally depends on three things:
Sometimes, we require a specific confidence level and margin of error and, for a sample proportion, the underling standard deviation $\sqrt{p(1-p)}$ is never larger than $1/2$. Thus, we can always obtain the desired confidence level and margin of error by choosing sample size large enough.
In order to choose the sample size, we simply set up the inequality
$$z^*\sqrt{\frac{p(1-p)}{n}} < ME,$$where $z^*$ corresponds to the desired confidence level and $ME$ is the desired confidence level. Since $\sqrt{p(1-p)}<1/2$, this simplfies to
$$z^*\frac{1/2}{\sqrt{n}} < ME \: \text{ or } \: n>\frac{{z^*}^2}{4ME^2}.$$Suppose we wish to determine the percentage of voters who support our candidate. We'd like a $95\%$ level of confidence to $\pm2\%$ points. What sample size should guarantee this?
Simple solution: For a 95% level of confidence, we might take $z^*=2$ together with the given margin of error $ME=0.02$ to get
$$n>\frac{{z^*}^2}{4ME^2} = \frac{2^2}{2\times0.02^2} = 2500.$$Thus, a pollster would probably be happy with $n=2500$ folks in the poll.
We can get a more precise (possibly smaller) sample size by using more precise estimates to $z^*$. In fact, for the homework, you need three digits of precision for your $z^*$ multiplier. For 90, 95, and 99%, these are
Conf: | 90% | 95% | 99% |
---|---|---|---|
$z^*$ | 1.282 | 1.960 | 2.326 |
In the previous problem, we would have:
$$n>\frac{{z^*}^2}{4ME^2} = \frac{1.960^2}{2\times0.02^2} = 2400.$$Thus, the HW would like to see 2401.