Question: Now, write a function that requires three inputs, namely,y (a T vector), X (a (T K) matrix), and lambda and then returns the Lasso
Now, write a function that requires three inputs, namely,y (a T vector), X
(a (T × K) matrix), and ’lambda‘ and then returns the Lasso estimator (a K vector) for a given penalization parameter λ. Recall that the intercept should not be penalized. Therefore, your function should indicate whether X contains a vector of ones as the first column, which should be exempt from the L1 penalty.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
