Section 3.2-3.3

February 9, 2021

Section 3.2: 2SD and Theory-based Confidence Intervals for a Single Proportion

Introduction

  • In Section 3.1 we found confidence intervals by doing repeated tests of significance (changing the value in the null hypothesis) to find a range of values that were plausible for the population parameter (long run probability or population proportion).
  • This is a very tedious way to construct a confidence interval.
  • Today, we will look at two other ways to construct confidence intervals [2SD and Theory-Based].

The Affordable Care Act

  • A November 2013 Gallup poll based on a random sample of 1,034 adults asked whether the Affordable Care Act had affected the respondents or their family.
  • 714 (69% of the sample of 1,034) responded that the act had no effect. (This number went down to 59% in May 2014 and 54% in Oct 2014.)
  • What can we say about the proportion of all adult Americans that would say the act had no effect?

CI using plausible values

  • We could construct a confidence interval just like we did last time.
Probability under null 0.659 0.660 0.661 \(\cdots\) 0.717 0.718 0.719
Two-sided p-value 0.0388 0.0453 0.0514 \(\cdots\) 0.0517 0.0458 0.0365
Plausible? (\(\alpha = 0.05\)) No No Yes \(\cdots\) Yes No No
  • We find we are 95% confident that the proportion of all adult Americans that felt unaffected by the ACA is between 0.661 and 0.717.
  • News stories usually report this as \(69\% \pm 3\%\)
    • The poll has a “3% margin of error.”
    • It is plausible that the true proportion is between 0.66 and 0.72.

Short Cut?

  • The method we used last time to find our interval of plausible values for the parameter is tedious and time consuming.
  • Might there be a short cut?
  • Our sample proportion should be the middle of our confidence interval.
  • We just need a way to find out how wide it should be.

Two standard deviations

When a null distribution is bell-shaped, about 95% of the statistics will fall within 2 standard deviations of the mean with the other 5% outside this region.

95% 2SD Confidence Interval

  • So we could say that a parameter value is plausible if it is within 2 standard deviations (SD) from our best estimate of the parameter, our observed sample statistic.
  • This gives us the simple formula for a 95% 2SD confidence interval of

\[ \hat{p} \pm 2 \times \text{SD}_\text{null} \]

2SD Method

  • Use the One Proportion Applet to generate a null distribution for \(H_0 : \pi = 0.5\), and record \(\text{SD}_\text{null} \approx 0.016\).

  • Using the 2SD method on our ACA data we get a 95% confidence interval \[ 0.69 \pm 2(0.016) = 0.69 \pm 0.032 = (0.658, 0.722) \]

  • The 0.032 in the above is called a margin of error.

  • This interval is close to what we got using plausible values: (0.661, 0.717).

Theory-Based Methods

  • We can use the 2SD method with the theory-based approximation for the standard deviation of the null distribution: \(\text{SD}_\text{null} \approx \sqrt{\frac{\pi(1-\pi)}{n}}\).
  • Instead of making up some \(\pi\) to use in this formula, we can use \(\hat{p}\).
  • The approximate, theory-based 95% 2SD confidence interval is \[ \begin{align} \hat{p} \pm 2 \times \sqrt{\frac{\hat{p}(1-\hat{p})}{n}} &= 0.69 \pm 2 \times \sqrt{\frac{0.69(1-0.69)}{1034}} \\ &\approx 0.69 \pm 0.028 \\ &\approx (0.662, 0.718) \end{align} \]

Other confidence levels

  • If we want other confidence levels, we change the multiplier.
  • The general theory-based confidence interval for a single proportion is:

\[ \hat{p} \pm \text{(multiplier)} \times \sqrt{\frac{\hat{p}(1-\hat{p})}{n}} \]

  • 2 (or rather 1.96) is the multiplier for 95% confidence.
  • 1.645 gives a 90% CI. 2.576 gives a 99% CI.
  • The higher the confidence level, the bigger the multiplier (need software or a table).

Software for Theory-based CI’s

prop.test(714, 1034, conf.level = 0.95)

    1-sample proportions test with continuity correction

data:  714 out of 1034, null probability 0.5
X-squared = 149.37, df = 1, p-value < 2.2e-16
alternative hypothesis: true p is not equal to 0.5
95 percent confidence interval:
 0.6611898 0.7184201
sample estimates:
        p 
0.6905222 

