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, 22.06.2019 01:10
The x-coordinate of a particle in curvilinear motion is given by x = 3.1t3 - 4.9t where x is in feet and t is in seconds. the y-component of acceleration in feet per second squared is given by ay = 2.3t. if the particle has y-components y = 0 and vy = 5.0 ft/sec when t = 0, find the magnitudes of the velocity v and acceleration a when t = 1.8 sec. sketch the path for the first 1.8 seconds of motion, and show the velocity and acceleration vectors for t = 1.8 sec. answers: v = ft/sec a = ft/sec2
Answers: 2
question
Physics, 22.06.2019 02:30
The human body stores chemical energy from digested food. some of the chemical energy is converted into mechanical energy when the body moves. which statement best supported by this information
Answers: 3
question
Physics, 22.06.2019 10:00
Abookcase has a mass of 38 kg and the coefficient of friction between it and the floor is 0.82 what is the maximum force of friction between the bookcase and the floor a 372n b 305n c 412n d 449n
Answers: 1
question
Physics, 22.06.2019 11:30
Arocket starts from rest and moves upward from the surface of the earth. for the first 10.0 s of its motion, the vertical acceleration of the rocket is given by ay = 12.80 m/s32t, where the +y-direction is upward. (a) what is the height of the rocket above the surface of the earth at t = 10.0 s? b) what is the speed of the rocket when it is 325 m above the surface of the earth?
Answers: 3
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, 21.09.2021 16:50
question
Computers and Technology, 21.09.2021 16:50
question
Mathematics, 21.09.2021 16:50
question
Mathematics, 21.09.2021 16:50
question
Mathematics, 21.09.2021 16:50
Questions on the website: 13722361