Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Term Three 2020

MATH2931

Higher Linear Models

Upload Separate/New File(s) clearly marked Q1

1.   [20 marks](Analysis of Linear Models)

Let X = [X1 , X2] e Rnxp be a feature matrix decomposed into two sub-blocks, and r e Rn  be a vector of responses for n > p.

i)   [13 marks]

a)   [4 marks]   Show that In  - X1 X1(+)  and XX+  - X1 X1(+)  are idempo- tent/projection matrices.

b)   [2 marks]  What do we know about the diagonal elements of pro- jection matrices?

c)   [4 marks]   Using the results of part a), prove the ANOVA decom- position:

|r - r (1) |2  = |r - |2 + |  - r (1) |2 ,

predictors, and  = XX+ r is the tted value using all of the model

d)   [3  marks]   Suppose we compute the coefficients of determination R 1(2)  and R2  for the models with training sets  (X1 , r ) and  (X, r ), respectively.

Explain which coefficient of determination is expected to be higher/larger and why. Use the result of part c) to justify your answer.

ii)   [7 marks]  Suppose that r follows the linear model: r = β0 1 + X夕 +∈ , where E¹ [∈] = 0, Var¹ (∈) = σ2 In , and X excludes the constant feature.

a)   [2  marks]   Find the pseudo-inverse of the matrix consisting of a column of ones, that is, find 1+ .

b)   [3 marks]  Let  = r - 1 be the centered version of r (so the

βˆ0  = argmin |r - (β0 1 + Xb)|2 ,

where b e Rp is a fixed/given vector. Hence, deduce that the ordinary least squares estimate  of 夕 is given by

 = argmin | - |2 .

 

i  =       Yi .

Upload Separate/New File(s) clearly marked Q2

2.   [20 marks](Gaussian Linear Model and Categorical Predictors) Sup- pose we are given the full-rank Gaussian linear model r = X夕 + ∈, where ∈ ~ X(0, σ2 In ) and X e Rnxp .

i)   [15 marks]

a)   [2 marks] Write down the likelihood function for the Gaussian linear model.

b)   [2 marks]  Do the ordinary-least-squares and MLE estimates for 夕 coincide? Why (not)?

c)   [2 marks]  Is the ordinary-least-squares estimator unbiased? Justify your answer?

d)   [2 marks]  What makes the ordinary-least-squares the Best Linear Unbiased Estimator”? Justify your answer with an inequality.

e)   [2 marks]  Derive the MLE estimate for σ 2 .

f)   [2 marks]  Give a formula for an unbiased estimator of σ 2 ?

g)   [3 marks]   Are the MLE estimators 2  and  statistically depen- dent? Why (not)? Justify your answer.

ii)   [5 marks]

Consider the factorial experiment in which we investigate the relationship between the distance traveled by a paper aeroplane (the response r) and the categorical predictors:

weight:  two different sheets of paper were considered, giving a weight of either 80 grams, or 50 grams;

design:  two designs were considered sophisticated design and simple design;

angle:  the aeroplane was released at two different angles  horizontal and 45 degrees.

For each of the 8 distinct combination of levels of the three factors, we have two observations of the response for a total of n = 16 observations. We wish to use the linear model for the data r = X夕 + ∈, where X encodes the three categorical predictors.

Write down the entries of the feature matrix X, where, just like in the lecture notes, we encode the categorical predictors using the indicator features I(uij  = k}, with j being the factor, k being the level of the j-th factor, and i = 1, . . . , n.

Upload Separate/New File(s) clearly marked Q3

3.   [20 marks](Cross-Validatory Methods)

Suppose we are given the full-rank Gaussian linear model r = X夕 + ∈, where ∈  ~ X(0, σ2 In ) and X  e  Rnxp .   Denote P  =  XX+   and let 2   =  |r - Pr |2 /(n - p) be the usual unbiased estimator of σ 2 .

i)   [6  marks]   A criterion to detect  outliers” called  Cook’s  distance  is

defined as:

|  - (i)|2

where

Pii (Yi - i )2

