Problem statement

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.

Find sample mean

#midpoint of the interval
sample.mean <- (18.985 + 21.015)/2
print(sample.mean)
## [1] 20

Find sample standard deviation

Margin of error = t_n-1 * sd/sqrt(n)

# number of samples
n=36

# margin of error
ME <- (21.015-18.985)/2

# test statistic at n-1 degrees of freedom
t_df <- qt(0.975, n-1)

# solve for sd
sd <- ME*sqrt(n)/t_df
round(sd,3)
## [1] 3