| SPSP {SPSP} | R Documentation |
Selection by partitioning the solution paths of Lasso, Adaptive Lasso, and Ridge penalized regression.
Description
A user-friendly function to conduct the selection by Partitioning the Solution Paths (the SPSP algorithm). The
user only needs to specify the independent variables matrix, response, family, and fitfun.SP.
Usage
SPSP(
x,
y,
family = c("gaussian", "binomial"),
fitfun.SP = adalasso.glmnet,
args.fitfun.SP = list(),
standardize = TRUE,
intercept = TRUE,
...
)
Arguments
x |
A matrix with all independent variables, of dimension n by p; each row is an observation vector with p variables. |
y |
Response variable. Quantitative for |
family |
Response type. Either a character string representing one of the built-in families, or else a glm() family object. |
fitfun.SP |
A function to obtain the solution paths for the SPSP algorithm. This function takes the arguments
x, y, family as above, and additionally the standardize and intercept and others in
|
args.fitfun.SP |
A named list containing additional arguments that are passed to the fitting function;
see also argument |
standardize |
logical argument. Should conduct standardization before the estimation? Default is TRUE. |
intercept |
logical. If x is a data.frame, this argument determines if the resulting model matrix should contain a separate intercept or not. Default is TRUE. |
... |
Additional optional arguments. |
Value
An object of class "SPSP" is a list containing at least the following components:
beta_SPSP |
the estimated coefficients of SPSP selected model; |
S0 |
the estimated relevant sets; |
nonzero |
the selected covariates; |
zero |
the covariates that are not selected; |
thres |
the boundaries for abs(beta); |
R |
the sorted adjacent distances; |
intercept |
the estimated intercept when |
This object has attribute contains:
mod.fit |
the fitted penalized regression within the input function |
family |
the family of fitted object; |
fitfun.SP |
the function to obtain the solution paths for the SPSP algorithm; |
args.fitfun.SP |
a named list containing additional arguments for the function |
Examples
data(HighDim)
library(glmnet)
# Use the high dimensional dataset (data(HighDim)) to test SPSP+Lasso and SPSP+AdaLasso:
data(HighDim)
x <- as.matrix(HighDim[,-1])
y <- HighDim[,1]
spsp_lasso_1 <- SPSP::SPSP(x = x, y = y, family = "gaussian", fitfun.SP = lasso.glmnet,
init = 1, standardize = FALSE, intercept = FALSE)
head(spsp_lasso_1$nonzero)
head(spsp_lasso_1$beta_SPSP)
spsp_adalasso_5 <- SPSP::SPSP(x = x, y = y, family = "gaussian", fitfun.SP = adalasso.glmnet,
init = 5, standardize = TRUE, intercept = FALSE)
head(spsp_adalasso_5$nonzero)
head(spsp_adalasso_5$beta_SPSP)