p2 (1 - Pii ) .

Explain why this formula is useful?

b)   [4 marks]   Prove the formula.  You may use any of the formulas derived in the lecture notes.

ii)   [4 marks]  Two other quantities used for outlier detection are the inter- nally studentized residual:

Tiint  =

and the externally studentized residual:

Yi - i      

T =

where 2-i  = |r(i) - (i)|2 /(n - p - 1).

bλ  = (XX + λIp )-1 XT r ,

where λ is the regularization parameter.

a)   [2 marks]   Using the properties of pseudo-inverses, show that the ridge coefficient is the solution to the least squares problem:

bλ  = argО(m)in  0(r)- ^  Ip  2 .

b)   [8  marks]   Recall that one way to select λ is by minimizing the

GCV:

1   n      (yi - αi(T)bλ )2    

GCV(λ) =

where Pλ  = X(XX + λIp )-1 XT . Let the SVD of X be

p

X = USVT  =       si ui ● i(T) ,        ui  e Rn , ●i  e Rp .

i=1

3 marks:  Using the SVD, prove that

tr(Pλ ) =

3 marks:  Using the SVD, find a formula for GCV(λ) as a function of λ, the vectors r , α = UT r , the singular values (si }, and U.

2 marks:  Explain how the formula you derived above is useful in solving the optimization:

 = argmin GCV(λ).

λ

Justify your answer as much as possible.

Upload Separate/New File(s) clearly marked Q4

4.   [20 marks](Implementing Gaussian Linear Model)

To answer this question, you must write your own code in either Matlab/R/Python and submit it online together with any hand-written answers. The submitted     code will be assessed and must reproduce the results in your answer.

The submitted code must be your own implementation, otherwise marks may be deducted.   For example,  the code will not be deemed to be your own implementation if your submission is the same as somebody else’s, or if your submission uses high-level functions or packages/software such as glm in R. You must compute everything from rst principles (using in-built linear equation solvers and other basic matrix capabilities is acceptable).

Find the file cars .csv on Moodle, which contains n = 93 responses r (MPG, which stands for miles per gallon” of fuel) and the associated 8 predictors:

Weight (kg)  the weight of the car in kilograms;

Model, 1970, 1976, 1982  a categorical predictor for three model (1970, 1976, 1982) encoded with two binary variables in columns (Model 1976, Model 1970) with the baseline being Model 1982. In other words, (Model 1976, Model 1970)= (0, 0) indicates a 1982 model, (1, 0) indicates a 1976 model, and (0, 1) indicates a 1970 model.

Horsepower  engine’s power;

Acceleration  number of seconds needed to reach speeds of 100 km/h; Displacement  engine’s displacement;

Cylinders, 4,6,8  a categorical predictor for 3 cases  (4,  6,  and 8 cylin- ders) encoded with the binary variables in columns (6 cylinders, 4 cylin- ders) with the baseline being 8 cylinders. In other words, (6 cylinders, 4 cylinders)= (0, 0) indicates 8 cylinders, (1, 0) indicates 6 cylinders, and (0, 1) indicates 4 cylinders.

We are interested in explaining MPG in terms of the predictors (stored in X) using the Gaussian linear model r = X夕 + e, where ∈ ~ X(0, σ2 In ).

i)   [4 marks]  Compute and report the ordinary least squares estimate for 夕 and an unbiased estimate for σ 2 .

ii)   [4 marks]   For each predictor, compute and report the t-statistic and its p-value  (each useful for testing the hypothesis H0   : βi   = 0 versus Ha  : βi   0).

iii)   [2 marks] Compute and report the F-statistic and p-value for testing the significance of the regression model (against the constant feature model).

iv)   [4 marks]  Compute and report the p-values in an ANOVA table which adds the predictors in the order:  Weight,  (Model  1976, Model  1970), Horsepower, Acceleration, Displacement, (6 cylinders, 4 cylinders).

v)   [6 marks]  Comment on which predictors appear to be relevant for ex- plaining the response.  Then, after tting a model with the important predictors only, provide a qq-plot of the residuals and comment.