t2 = 1 ## The error variance. SS = c(5,10,20,40) ## Sample sizes ## Consider these AR(1) coefficients. for (alpha in c(0,0.3,0.6,0.9)) { V = NULL for (k in 1:length(SS)) { ## The sample size. ss = SS[k] ## The AR(1) data. X = arsim(alpha, t2, nrep, ss) ## The mean of each row. Xbar = apply(X, 1, mean) ## The sampling variance of Xbar. V[k] = var(Xbar) } ## Print out the results for a single value of alpha. print(V) }