# set seed for reproducibility
set.seed(3)
# set number of sampling iterations
N <-
# initialize `beta_hats`
beta_hats <-
# conduct the simulation using `for()`
for(i in 1:N) {
}
# compare the mean of estimates to the true parameter
# set seed for reproducibility
set.seed(3)
# set number of sampling iterations
N <- 1000
# initialize vector `beta_hats`
beta_hats <- c()
# loop estimation
for (i in 1:N) {
# simulate the dataset
X <- runif(100, -5, 5)
Y <- X^2 + rnorm(100)
# estimate the linear regression function
ms_mod <- lm(Y ~ X)
# save the estimate
beta_hats[i] <- ms_mod$coefficients[1]
}
# compare mean of estimates and the true parameter
mean(beta_hats) == 0
test_object("beta_hats")
test_student_typed("==")