October 28, 2015

Exercise 5.5

Working backwards, Part I.


A 95% confidence interval for a population mean, μ, is given as (18.985, 21.015). This confidence interval is based on a simple random sample of 36 observations. Calculate the sample mean and standard deviation. Assume that all conditions necessary for inference are satisfied. Use the t-distribution in any calculations.

Step 1: Set up the equations.

Solving this problem requires a little bit of algebraic manipulation. We use the formula for finding the margin of error and the sample mean as the point estimate.

\[(lower,\quad upper)\quad =\quad \overline { x } \quad \pm \quad { SE }_{ \overline { x } }\]
where


\[{ SE }_{ \overline { x } }\quad =\quad { t }^{ * }\frac { s }{ \sqrt { n } }\]

Step 2: Find the t-statistic in R

The t statistic can be found using the qt function. 1 is subtracted from the confidence interval and divided by two. This is then used as input into the qt function.

conf_int = .95
n = 36
df = n - 1
alpha_2 = (1 - conf_int)/2
t_stat = abs(qt(alpha_2,df))
sprintf("t statistic: %.3f",t_stat)
## [1] "t statistic: 2.030"

Step 3: Calculate sample mean.

Since we are given the actual confidence interval (18.985, 21.015), we can use the midpoint formula to find the margin of error and then subtract that value from the upper value of the confidence interval to find the sample mean.

interval = c(18.985,21.015)
me = (interval[2] - interval[1])/ 2
print(sprintf("ME: %f", me))
## [1] "ME: 1.015000"
x = interval[2] - me
sprintf("Sample Mean: %.3f", x)
## [1] "Sample Mean: 20.000"

Step 4: Solve ME equation for s.

Now we have all the neccesary components to solve for the standard deviation with the original formula using the upper confidence interval value and addition.
\[upper\quad =\quad \overline { x } \quad + \quad { t }^{ * }\frac { s }{ \sqrt { n } }\]

Rewrite the equation to solve for s.

\[\frac { \sqrt { n } \left( upper\quad -\quad \overline { x } \right) }{ { t }^{ * } } \quad =\quad s\]

Step 4: Use R to solve for s.


s = (sqrt(n) * (interval[2] - x))/t_stat
sprintf("standard dev: %.3f",s)
## [1] "standard dev: 3.000"