I have to create m=1450 samples of size n where n{100,200,300...5000} of an X population with normal distribution of mean 9,22 and variance=1.62^2. For each sample i need to create confidence intervals for the mean with the assumption that variance is unknown (significance level=0.98). Then for each n i have to calculate the mean of amplitude of the confidence intervals.
For the first part (create m samples of size n) i tried the following, without success:
sizes <- seq(100,5000,by=100)
m<-1450
normal=for (i in sizes){
replicate(1450, rnorm(i,9.22,sqrt(1.62^2), simplify=FALSE)
}
For the confidence intervals can I use something like the following?:
get.conf.int = function(x) t.test(x, conf.level = 0.98)$conf.int
conf.int = apply(normal, 2, get.conf.int)