Skip to main content
United States
Jump To
Support
Register or Log In
Support
Register or Log In
Instructors
Browse Products
Getting Started
Students
Browse Products
Getting Started
Return to Research Methods Using R 1e Student Resources
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?
rexp
(the exponential distribution)
correct
incorrect
rcauchy
(the cauchy distribution)
correct
incorrect
runif
(the uniform distribution)
correct
incorrect
rnorm
(the normal distribution)
correct
incorrect
*
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)?
2
correct
incorrect
3
correct
incorrect
5
correct
incorrect
6
correct
incorrect
*
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?
They are the same
correct
incorrect
The mean is about 3 units greater than the median
correct
incorrect
The median is about 3 units greater than the mean
correct
incorrect
It is impossible to calculate a median for this distribution
correct
incorrect
*
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:
2.4 and 3.9
correct
incorrect
6.7 and 8.1
correct
incorrect
6.1 and 8.9
correct
incorrect
7.1 and 7.8
correct
incorrect
*
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?
0
correct
incorrect
10
correct
incorrect
60
correct
incorrect
300
correct
incorrect
*
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?
Fewer times than before
correct
incorrect
About the same number of times as before
correct
incorrect
Slightly more times than before
correct
incorrect
Many more times than before
correct
incorrect
*
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:
0.1
correct
incorrect
0.3
correct
incorrect
0.7
correct
incorrect
0.9
correct
incorrect
*
not completed
.
Which of the following changes decreases the proportion of significant tests in the simulation described in question 7 by the greatest amount?
Changing the means to 10 and 8
correct
incorrect
Increasing both standard deviations to 3
correct
incorrect
Using uniform distributions with minima of 0 and maxima of 5 and 2
correct
incorrect
Using lognormal distributions (
rlnorm
) with the same mean and SD
correct
incorrect
*
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:
10.2 and 16.2
correct
incorrect
9.1 and 17.8
correct
incorrect
12.5 and 14.4
correct
incorrect
8.8 and 13.9
correct
incorrect
*
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:
0.5 – 1
correct
incorrect
1 – 1.5
correct
incorrect
1.5 – 2
correct
incorrect
>2
correct
incorrect
Exit Quiz
Next Question
Review all Questions
Submit Quiz
Reset
Are you sure?
You have some unanswered questions. Do you really want to submit?
Back to top
Printed from , all rights reserved. © Oxford University Press, 2024
Select your Country