Question

R Simulation: For n = 10, simulate a random sample of size n from N(µ,σ2), where...

R Simulation:

For n = 10, simulate a random sample of size n from N(µ,σ2), where µ = 1 and σ2 = 2; compute the sample mean. Repeat the above simulation 500 times, plot the histogram of the 500 sample means (does it mean that I can just use hist() method instead of plot() method). Now repeat the 500 simulations for n = 1,000. Compare these two sets of results with different sample sizes, and discuss it in the context of consistency.

Homework Answers

Answer #1

norm <- rnorm(n = 10,mean = 1,sd = 2)
norm
x<-mean(norm)
x

#simulations 500 times
for(i in 1:500){
y=y+mean(rnorm(n = 10,mean = 1,sd = 2))
}
y=y/500
y
hist(y)


#500 simulations for n=1000

for(i in 1:500){
z=z+mean(rnorm(n = 1000,mean = 1,sd = 2))
}
z=z/500
z

Hope this helped you! Please comment below still if you have any doubts on this answer.


Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT