subject
Physics, 26.01.2021 01:40 gabrielduboy

Load the lars package and the New York Housing dataset (as in the attached file for download). Next, load the glmnet package that will be used to implement LASSO.
Save the MEDV as y and only use the first 12 variables (i. e., columns in New York Housing dataset) as x. While x is a set of independent variables, y is the dependent variable which is a quantitative measure of the median housing values. (Hints: can assign matrix format to the variable x).
Generate separate scatterplots with the line of best fit for all the predictors in x with y on the vertical axis.
Regress y on the predictors in x using OLS (Ordinary Least Square Regression). We will use this result as benchmark for comparison.
Use the glmnet function to plot the path of each of x's variable coefficients against the L1 norm of the beta vector. This graph indicates at which stage each coefficient shrinks to zero.
Use the cv. glmnet function to get the cross validation curve and the value of lambda that minimizes the mean cross validation error.
Using the minimum value of lambda from the previous exercise, get the estimated beta matrix.
To get a more parsimonious model we can use a higher value of lambda that is within one standard error of the minimum.
Use this value of lambda to get the beta coefficients. Note that more coefficients are now shrunk to zero.
Please refer to Example 6.1 and 6.2 of Chapter 6 in our textbook for details regarding how LASSO works so you know how to explain your results in this assignment.

ansver
Answers: 2

Other questions on the subject: Physics

image
Physics, 22.06.2019 10:00, kanonhuffmanp3rnmy
The frequencies refer to the sample data collected from a population of interest when performing a hypothesis test comparing two or more population proportions.
Answers: 2
image
Physics, 23.06.2019 01:00, ptrlvn01
The smallest particle of an element that retains its identity in a chemical reaction. true or false
Answers: 1
image
Physics, 23.06.2019 02:00, Rosemckinney2351
Determine the time it takes for a satellite to orbit the earth in a circular "near-earth" orbit. the definition of "near-earth" orbit is one which is at a height above the surface of the earth which is small compared to the radius of the earth, so that you may take the acceleration due to gravity as essentially the same as that on the surface. does your result depend on the mass of the satellite?
Answers: 3
image
Physics, 23.06.2019 04:31, dontrailgrant98
A90db sound wave strikes an eardrum whose area is 5.0×10^-5m^2. how much energy is absorbed by the eardrum per second
Answers: 1
You know the right answer?
Load the lars package and the New York Housing dataset (as in the attached file for download). Next...

Questions in other subjects:

Konu
Computers and Technology, 04.08.2019 20:30