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

Homework 1

PSTAT Winter 2023

Due date: Jan 31st, 2023 at 23:59 PT

1. The dataset trees contains measurements of Girth (tree diameter) in inches, Height in feet, and  Volume of timber (in cubic feet) of a sample of 31 felled black cherry trees. The following commands can be used to read the data into R.

#  the  data  set   "trees"  is  contained  in  the  R  package   "datasets"

require(datasets)

head(trees)

##    ##  1 ##  2 ##  3 ##  4 ##  5 ##  6

Girth  Height  Volume

70

65

63

72

81

83

(a) (1pt) Briefly describe the data set trees, i.e., how many observations (rows) and how many variables (columns) are there in the data set? What are the variable names?

(b)  (2pts) Use the pairs function to construct a scatter plot matrix of the logarithms of Girth, Height and

Volume.

(c) (2pts) Use the cor function to determine the correlation matrix for the three (logged) variables. (d) (2pts) Are there missing values?

(e) (2pts) Use the lm function in R to fit the multiple regression model:

log(Volumei ) = β0 + β1 log(Girthi ) + β2 log(Heighti ) + ϵi

and print out the summary of the model fit.

(f) (3pts) Create the design matrix (i.e., the matrix of predictor variables), X , for the model in (e), and

fo(ve)βˆ(t)s)

(g) (3pts) Compute the predicted response values from the fitted regression model, the residuals, and an estimate of the error variance Var (ϵ) = σ 2 .

2.  Consider the simple linear regression model:

yi  = β0 + β1 xi + ϵi

Part 1:  β0  = 0

(a) (3pts) Assume β0  = 0. What is the interpretation of this assumption? What is the implication on the

regression line?  What does the regression line plot look like?

(b)  (4pts) Derive the LS estimate of β 1  when β0  = 0.

(c) (3pts) How can we introduce this assumption within the lm function?

Part 2:  β 1  = 0

(d) (3pts) For the same model, assume β 1  = 0. What is the interpretation of this assumption? What is the

implication on the regression line?  What does the regression line plot look like?

(e)  (4pts)Derive the LS estimate of β0  when β 1  = 0.

(f) (3pts)How can we introduce this assumption within the lm function?

3.  Consider the simple linear regression model:

yi  = β0 + β1 xi + ϵi

(a) (10pts) Use the LS estimation general result βˆ = (XT X ) 1 XT y to find the explicit estimates for β0 (b)  βˆ0  and βˆ1  are unbiased estimates for β0  and β 1  respectively.