Learn R Programming

PhylogeneticEM (version 1.0.0)

compute_gauss_lasso: Do a lm on top of a lasso regression.

Description

compute_gauss_lasso takes the variables selected by a lasso procedure, and uses them to do a simple linear least square regression. Function used is lm for non-transformed data (root = NULL), and lm.fit for transformed data (root = an integer).

Usage

compute_gauss_lasso(Ypt, Xp, delta, root, projection = which(rowSums(delta) != 0))

Arguments

Xp
(transformed) matrix of regression
delta
regression coefficients obtained with a lasso regression
root
the position of the root (intercept) in delta
Yp
(transformed) data

Value

Named list, with "E0.gauss" the intercept (value at the root); "shifts.gauss" the list of shifts found on the branches; and "residuals" the residuals of the regression

Details

Depending on the value of root, the behaviour is different. If root is null, then we fit a linear regression with an intercept. If root is equal to an integer, then the "intercept" column of the matrix Xp (that has possibly been trough a multiplication with a cholesky decomposition of the variance) is included, rather than the intercept.