Using microsoft excel, take 100 random samples, each of size 23, from N(-64.2,3.
ID: 3354056 • Letter: U
Question
Using microsoft excel, take 100 random samples, each of size 23, from N(-64.2,3.6).
(a) For each random sample, compute a 95% confidence interval on your estimate of mean
(b) For each confidence interval, indicate whether -64.2 falls inside of the interval.
(c) How many would intervals would you expect to not contain -64.2 and why? Is your answer consistent with that expectation? Speculate on why or why not.
(d) In your answer, supply a table with 100 rows (one for each random sample), with each row showing the sample mean, ( the standard deviation of the sample, the lower bound of the confidence interval,the upper bound of the confidence interval, and whether -64.2 falls within that interval.
Explanation / Answer
table = NULL
for ( i in 1:100){
sample = rnorm (23, -64.2,3.6)
error = qt(0.975,22)*sd(sample)/sqrt(23)
left = mean(sample)-error
right = mean(sample)+error
inclusion = (-64.2<= right) * (-64.2>= left)
table_row = cbind.data.frame("SD" = sd(sample), "Lower Bound" = left, "Upper Bound" = right,"inclusion" = inclusion)
table = rbind.data.frame(table, table_row)
}
inclusion_probability = mean (table $ inclusion)
this code snippet gives you the required table and the final line gives you the inclusion probbaility
We expect the inclusion probability to be 0.95. However, as it turns out in my case(may differ when anyone else runs) is 0.99
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.