# define a function for the estimator # repeatedly compute estimates and store the results in est_biased set.seed(123) # plot a histogram of est_biased # add a red vertical line at mu = 10 # define a function for the estimator Y_tilde <- function(x){sum(x)/(length(x)-1)} # repeatedly compute estimates and store the results in est_biased set.seed(123) est_biased <- replicate(n = 10000, expr = Y_tilde(rnorm(5, 10, 5))) # plot a histogram of est_biased hist(est_biased) # add a red vertical line at mu = 10 abline(v = 10, col = "red") test_function_definition("Y_tilde", function_test = { test_expression_result("Y_tilde(1:10)") test_expression_result("Y_tilde(1:25)") test_expression_result("Y_tilde(seq(0, 1, 0.1))") }) test_object("est_biased") test_function("hist", args = "x") test_function("abline", args = c("v", "col"))