Question: This exercise relates to the College data set, which can be found in the file College.csv (http://www-bcf.usc.edu/~gareth/ISL/data.html). It contains a number of variables for 777

This exercise relates to the College data set, which can be found in the file College.csv (http://www-bcf.usc.edu/~gareth/ISL/data.html). It contains a number of variables for 777 different universities and colleges in the US. Before reading the data into R, it can be viewed in Excel or a text editor.

Problem 3 (linear regression using simulated data ):

Perform the following commands in R: > set.seed(10) > x1=runif(200) > x2=0.5*x1+rnorm(200)/10

> y=2+2*x1+0.3*x2+rnorm(200) The last line corresponds to creating a linear model in which y is a function of x1 and x2.

a) Write out the form of the linear model. What are the regression coefficients?

b) What is the correlation between x1 and x2? Create a scatterplot displaying the

relationship between the variables.

c) Using this data, fit a least squares regression to predict y using x1 and x2. Describe the

results obtained. What are " , " , and " ? How do these relate to the true , , and#$% 01

2? Can you reject the null hypothesis H0 : 1 = 0? How about the null hypothesis H0 : 2 = 0?

d) Now fit a least squares regression to predict y using only x1. Comment on your results. Can you reject the null hypothesis H0: 1 = 0?

e) Now fit a least squares regression to predict y using only x2. Comment on your results. Can you reject the null hypothesis H0: 1 = 0?

f) Do the results obtained in (c)(e) contradict each other? Explain your answer.

To save a graphic as a pdf file:

>pdf(file.pdf) >dev.off() 

Instead of pdf you may use jpeg or png.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!