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

In R or your favorite computing environment, write a program that can generate a

ID: 3306002 • Letter: I

Question

In R or your favorite computing environment, write a program that can generate a simple random sample without replacement and calculate the usual 95% confidence interval for the population mean. Construct a population of size 500 for which the usual interval based on a sample of size 50 covers the true mean less than 50% of the time. Show this is true by considering the results from 500 random samples.

For extra credit, construct a population and give a mathematical argument that shows the ususal interval will cover only 10% of the time.

Explanation / Answer

I will take population of size 500 from binomial distribution of size 10 with probability of success 0.8

R-Code

> N=500

> Y=rbinom(N,10,0.8)
> Y
[1] 8 6 6 9 6 5 8 7 9 5 6 9 10 10 9 8 10 8 7 8 6 9 8 10 9
[26] 10 7 9 8 8 10 6 9 6 8 7 7 9 9 9 7 8 8 8 9 8 7 7 8 10
[51] 7 8 10 7 9 9 7 7 7 9 8 7 8 8 6 9 6 9 6 10 7 7 10 10 8
[76] 6 8 7 9 7 10 7 8 7 9 5 7 10 9 8 7 8 9 8 8 10 8 9 5 8
[101] 6 8 7 7 7 8 7 9 8 8 6 4 10 6 6 9 10 9 9 6 6 10 8 6 7
[126] 7 9 9 8 8 8 9 9 9 8 8 10 7 8 7 8 7 9 5 7 10 7 9 8 7
[151] 6 8 8 10 7 10 9 7 7 8 9 8 8 7 9 10 7 7 9 8 10 7 9 8 9
[176] 9 9 8 9 7 5 8 8 6 7 7 8 9 7 9 8 8 7 7 8 7 7 9 7 10
[201] 9 7 7 7 9 7 8 10 5 9 9 8 8 6 7 8 9 6 6 6 8 7 8 9 9
[226] 9 9 6 7 10 8 8 8 8 9 6 7 10 8 9 8 8 6 8 10 8 10 9 5 7
[251] 9 9 7 8 9 10 10 8 9 9 9 8 9 8 7 7 7 8 9 9 8 9 6 7 8
[276] 9 7 6 7 7 9 9 8 8 7 7 7 10 8 8 6 8 8 8 9 8 9 6 8 9
[301] 5 6 7 7 10 9 7 9 7 9 10 9 5 8 9 7 6 9 7 8 7 9 8 7 10
[326] 8 8 8 8 9 8 8 6 7 9 10 9 8 7 8 9 6 10 5 8 8 8 7 6 8
[351] 8 8 10 8 7 6 8 8 8 8 6 10 7 10 9 5 7 8 9 8 7 7 10 7 9
[376] 9 8 10 7 7 8 8 8 9 5 7 6 8 6 9 8 6 7 9 7 6 9 7 7 6
[401] 8 8 7 5 9 5 7 9 9 9 9 9 9 8 10 9 7 8 8 8 7 6 8 7 9
[426] 7 8 10 8 10 8 10 8 7 6 9 8 9 6 7 8 7 8 9 6 9 7 6 7 8
[451] 10 9 10 10 8 9 8 6 10 8 7 8 8 6 8 8 8 5 6 8 8 9 10 5 8
[476] 9 6 6 9 8 9 8 6 9 9 9 9 5 8 9 8 10 8 10 5 9 9 8 7 10
> length(Y)
[1] 500
> n=50
> y=sample(Y,n,replace= F)
> y
[1] 8 9 7 8 9 7 10 9 7 8 8 6 7 8 6 9 10 9 8 5 6 9 7 6 8
[26] 7 7 6 8 7 6 9 8 9 8 8 9 6 8 8 8 9 7 8 6 8 8 8 8 7
> length(y)
[1] 50
> ybar=mean(y)
> ybar
[1] 7.7
> var.ybar=var(y)
> var.ybar
[1] 1.316327
> # C.I.
> t=qt(0.975,n-1)
> t
[1] 2.009575
> LL=ybar - t*sqrt(var.ybar)
> LL
[1] 5.394389
> UL=ybar + t*sqrt(var.ybar)
> UL
[1] 10.00561
> CI=c(LL,UL)
> CI
[1] 5.394389 10.005611

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote