Chapter 8 Multiple choice questions

Quiz Content

not completed
. Type help(Distributions). You will see details of functions for creating random numbers sampled from different distributions. Each distribution can produce random numbers by using the version of the function that starts with an r, for example rnorm for a normal distribution, and runif for a uniform distribution. Using the hist function you can produce a histogram of samples from a given distribution, e.g. hist(rnorm(1000)). Which of the following distributions has positive skew?

not completed
. Approximately what is the mean of 1000 samples from a gamma distribution with a shape parameter of 3 and a scale parameter of 2 (type help(rgamma) to find out how to specify these parameters)?

not completed
. Approximately what is the relationship between the mean and median of 1000 samples from a geometric distribution with the probability parameter set to 0.1?

not completed
. Use the quantile function to calculate the 68% confidence limits of 1000 samples from a lognormal distribution (rlnorm) with meanlog of 2 and sdlog of 0.1. These are approximately:

not completed
. Initialise a variable called i with a value of 100, and a counter variable with a value of 0. Create a while loop that repeats until i becomes negative. Each time around the loop increment the counter variable by 1. Also take a sample from a uniform distribution (with runif), multiply it by 3, and subtract it from the value of i. Approximately what is the value of the counter variable when the loop terminates?

not completed
. Repeat the analysis from question 5, but this time draw samples from a normal distribution instead of a uniform distribution. How many times does the loop repeat now, each time you run it?

not completed
. Create a loop that repeats 1000 times. Each time around the loop, generate a sample of 10 numbers from a normal distribution with a mean of 5 and a standard deviation of 2. Then create another sample of 10 numbers from a normal distribution with a mean of 2 and a standard deviation of 2. Perform a t-test on these two vectors of numbers and count how many of the t-tests come out significant. As a proportion of the total number of simulations, this is approximately:

not completed
. Which of the following changes decreases the proportion of significant tests in the simulation described in question 7 by the greatest amount?

not completed
. Bootstrap the mean of the following vector of numbers 10000 times and calculate the 95% confidence intervals
a <- c(10,12,5,19,8,11,17,21,12,17)
The lower and upper confidence intervals are:

not completed
. Bootstrap (10000 times) the median of 100 samples from a gamma distribution, with shape parameter 2. The 95% confidence intervals are separated by approximately:

Back to top