STATS 330 Statistical Modelling
Assignment 4 (2020; Semester 1)

1. [25分]女子的BMI在上一个作业中，将二次曲线拟合到

（a）将数据读入数据帧。按年龄排序是个好主意。拟合线性模型

（b）使用参数自举获得θ的大约95％置信区间。使用σb

（c）使用非参数自举获得θ的大约95％置信区间。

（d）安装msm软件包并应用delta方法。然后将您的答案与

（e）数据是1990年代中期进行的前瞻性观察研究的一部分。这项研究有10,500多名参与者，其中约28％为女性，可以视为一项近似研究

2. [5分]疏Using使用LifeCycleSavings联机帮助文件中的名为fm1的模型

•您的表只能包含包含变量ddpi的模型。也就是说，没有

•使用BIC而不是AIC来衡量良好的模型。

3. [20 marks] Using smooth.spline() Consider the following R code to generate data coming
from a quadratic trend and smoothing it.
(a) Substitute the last 3 digits of your student ID number into set.seed() below and run the
code and obtain a plot. Comment. [3 marks]
# Generate the ‘original’ data set.
set.seed(123) # Substitute the last 3 digits of your student ID number!!
n <- 100
X <- scale(3 * (1:n)/n, scale = FALSE)
myfun <- function(x)
2 – x + 3*x*x
Y <- myfun(X) + rnorm(n)
plot(X, Y, col = “blue”)
fit <- smooth.spline(X, Y, df = 3 , all = TRUE)
lines(fit, lty = 1, col = “darkgreen”, lwd = 2)
(b) Add smooth curves corresponding to df = 2 and df = 20 to your plot. Comment. [2 marks]
(c) For a wide range of values of df from 2 to n plot the mean residual sum of squares
n
−1 Pn
i=1(yi − ybi)
2 versus df (or some more suitable function of df). You should smooth Y
versus X. Comment. [5 marks]
(d) Add to your (c) plot the mean residual sum of squares corresponding from new (test) data
generated from the model. Your plot should look a bit like the figure on Slide 32 in Handout 15. Comment. [5 marks]
(e) Let smooth.spline() determine the ‘best’ smoothing parameter—use the default which is
GCV, but set all = TRUE. What value of df does that correspond to? Plot the scatter plot
with the smoother going through it. Comment. [3 marks]
(f) Comment on this whole question—why is relevant to statistical modelling? [2 marks]

EasyDue™ 支持PayPal, AliPay, WechatPay, Taobao等各种付款方式!

E-mail: easydue@outlook.com  微信:easydue

EasyDue™是一个服务全球中国留学生的专业代写公司