辅导MTH6991、辅导R课程编程

- 首页 >> Web
QUEEN MARY, UNIVERSITY OF LONDON
MTH6991/MTH791U/MTH791P
Computational Statistics with R
Exercise Sheet 4 Spring 2022
Question 1 is due to be handed in for assessment along with two questions from the previous
exercise sheet. The link for submission will be in the week 6 section on QMPlus. The deadline
is 1pm on Thursday the 3rd March. Please include an R script file with the R code used, and
a separate file with all answers asked for (you can submit more than one file).
Late submissions will receive zero marks.
1. (Problem for handing in) 50 marks
This question uses a dataset on QMPlus. There is a different dataset for each student,
which can be found via the link “Exercise 4 datasets” in the week 5 section. For each
student, there should be a file called “exercise4 XYZ.txt”, where XYZ is your ID number
(you need to be logged in to QMPlus). If you cannot see a file, please send me an email.
The dataset contains one column, called Please don't copy and paste the code, type it in yourself. You will learn it better that way.
3. Using R, draw a histogram with the data from question (2), with the same intervals,
and check that the probability density function estimate is the same as you calculated
by hand.
4. For a general kernel function K (which is by definition a pdf), if σ > 0 is the standard
deviation of this pdf, then we can define the rescaled kernel K∗ by K∗
(x) = σK(σx).
Show that K∗
is a pdf, and that it has standard deviation 1.
5. Using the same data as question 2, without using R, calculate the kernel density estimate
ˆfn,h(y) using the rectangular kernel, and with bandwidth h = 1, for the values of
y = 0, 1, 3 and 4.
6. In R, simulate a sample of size 1000 from an exponential distribution with parameter 1,
which can be done with the command Please don't copy and paste the code, type it in yourself. You will learn it better that way.
Please don't copy and paste the code, type it in yourself. You will learn it better that way.
Please don't copy and paste the code, type it in yourself. You will learn it better that way.

站长地图