R is actually using a slightly more accurate theory-based method.

Exploration 3.2: American Exceptionalism

Preview

The Gallup organization conducted a survey with a random sample of 1,019 adult Americans on December 10-12, 2010. They found that 80% of the respondents agreed with the statement that the United States has a unique character that makes it the greatest country in the world.

Plausible z-scores?

In the WeBWorK preview, we found that \(\pi = 0.775\) was plausible, but \(\pi = 0.5\) is not plausible. We also recorded an \(\text{SD}_\text{null} = 0.016\) using \(\pi = 0.5\) and \(\text{SD}_\text{null} = 0.013\) using \(\pi = 0.775\).

  • Notice that the \(\text{SD}_\text{null}\) is larger when using \(\pi = 0.5\) than when using \(\pi = 0.775\).

2SD method

2SD method. We can construct a 95% confidence interval of plausible values for a parameter by including all values that fall within 2 standard deviations of the sample statistic.

\[ \mbox{observed statistic} \pm 2 \times (\mbox{SD of null distribution}) \]

  • We typically get a larger \(\text{SD}_\text{null}\) using \(\pi = 0.5\).
  • So when we use the 2SD method, we’ll use \(\pi = 0.5\) to be more conservative (report a larger margin of error).

2SD Simulation-based CI

In a random sample of 1,019 adult Americans, 80% of the respondents agreed with the statement that the United States has a unique character that makes it the greatest country in the world.

  1. Determine a 95% confidence interval using the 2SD method. Use \(\pi = 0.5\) to simulate a null distribution to get \(\text{SD}_\text{null}\). Record the confidence interval in \(\pm\) notation.

  2. Interpret the confidence interval in the context of this problem: We are 95% confident that _____ is between _____ and _____. Everyone should type up this sentence using this form.

Standard error of \(\hat{p}\)

An estimate of the standard deviation of a statistic, based on sample data, is called the standard error (SE) of the statistic.

\[ (\mbox{Standard Error of } \hat{p}) = \sqrt{\frac{\hat{p}(1-\hat{p})}{n}} \]

Join your table group for the remaining questions.

  1. Calculate and record the standard error for this study. How does it compare to the standard deviations you found in the Preview assignment?

Validity

The theory-based approach for finding a confidence interval for \(\pi\) (called a one-sample z-interval) is considered valid if there are at least 10 observational units in each category of the categorical variable (i.e., at least 10 successes and at least 10 failures).

Theory-based CI

  1. We will rely on technology to find the multiplier appropriate for our confidence level.
    • In the Theory-Based Inference applet, specify the sample size \(n\) of 1019 and the sample the sample count of 815 and press Calculate. (The applet will fill in the value of \(\hat{p}\).)
    • Check the box for Confidence Interval, confirm the confidence level is 95% and press Calculate CI to generate a theory-based confidence interval. Record the 95% theory-based confidence interval.
  2. Is this theory-based confidence interval similar to the one you obtained using the 2SD method?

Confidence level

  1. Change the confidence level in the applet from 95% to 99% and press the Calculate CI button again. Record the 99% confidence interval given by the applet.

  2. How does it compare to the 95% interval? (Compare both the midpoint of the interval = (lower endpoint + upper endpoint)/2 and the margin of error = (upper endpoint - lower endpoint)/2.)

CI’s in R

prop.test(815, 1019, conf.level = 0.95)

    1-sample proportions test with continuity correction

data:  815 out of 1019, null probability 0.5
X-squared = 365.16, df = 1, p-value < 2.2e-16
alternative hypothesis: true p is not equal to 0.5
95 percent confidence interval:
 0.7736183 0.8236924
sample estimates:
        p 
0.7998037 

CI’s in R

prop.test(815, 1019, conf.level = 0.99)

    1-sample proportions test with continuity correction

data:  815 out of 1019, null probability 0.5
X-squared = 365.16, df = 1, p-value < 2.2e-16
alternative hypothesis: true p is not equal to 0.5
99 percent confidence interval:
 0.7651051 0.8305648
sample estimates:
        p 
0.7998037 

CI’s and Hypothesis tests

  • Recall that a null value is plausible at a significance level \(\alpha\) if you would not reject \(H_0\).
  • Recall also that confidence intervals are intervals of plausible values.
  • In other words, a \((1-\alpha)\) confidence interval contains null values that you would not reject at significance level \(\alpha\).

