Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For help with this problem you may consult the sample R script called \"Sampling

ID: 3229700 • Letter: F

Question

For help with this problem you may consult the sample R script called "Sampling from the normal distribution and confidence intervals, " posted on the D2L page. Use R to simulate 40 samples of size n = 20 from a normal distribution with mean 50 and standard deviation 6 and find a two-sided 95% confidence interval for each of the samples. (a) How many of the intervals contain the true mean 50? the wrong mean 53? (b) If we increased the sample size to n = 100, what would happen to the length of the 95% confidence intervals? Would you expect more or less of these intervals to contain the true mean 50? (c) If you did not know that the true mean was 50, could you tell for any particular confidence interval whether or not it included the true mu?

Explanation / Answer

We simulate 40 samples of size n=20 from N(50,6) distribution in R and obtain a 95% confidence interval for each of these samples.

The R code for this problem is given below:

s=array(dim=1)
for(i in 1:40)
{
x=rnorm(20,50,6)
s[i]=sum(x)/20
}
lcl=s-6/sqrt(20)*qnorm(0.975)
ucl=s+6/sqrt(20)*qnorm(0.975)
data.frame(s,lcl,ucl)
length(which(lcl<50 & ucl>50)) no of samples containing 50
length(which(lcl<53 & ucl>53)) no of samples containing 53

(a)Thus from the simulations, we see that 37 samples contain the true mean 50 and 17 samples contain the false mean 53.

(b) If we increase the sample size we are increasing the accuracy of the sample estimator of mean and hence we would expect more samples to contain the true mean 50. Also the length of the confidence intervals would reduce and hence the probability that it will contain the false mean would also reduce significantly.

(c) If we didn't know the true mean then we can conclude that a given interval will contain the true mean with 95% probability if we are considering 95% confidence intervals.