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

STAC67H3: Regression Analysis

Assignment 2

Q1.  [17 points] You are given the following dataset:

i

xi

yi

1

2

3

4

5

6

7

8

9

10

-3

-3

4

-4

0

5

-1

-2

0

3

-2

0

7

2

5

10

3

1

8

8

(a) [1 point] Write the design matrix x .

(b) [2 point] Compute xx .

(c) [2 point] Compute xx!1 .

(d) [2 point] Compute xr .

(e) [2 point] Compute T  = (βˆ0 , βˆ1 ).

(f) [2 point] Compute Var(βˆ0 ), Var(βˆ1 ) and Cov(βˆ0 , βˆ1 ).

(g) [2 point] Compute H .

(h) [2 point] Compute Var(e1 ) and Cov(e1 , e2 ).

(i) [2 point] Compute Var(yˆ1 ) and Cov(yˆ1 , yˆ2 ).

 

Q2.  [22 points] Suppose we have the following linear regression model with p predictors: Yi = β0 + β1x1,i + . . . + βpxp,i + εi     (i = 1, . . . , n)

where εi I N(0, σ2 ). In lecture 13, we partitioned the sum of squares, as follows:

n

(Yi - )2

i=1

                                               -

Total Sum of Squares (SST)

n                                                          n

(Yi - i)2

i=1                                                      i=1

                                                 -                                                              ↘                                               -

Error Sum of Squares (SSE)      Regression Sum of Squares (SSR)

(a) [3 points] Show that the SST, SSE and SSR above can be written in the matrix form as follows:

 SST = rI - Jr

❼ SSE = rT (I - H)r

❼ SSR = rH - Jr

(b) [7 points] Show that E(SSE) = (n - p - 1)σ2 .

Hint: Apply the theorem in lecture 10 p.12, as we have done for the simple linear regression.

(c) [7 points] Show that E(SSR) = pσ2 + βxH - Jxβ . Hint: Apply the theorem in lecture 10 p.12.

(d) [5 points] Show that E(SSR) in (c) can be written as:

E(SSR) = pσ 2 +

p                              p

βk(2)SSk,k +

βkβk\ SSk,k\

where SSk,k\   =

k=1

(Xk,i - k)(Xk\ ,i - k\ ).

k=1 k k\


Q3.  [20 points] Consider the following linear regression model with p predictors:

Yi = β0 + β1x1,i + . . . + βpxp,i + εi     (i = 1, . . . , n)

where εi I N(0, σ2 ).

Suppose you want to estimate the conditional mean of the response at α0(T)  = (1, x1,0 , x2,0 , . . . , xp,0). Let Y0  denote the response at α0 . Prove the following:

(a) [5 points] E(0 ) = E(Y0[x1,0 , x2,0 , . . . , xp,0).

(b) [7 points] Var(0 ) = σ 2 α0(T) xx-1 α0 .

(c) [5 points] 0  is a linear combination of Yi’s where i = 1, . . . , n.

(d) [3 points] 0 ~ N E(Y [x1,0 , x2,0 , . . . , xp,0), σ2 α0(T) xx-1 α0.

 

Q4. Case study

The dataset bp.txt” is available on Quercus, along with the documentation Description.pdf” . In Part A, you will examine the joint effect of 10 genes on the systolic blood pressure (SBP). In Part B, you will create a prediction model for the SBP.

PART A

(a) Identify the categorical variables and create the corresponding dummy variables. For the gen- der, use M” as the reference group. For all other binary variables, use N” as the reference group.

For categorical variables, use the group with value “1’ as the reference group.

(b) Excluding the genetic markers (g1 - g10), which variables should not be included together in the regression model? Explain why and how including them together will affect the inference.

(c) Fit the linear regression model with all the predictors (including the genetic markers). However, for the predictors that you identified in (b), include only one in the linear regression model (and omit the other). Present the summary of the model.

(d) Interpret βˆ0 .  Pick 4 variables that are binary, categorical, continuous and one of the genetic markers. Interpret the regression parameters for these 4 variables from your model in (c).

(e) Conduct the appropriate statistical test to detect the individual effect of each of the 10 genes at α = 0.05 and conclude in plain language. Based on your results, can you conclude that these 10 genes have a joint effect on the SBP? Why or why not?

(f) Conduct the appropriate statistical test to detect the joint effect of the 10 genes at α = 0.05 and conclude in plain language.

PART B

(a) Use the dummy variables that you created in Part A - (a).  In Part A - (b), you identified predictors with unusually high pairwise correlation.  In this part, you are building a prediction model. State how this can impact your prediction.

(b) To select the prediction model, you will use the forward selection and backward elimination strategies. Perform a 5-fold cross-validation to select and validate your model with both strategies.

(c) Based on your results in (c), which model will you choose as the nal prediction model?