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 eﬀects 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 inﬂation fac-tors. (You can use the vif() function in the DAAG library.) (e) Plot v2 ~ v1 . (f) For
This is the end of the preview. Sign up
access the rest of the document.