set.seed(1)
<- runif(100)
x1 <- 0.5 * x1 + rnorm (100) / 10
x2 <- 2 + 2 * x1 + 0.3 * x2 + rnorm (100) y
Exercise 9: Collinearity
Collinearity
- Perform the code
Write out the form of the linear model. What are the regression coefficients?
Create a scatterplot displaying the relationship between
x1
andx2
.Fit a least squares regression to the data using
x1
andx2
. How the LSEs relate to the true \(\beta_0\), \(\beta_1\) and \(\beta_2\)? Can you reject \(H0 : \beta_1 = 0\)? How about \(H0 : \beta_2 = 0\)?Fit a least squares regression using only
x1
. Comment on your results. Can you reject \(H0 : \beta_1 = 0\)?Fit a least squares regression using only
x2
. Comment on your results. Can you reject \(H0 : \beta_2 = 0\)?Do the results obtained in (3)–(5) contradict each other? Explain your answer.