R代写-STAT8178-Assignment 2
时间:2021-05-05
Assignment 2
STAT8178: Modern Computational Statistical Methods
Session 1, 2021 Due May 16 2021, via iLearn, by 9:00 p.m.
General instructions
For each of the questions below, you are expected to document your answer fully. Try to work within scripts
or functions, rather than issuing commands at the command line, or manually manipulating spreadsheets, so
as to leave a repeatable record of what you’ve done. If you do decide to manipulate data manually, please
fully describe what you’ve done in your assignment submission, and submit any files (such as manipulated
spreadsheets) that may clarify your work.
Where you are required to write code, please state and interpret the output, as well as submitting the code
itself.
You may freely quote and modify any code written by the lecturers. Also, remember that you can use search
engines to search for facts or examples. Examples of things you might want to search for include:
• the density function of a specific distribution,
• methods for simulating (generating) random variates from specific distributions,
• how to use specific commands or functions in Matlab or R.
Your submission should include multiple files of computer code, as well as a PDF document containing:
• answers to any short-answer questions,
• the input arguments you used, if any, when calling your code,
• the output of your code (including relevant numerical and graphical output, but if your code outputs
excessive computational details, please omit them),
• any required interpretation of the output.
Question 1: Density Function Estimation (10 marks)
Assume that the random variable X has the probability density function shown below, with α = 0.3:
gα(x) =
{
αg1(x) + (1− α)g2(x) for x ≥ 0
0 otherwise
(1)
Let g1(x) be the density function of the Exponential distribution Exp(λ = 0.5) where λ is the mean of the
distribution, and g2(x) be the density function of the Beta distribution Beta(5, 2).
(a) Generate 500 random observations from g0.3(x) and plot g0.3(x).
(b) Use the sample generated in part (a) and plot the histogram estimator, fˆHist(x).
(c) Plot the MSE of the above Histogram estimator using Monte Carlo simulation.
(d) Calculate MISE for the above Histogram estimator using Monte Carlo simulation when the sample
sizes are n = 50, 100, 250 and 500. Comments on the results.
Question 2: Monte Carlo hypothesis testing (10 marks)
The data available in either of the files lawlsat.mat or lawlsat.csv contain the average scores on the LSAT
(a standardised test) for the 1973 freshman class at 82 US law schools. We are interested in using these data
to test H0 : µ = 600 against H1 : µ < 600.
(a) Use a normal probability plot to check whether the distribution of the average scores on the LSAT is
Normal.
(b) Perform the above hypothesis test using Monte Carlo simulation to get the critical values. You can
assume the normal distribution with σ = 40 in the pseudo-population. Use the significance level α =
0.05. Estimate the p-value. Do you reject H0 or H1?
Question 3: Bootstrapping Method (10 marks)
The data available in either of the files quakes.mat or quakes.csv give the time in days between successive
earthquakes. Find the confidence intervals below for the average time between earthquakes. Compare the
results. Use the significance level α = 0.05.
(a) The standard interval
1
(b) Bootstrap-t interval
(c) Bootstrap percentile interval.





















































学霸联盟


essay、essay代写