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

Another question on Physics

question
Physics, 21.06.2019 17:20
Write maxwell's equations and discuss the terms involved and the results of each equation in classical electrodynamics. if it is possible to write these equations in integral form, give the integral forms. find the wave equation for electromagnetic waves from the maxwell equations. what is the propagation velocity of electromagnetic waves in space according to the wave equation you find?
Answers: 3
question
Physics, 22.06.2019 11:30
Which of these questions might a character ask if the conflict is man versus self? a. which path should i take to better myself? b. which boulder will be too heavy for me to carry? c. which friend is going to ditch me today? d. all of the above
Answers: 1
question
Physics, 22.06.2019 17:30
Atruck driver is attempting to deliver some furniture. first, he travels 8 km east, and then he turns around and travels 3 km west. finally, he turns again and travels 13 km to his destination. what is the drivers distance
Answers: 1
question
Physics, 22.06.2019 21:10
The junction rule describes the conservation of which quantity? note that this rule applies only to circuits that are in a steady state.
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
question
Mathematics, 20.10.2020 02:01
question
Physics, 20.10.2020 02:01
question
Health, 20.10.2020 02:01
question
History, 20.10.2020 02:01