Professional Documents
Culture Documents
2018 Ex1
2018 Ex1
2018 Ex1
Richard Wilkinson
5 March 2018
Question 1
Z 4
x2 sin(x2 ) + cos(ex ) dx.
Let I=
1
• Estimate the integral via Monte Carlo, using N = 1000 Monte Carlo samples. Give a 95% confidence
interval for your estimate.
• By varying the number of Monte Carlo samples you use, investigate and then describe how the root
mean square error of your estimator scales with N .
• How large would N need to be to make the 95% confidence interval no wider than 10−2 ?
Question 2
Consider the sleep data in R. It contains information on 10 patients who underwent a trial to test two
soporific (sleep-inducing) drugs. On the first occasion they all took drug 1, which is labelled as group=1 in
the dataset. On the second occasion they took drug 2 (group=2 in the dataset). The amount of extra sleep
(in hours) was recorded for each drug.
1. Conduct a one-sample t-test to test whether the change in sleep was different from 0 for the drug 1
(group=1) data.
2. Repeat this test using Fisher’s one-sample randomisation test.
3. Conduct a two-sample t-test to test whether the sleep changed significantly when the patients took
drug 2 (group 2) rather than drug 1 (group 1 data).
4. Repeat this test using Fisher’s two-sample randomisation test.
Compare the results from each method, and describe the suitability of the method in each case.