Question: set.seed(1) (a) Using the rnorm() function, create a vector, x, containing 100 observations drawn from a N(0,1) distribution. This represents a feature, X (b)Using the

set.seed(1)

(a) Using the rnorm() function, create a vector, x, containing 100 observations drawn from a N(0,1) distribution. This represents a feature, X

(b)Using the rnorm() function, create a vector, eps, containing 100 observations drawn from a N(0,0.25) distributiona normal distribution with mean zero and variance 0.25.

(c)Using x and eps, generate a vector y according to the model

Y =1+0.5X+.

(d) Fit a least squares linear model to predict y using x

(e) Now fit a polynomial regression model that predicts y using x and x2.

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 Mathematics Questions!