联系我们: 手动添加方式: 微信>添加朋友>企业微信联系人>13262280223 或者 QQ: 1483266981
Problems for handing in
1. (30 marks)
This question uses a dataset on QMPlus, which is not the same as the dataset for the
previous three exercise sheets. For each student, there should be a file called “exer_xfffe_cise4 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.
Hand in: along with your answers, also include the graphs, but apart from that don’t
copy any R output. Within R, right-clicking on a graph gives the options of saving it
to disk or copying it (e.g. to paste into a Word document).
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.
Additional problems
3) Without using R, just with pen and paper, calculate the histogram estimator f
H(y) of
the probability density function (pdf) using the following data:
0.5, 4.9, 6.5, 4.4, 7.5, 6.9, 1.2, 6.7, 5.8, 4.7
Use bins (intervals) with boundaries at 0, 2, 4, 6, 8.
So you would need to fill in the in the following:
f
H(y) =
, y ≤ 0
, 0 < y ≤ 2
, 2 < y ≤ 4
, 4 < y ≤ 6
, 6 < y ≤ 8
, y > 8
Now use R to draw a histogram with these data, using 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 3), without using R, calculate the kernel density esti mate f
n,h(y) using the triangular 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 a beta distribution with parameters α = 1.3
and β = 3.0, which can be done with the command P


发表评论