lasso_regression_K_fixed.glmnet_multivariate: Do a lasso regression with the number of non-zero variables fixed.
Description
lasso_regression_K_fixed
does the following regression :
||Yp-Xp.delta|| + lambda |delta|_1 using the function glmnet::glmnet
of
package glmnet
, where delta is a vector representing the shifts
occuring on the branches. It does a gauss lasso regression using function
lm
on top of it. This function is used in functions
init.EM.lasso
, segmentation.OU.specialCase.lasso
, ...
Usage
lasso_regression_K_fixed.glmnet_multivariate(Yp, Xp, K, root = NULL, penscale = rep(1, ncol(Xp)), K_lag = 0)
Arguments
Xp
(transformed) matrix of regression
K
number of non-zero components allowed
Value
E0.gauss the intercept (value at the root)shifts.gauss the list of shifts found on the branches
Details
lambda is choosen so that delta has the right number of non zero components.
If not possible, either temporaly raise the number of shifts and then select
only the shifts with the highest modulus, or if not possible, throw an error.