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 14:10
Amachinist needs to remove a tight fitting pin of material a from a hole in a block made of material b. the machinist heats both the pin and the block to the same high temperature and removes the pin easily. what statement relates the coefficient of thermal expansion of material a to that of material b? a) the situation is not possible, heating block b will shrink the hole in the material as the material expands with increasing temperatureb) material b has the same coefficient of expansion as does material ac) material b has a negative coefficient of expansion and a has a positive coefficient of expansiond) material a has a greater coefficient of expansion than does material be) material b has a greate
Answers: 1
question
Physics, 22.06.2019 04:30
Which of the following is not a characteristic of s waves? a. travel slower than p waves. b. cannot be detected in locations more than 105° from an earthquake’s epicenter. c. travel through solids and liquids. d. only affect coastal regions.
Answers: 2
question
Physics, 22.06.2019 12:10
Aspring has a natural length of 8 m. if a 12-n force is required to keep it stretched to a length of 10 m, how much work w is required to stretch it from 8 m to 16 m? (round your answer to two decimal places.)
Answers: 1
question
Physics, 22.06.2019 23:30
Macy always thought there were only a few hair colors blonde brown and black however when she actually began looking around she saw varying shades of these hair color what is a possible reason for so many different hair colors
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, 09.01.2022 01:20
question
Mathematics, 09.01.2022 01:20
question
Mathematics, 09.01.2022 01:20
question
Spanish, 09.01.2022 01:30
question
Mathematics, 09.01.2022 01:30
question
Mathematics, 09.01.2022 01:30
Questions on the website: 13722363