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 01:30, chandranewlon
Ablock of mass 1.5 kg slides down an inclined plane that has an angle of 15. if the inclined plane has no friction and the block starts at a height of 3 m, how much kinetic energy does the block have when it reaches the bottom? acceleration due to gravity is g = 9.8 m/s2. a. 6.8 j b. 50.9 j c. 0 j d. 44.1 j
Answers: 1
image
Physics, 22.06.2019 12:50, angelica3752
Match each vocabulary term to its definition. 1. electrons neutral subatomic particles found in the nucleus of the atom 2. neutron lowest energy position of an electron in an atom 3. photon the path of an electron around the nucleus of an atom 4. ground state negatively charged, subatomic particles 5. protons packet of energy of specific size 6. element substance with only one type of atom 7. orbital positively charged, subatomic particles found in the nucleus of the atom
Answers: 1
image
Physics, 22.06.2019 14:30, rachel2005smith
Increasing the pressure on one spot of a fluid will increase the pressure everywhere else in the fluid a. pascals principal b. archimedes' principal c. bernoulli's principal
Answers: 1
image
Physics, 23.06.2019 00:30, Dmgirl123
What is the relationship between globular clusters and the milky way?
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
History, 14.12.2021 20:30