1. Repeatedly (104 times) simulate the standardised sum of independent and identically distributed variates X1, . . . ,Xn
and provide histogram plots, with the (suitably renormalised) standard normal density curve superimposed, for
(a) X1 ~ Exp(1) and n = 2, 6, 1000.
(b) X1 ~ Ber(3=4) and n = 5, 20, 100.
Supply your code.
2. Repeat the simulation in Q1a with n = 1000, and independently simulate an equal number of outcomes from the standard normal distribution using the Box- Muller method. Plot the empirical quantiles against eachother, together with the line y = x, and comment on the plausibility that the samples come from the same distribution. Supply your code.
3. Simulate 106 outcomes (X, Y ), where
with Θ ~ [0, 2Π), and R = 5 + S with S ~ Exp(1) independently of Θ. Provide a scatter plot of typical output, and give the (empirical) correlation. Comment on the correlation and dependence of (X, Y ). Supply your code.
4. Simulate 200 coin-flip experiments with success parameter p = 1=4, and compute the average number of successes p, together with an approximate 95% conβdence interval
where zq is the q-th quantile of a standard normal variate. Repeat the experiment 104 times, and plot the approximate conβdence intervals for each experiment, together with a line showing the true success parameter. Calculate the proportion of the 104 repeated experiments that contain the true success parameter, and comment. Supply your code.
5. Simulate N = 103 outcomes from the model
Y = -2 + X + ε
where X ~ U[0, 1] and ε ~ N(0, 0.12 ) independently. From your simulated outcomes of (X, Y ), βt a linear regression model to increasing numbers of outcomes (from N = 2 to N = 104 ) as
y = β0 + β1x
by using the solution to the normal equations to obtain estimates for , via solving where
Plot your estimates for β0 and β1 as N increases, together with a line indicating their true values. Supply your code.
6. Simulate N = 104 outcomes from the model
where X ~ U[0, 1] and ε ~ N(0, 0.1 ) independently. From your simulated outcomes of (X, Y ).
(a) Fit a linear regression model as in Q5, and plot your estimates for β0 and β1 as N increases, together with a line indicating their true values. Supply your code.
(b) Fit a quadratic regression model y = β0 + β1x+ β2x2, and plot your estimates for β0, β1, and β2 as N increases, together with a line indicating their true values. Supply your code.