Use your confidence intervals from #4 and #6 to answer the following questions.

  1. At a signficance level of \(\alpha = 0.05\), would you reject \(H_0 : \pi = 0.83\) in favor of the alternative \(H_a : \pi \neq 0.83\)?

  2. At a signficance level of \(\alpha = 0.01\), would you reject \(H_0 : \pi = 0.83\) in favor of the alternative \(H_a : \pi \neq 0.83\)?

Section 3.3: 2SD and Theory-based Confidence Intervals for a Single Mean

Introduction

  • In Section 3.2, we saw shortcuts for constructing confidence intervals for a population proportion \(\pi\).
    • The variables were categorical, so we summarized the data with \(\hat{p}\).
  • Now we are going to use similar shortcuts to construct confidence intervals for a population mean \(\mu\).
    • The variables will be quantitative, we will summarize the data with the sample mean \(\bar{x}\) and the sample standard deviation \(s\).

Example: Used Cars

Question: How much does a used Honda Civic cost?

Used Car Data

The following histogram displays data for the selling price of 102 Honda Civics that were listed for sale on the Internet.

Used Cars

  • While we should be cautious about our sample being representative of the population, let’s treat it as such.
  • The sample mean is \(\bar{x} = \$13,292\).
  • We don’t presume that \(\mu = \$13,292\), but it should be “close.”
  • To determine how close, we can construct a confidence interval.

Confidence Intervals

  • Remember the basic form of a confidence interval is:
    \[ \text{statistic} \pm (\text{multiplier}) \times (\text{SD of statistic}) \]

  • In our case, the statistic is \(\bar{x}\), so we write our 2SD confidence interval as: \[ \bar{x} \pm 2 \times (\text{SD of } \bar{x}) \]

  • We need a way to estimate SD of \(\bar{x}\).

Confidence intervals

  • Important: The SD of \(\bar{x}\) and the SD of our sample (\(s = \$4,535\)) are not the same.

  • There is more variability in the data (the car-to-car variability) than in sample means.

  • We can approximate the variability in the sample means as \(s / \sqrt{n}\).

  • So we can write a 2SD confidence interval as: \[ \bar{x} \pm 2 \times \frac{s}{\sqrt{n}} \]

  • This method gives a rough approximation for a 95% CI.

Theory-based CI for \(\mu\): Validity

  • A theory-based confidence interval is quite similar except it uses a multiplier that is based on a t-distribution and is dependent on the sample size and confidence level. (We will let the applet figure all this out for us.)
  • For theory-based confidence interval for a population mean (called a one-sample t-interval) to be valid, the population distribution should be symmetric or we need to have a sample size of at least 20 and the sample distribution should not be strongly skewed.
  • So you can use theory-based CI’s for samples smaller than 20, but if you do you are making the assumption that the population is symmetrically (normally) distributed.

Theory-based CI for \(\mu\)

The confidence interval for a population mean has the form: \[ \bar{x} \pm (\text{multiplier}) \times \frac{s}{\sqrt{n}} \]

  • \(\bar{x}\) is the center (our best estimate for the population mean).
  • \(s/\sqrt{n}\) is the predicted value of the standard deviation of the null distribution (also called the standard error).
  • \(\text{multiplier}\) is a number that is dependent upon the confidence level (\(\approx\) 2 for 95% confidence intervals)

Data

carPrices
    Price
1   21990
2   21990
3   21987
4   20955
5   20955
6   19995
7   19990
8   19990
9   19975
10  18995
11  17995
12  17987
13  17495
14  17299
15  17200
16  16995
17  16995
18  16990
19  16988
20  16987
21  16987
22  16900
23  16495
24  16300
25  16288
26  16000
27  15995
28  15995
29  15990
30  15990
31  15500
32  15499
33  15490
34  15288
35  15225
36  15030
37  14999
38  14995
39  14995
40  14994
41  14988
42  14987
43  14987
44  14987
45  14987
46  13995
47  13995
48  13995
49  13995
50  13995
51  13994
52  13990
53  13988
54  13987
55  13987
56  13987
57  13900
58  13795
59  13649
60  13599
61  12995
62  12990
63  12988
64  12987
65  12950
66  12900
67  12585
68  12500
69  12495
70  12488
71  11988
72  11987
73  10995
74  10995
75  10992
76  10305
77   9988
78   9987
79   9950
80   9900
81   9275
82   8997
83   8992
84   8979
85   8395
86   8395
87   7995
88   7995
89   7500
90   7500
91   6995
92   6900
93   6700
94   6450
95   6200
96   4995
97   4995
98   3975
99   3975
100  3000
101  2950
102  1200

