adapt_univ | R Documentation |
Compute odd-ratios between each covariate of x
and y
then derived
adaptive weights to incorporate in an adaptive lasso.
BIC or cross-validation could either be used for the adaptive lasso for variable selection.
Two options for implementing cross-validation for the adaptive lasso are possible through the type_cv
parameter (see bellow).
Can deal with very large sparse data matrices.
Intended for binary reponse only (option family = "binomial"
is forced).
The cross-validation criterion used is deviance.
Depends on the glmnet
and relax.glmnet
function from the package
glmnet
.
adapt_univ(
x,
y,
gamma = 1,
criterion = "bic",
maxp = 50,
path = TRUE,
nfolds = 5,
foldid = NULL,
type_cv = "proper",
betaPos = TRUE,
...
)
x |
Input matrix, of dimension nobs x nvars. Each row is an observation
vector. Can be in sparse matrix format (inherit from class
|
y |
Binary response variable, numeric. |
gamma |
Tunning parameter to defined the penalty weights. See details below. Default is set to 1. |
criterion |
Character, indicates which criterion is used with the adaptive lasso for variable selection. Could be either "bic" or "cv". Default is "bic" |
maxp |
Used only if |
path |
Used only if |
nfolds |
Used only if |
foldid |
Used only if |
type_cv |
Used only if |
betaPos |
Should the covariates selected by the procedure be
positively associated with the outcome ? Default is |
... |
Other arguments that can be passed to |
The adaptive weight for a given covariate i is defined by
w_i = 1/|\beta^{univ}_i|^\gamma
where
\beta^{univ}_i = log(OR_i)
, with
OR_i
is the odd-ratio associated to covariate i
with the outcome.
An object with S3 class "adaptive"
.
aws |
Numeric vector of penalty weights derived from odds-ratios. Length equal to nvars. |
criterion |
Character, same as input. Could be either "bic" or "cv". |
beta |
Numeric vector of regression coefficients in the adaptive lasso.
If |
selected_variables |
Character vector, names of variable(s) selected
with this adaptive approach.
If |
Emeline Courtois
Maintainer: Emeline Courtois
emeline.courtois@inserm.fr
set.seed(15)
drugs <- matrix(rbinom(100*20, 1, 0.2), nrow = 100, ncol = 20)
colnames(drugs) <- paste0("drugs",1:ncol(drugs))
ae <- rbinom(100, 1, 0.3)
au <- adapt_univ(x = drugs, y = ae, criterion ="cv", nfolds = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.