5. Sampling uncertainty. The function rnorm(n,mean,sd) generates n draws from
a normal distribution. Draw 10 and then 1000 observations from a normal distribution with mean 5 and standard
deviation 20. Compute the mean in each case.
# Draw 10 observations from a normal distribution.
draws_10 <- ___(10, ___, ___)
# Draw 1000 observations from a normal distribution.
draws_1000 <- ___
# Print mean of draws_10.
print(___(draws_10))
# Print mean of draws_1000.
___
# Draw 10 observations from a normal distribution.
draws_10 <- rnorm(10, 5, 20)
# Draw 1000 observations from a normal distribution.
draws_1000 <- rnorm(1000, 5, 20)
# Print mean of draws_10.
print(mean(draws_10))
# Print mean of draws_1000.
print(mean(draws_1000))
test_error()
test_object("draws_10", incorrect_msg="Did you enter the correct arguments to `rnorm()`?")
test_object("draws_1000", incorrect_msg="Did you enter the correct arguments to `rnorm()`?")
test_function("mean", incorrect_msg="Did you use the function `mean()`?")
success_msg("Well done! What happens to the mean as you increase the number of observations?")