Learn R Programming

PhylogeneticEM (version 1.8.0)

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 occurring 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
)

Value

E0.gauss the intercept (value at the root)

shifts.gauss the list of shifts found on the branches

Arguments

Yp

(transformed) data

Xp

(transformed) matrix of regression

K

number of non-zero components allowed

Details

lambda is chosen so that delta has the right number of non zero components. If not possible, either temporarily raise the number of shifts and then select only the shifts with the highest modulus, or if not possible, throw an error.