View source: R/aesPC_calculate_LARS.R
lars.lsa | R Documentation |
These are all variants of LASSO, and provide the entire sequence of coefficients and fits, starting from zero to the least squares fit.
lars.lsa(
Sigma0,
b0,
n,
type = c("lar", "lasso"),
max.steps = NULL,
eps = .Machine$double.eps,
adaptive = TRUE,
para = NULL
)
Sigma0 |
A Grammian / covariance matrix of pathway predictors. |
b0 |
An eigenvector of |
n |
The sample size. |
type |
Option between |
max.steps |
How many steps should the LAR or LASSO algorithms take? Defaults to 8 times the pathway dimension. |
eps |
What should we consider to be numerically 0? Defaults to the
machine's default error limit for doubles ( |
adaptive |
Ignore. |
para |
Ignore. |
LARS is described in detail in Efron, Hastie, Johnstone and
Tibshirani (2002). With the "lasso"
option, it computes the complete
LASSO solution simultaneously for all values of the shrinkage
parameter in the same computational cost as a least squares fit. This
function is adapted from the lars
function in the
lars
package to apply to covariance or Grammian pathway design
matrices.
An object of class "lars"
.
https://web.stanford.edu/~hastie/Papers/LARS/LeastAngle_2002.pdf
# DO NOT CALL THIS FUNCTION DIRECTLY.
# Use AESPCA_pVals() instead
## Not run:
X_mat <- as.matrix(colonSurv_df[, 5:50])
X_mat <- scale(X_mat)
XtX <- t(X_mat) %*% X_mat
A_mat <- svd(XtX)$v
lars.lsa(
Sigma0 = XtX,
b0 = A_mat[, 1] * sign(A_mat[1, 1]),
n = ncol(X_mat)
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.