assess_coverage <- function(n, nsim, beta0, beta1, noise_dist){
results <- rep(NA, nsim)
for(i in 1:nsim){
x <- runif(n, min=0, max=1)
noise <- noise_dist(n)
y <- beta0 + beta1*x + noise
lm_mod <- lm(y ~ x)
ci <- confint(lm_mod, "x", level = 0.95)
results[i] <- ci[1] < beta1 & ci[2] > beta1
}
return(mean(results))
}