theta <- 3
y <- rnorm(100,theta,2)
thetahat <- mean(y)
B <- 1000
thetahatB <- rep(0,B)
for (i in 1:B)
{
indi <- sample(1:100,100,replace = TRUE)
yB <- y[indi]
thetahatB[i] <- mean(yB)
}
var(thetahatB)
theta <- 3
y <- rnorm(100,theta,2)
thetahat <- mean(y)
B <- 1000
thetahatB <- rep(0,B)
for (i in 1:B)
{
indi <- sample(1:100,100,replace = TRUE)
yB <- y[indi]
thetahatB[i] <- mean(yB)
}
var(thetahatB)