In: Math
Create variables called sam20means and sam50means that contains the means of the samples. Use a density plot to show the sampling distribution of the means for sam20means and sam50means together.
Let us create samples from normal distribution with mean 20 and with sd 2.
R code:
sam20<-rnorm(20, 20,2)
sam50<-rnorm(50, 20,2)
d1 <- density(sam20)
d2 <- density(sam50)
par(mfrow=c(1,2))
plot(d1)
plot(d2)
se20<-sd(sam20)/sqrt(20);se20
se50<-sd(sam50)/sqrt(50);se50
R output:
se20<-sd(sam20)/sqrt(20);se20
[1] 0.3716666
> se50<-sd(sam50)/sqrt(50);se50
[1] 0.2653752
??Compare the Standard Error (SE) of the sampling distributivos. Which sample size creates better estimates of the population mean (ie. has the lowest SE). Solve using R.
Standard Error (SE) of the sampling distribution with n=20 is 0.3717
Standard Error (SE) of the sampling distribution with n=50 is 0.2654
The sample with size 50 creates better estimates of the population mean (ie. has the lowest SE).