{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

tut7_09

# tut7_09 - 1 The University of Western Ontario Department of...

This preview shows page 1. Sign up to view the full content.

1 The University of Western Ontario Department of Statistical and Actuarial Sciences Statistical Sciences 3859a Tutorial Assignment 7 1. In this problem, we will simulate models which demonstrate the effects of multicollinear- ity. (a) Use the runif() function to generate 30 observations on a variable x 1 and (inde- pendently), 30 observations on another variable x 2 . These will be the predictors. (b) Simulate 30 standard normal random variables in vector called epsilon . These values will be the noise. (c) Set beta0 <- 2 beta1 <- 4 beta2 <- -3 v1 <- x1 v2 <- x2 y <- beta0 + beta1*v1 + beta2*v2 + epsilon dataset <- data.frame(y, v1, v2) The object dataset will then contain 30 simulated observations for a linear model where the design is almost orthogonal. (d) Estimate β 0 , β 1 , β 2 and their standard errors as well as their variance inflation fac- tors. (You can use the vif() function in the DAAG library.) (e) Plot v2 ~ v1 . (f) For α ∈ { . 1 , . 2 , . 3 , . 4 , . 5 } , repeat (c), (d) and (e) where v1 <- (1-alpha)*x1 + alpha*x2 v2 <- (1-alpha)*x2 + alpha*x1 y <- beta0 + beta1*v1 + beta*v2 + epsilon
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Ask a homework question - tutors are online