Summary Statistics

mean(carPrices$Price)
[1] 13292.33
sd(carPrices$Price)
[1] 4534.568

2SD interval: \(13292 \pm 2 \times \frac{4534.568}{\sqrt{102}} \approx (12394, 14190)\)

Theory-based inference applet

We can just paste the Used Car data into the Theory-based inference applet.

Theory-based interval in R

t.test(carPrices$Price)

    One Sample t-test

data:  carPrices$Price
t = 29.605, df = 101, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
 12401.66 14183.01
sample estimates:
mean of x 
 13292.33 
  • Compare to 2SD interval: (12394, 14190)
  • 2SD interval is a little wider, but close (3 sig figs)

Exploration 3.3: Sleepless Nights? (continued)

Wake up and complete the following questions on the Jamboard with your table group.

Sleep data

  1. In Exploration 2.2, we collected data on how many hours of sleep we got. Use the Descriptive Statistics applet to get \(n\), \(\bar{x}\), and \(s\) for our class data. Record these values.

  2. Based on this data, what is the best estimate for \(\mu\), the average amount of sleep Westmont students get? (Hint: it’s one of the statistics from #1.)

  3. It was tricky to generate a null distribution to estimate \(\text{SD}_\text{null}\), the standard deviation of sample means. Instead, record the standard error, \(s/\sqrt{n}\).

Validity Conditions

The theory-based interval for a population mean (called a one-sample t-interval) requires that the quantitative variable should have a symmetric distribution or you should have at least 20 observations and the sample distribution should not be strongly skewed.

  1. Do these validity conditions hold for our data? (We answered this question in Exploration 2.2 also.)

2SD Confidence interval

  1. Compute a 95% 2SD confidence interval for \(\mu\), using the standard error you recorded in #3. Record this interval.

  2. Complete this sentence, recording what goes in the blanks. We are 95% confident that _____ is between _____ and _____.

Theory-based inference applet

  1. We can also use the Theory-Based Inference applet to get confidence intervals. Use the One Mean scenario, check the boxes for Paste Data and Includes header, Clear the sample data, and paste in our class data. Record the 95% theory-based t-interval from the applet. Compare it to the 2SD interval that you calculated in #5-#6.

  2. Record a 90% confidence interval also.

  3. Which interval is wider, the 95% or the 90%? Explain why it makes sense that this interval is wider.

CI’s and Hypothesis tests

Use your CI’s from #7 and #8 to answer the following.

  1. At a signficance level of \(\alpha = 0.05\), would you reject \(H_0 : \mu = 7.8\) in favor of the alternative \(H_a : \mu \neq 7.8\)?

  2. At a signficance level of \(\alpha = 0.10\), would you reject \(H_0 : \mu = 7.8\) in favor of the alternative \(H_a : \mu \neq 7.8\)?

Record your answers. Write a sentence or diagram explaining how you can use a confidence interval to determine the result of a hypothesis test.

One-mean confidence intervals in R

sleepDF <- read.table("https://math.westmont.edu/ma5/classSleep.txt", header = TRUE)
t.test(sleepDF$SleepHours)

    One Sample t-test

data:  sleepDF$SleepHours
t = 45.562, df = 57, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
 7.17449 7.83413
sample estimates:
mean of x 
  7.50431 

This is more accurate than the applet.

One-mean confidence intervals in R

You can change the confidence level:

t.test(sleepDF$SleepHours, conf.level = 0.90)

    One Sample t-test

data:  sleepDF$SleepHours
t = 45.562, df = 57, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
90 percent confidence interval:
 7.228916 7.779705
sample estimates:
mean of x 
  7.50431 

One-mean p-values in R

You can set the null value for a two-sided hypothesis test:

t.test(sleepDF$SleepHours, conf.level = 0.90, mu = 7.8)

    One Sample t-test

data:  sleepDF$SleepHours
t = -1.7952, df = 57, p-value = 0.07792
alternative hypothesis: true mean is not equal to 7.8
90 percent confidence interval:
 7.228916 7.779705
sample estimates:
mean of x 
  7.50431