Beruflich Dokumente
Kultur Dokumente
2014-15 Term 2
Assignment #2
Due: February 25th, 2015 (Wednesday) at 5:00pm
This assignment covers material from Chapter 2 and 3 of the lecture notes.
** Please submit the hardcopy of the R-code and R-outputs for Problem 2 and Problem 4.
You need to show your calculation in details order to obtain full scores.
Problem 1: Consider the multiple linear regression:
Y X
n1
n( p 1) ( p 1)1
'Y
) E (e ' e )
(b) Prove or disprove the following: E (Y' Y) E ( Y
Problem 2: Consider the dataset htwt.txt from the alr3 library. Suppose that we want to fit a
simple linear regression with Wt as the response and Ht as the predictor.
(a) Draw a scatterplot of the data using the plot function in R.
(b) Obtain the least squares estimates 0 , 1 and using the lm and summary functions.
2
Page 1/2
Problem 3: Consider a multiple linear regression with n=3 and p=0 (i.e. no predictor!):
1
y1
2
3 1 0
X 1, Y y2 , E( Y) 1, Var( Y) 1 1 0
1
y
1
0 0 1
3
(a) Compute (XX)-1 and show that (XX)-1XY simplifies into y =(y1+y2+y3)/3.
(b) Compute H = X(XX)-1X and express Y(I-H)Y in terms of y1, y2 and y3. What is the
value of E(Y(I-H)Y)?
(c) Based on the fact that E(YAY)=E[tr(YAY)]=tr[AE(YY)], compute the value of
E(Y(I-H)Y).
Problem 4: Let Y = (21, 25, 19, 24, 36, 36, 24, 10), X1 = (3, 9, 4, 3, 7, 9, 4, 1) and
X2 =(3, 9, 4, 3, 7, 9, 4, 2). Suppose we want to model the response Y by X1, X2 and the
intercept using the multiple linear regression.
(a) Based on matrix operations in R (i.e. X%*%Y, t(X), solve(X) on page 21 of Chapter 3),
show that = (16.5784, 10.1144, -8.3464), and compute the following quantities:
2 ,
ar ( ) and
V
R2
Page 2/2