|
population <- ames$Gr.Liv.Area
samp_mean <- rep(NA, 10)
n <- 60
pop_sd<-sd(population) # save population sd
for(i in 1:50){
samp <- sample(population, n) # obtain a sample of size n = 60 from the population
samp_mean[i] <- mean(samp) # save sample mean in ith element of samp_mean
}
lower_vector <- samp_mean - 1.96 * pop_sd / sqrt(n)
upper_vector <- samp_mean + 1.96 * pop_sd / sqrt(n)
plot_ci(lower_vector, upper_vector, mean(population))
I put this in R-Studio and it gave me a plot. So, the do I just do:
>p <-1-(2/10)
>p
[1] 0.8
|