system.time({
<- 500
nsim <- 100
n <- 1
beta0 <- 0.5
beta1
<- vector()
save
for (i in 1:nsim) {
<- rnorm(n)
x <- beta0 + beta1*x + rnorm(n)
y
<- lm(y ~ x)$coef[2]
coef <- c(save, coef)
save
}<- data.frame(save)
save })
user system elapsed
0.200 0.012 0.211