Question: Write a function that requires three inputs, namely, y (a T vector), X (a (T K) matrix), and lambda and then returns the Ridge
Write a function that requires three inputs, namely, y (a T vector), X (a
(T × K) matrix), and lambda and then returns the Ridge 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 L2 penalty.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
