lasso_regression_K_fixed.glmnet_multivariate: Do a lasso regression with the number of non-zero variables...

View source: R/init_EM.R

lasso_regression_K_fixed.glmnet_multivariateR Documentation

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
)

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.

Value

E0.gauss the intercept (value at the root)

shifts.gauss the list of shifts found on the branches


PhylogeneticEM documentation built on Aug. 31, 2022, 9:16 a.m.