View source: R/cvm_priorityelasticnet.R
cvm_priorityelasticnet | R Documentation |
Runs priorityelasticnet for a list of block specifications and gives the best results in terms of cv error.
cvm_priorityelasticnet(
X,
Y,
weights,
family,
type.measure,
blocks.list,
max.coef.list = NULL,
block1.penalization = TRUE,
lambda.type = "lambda.min",
standardize = TRUE,
nfolds = 10,
foldid,
cvoffset = FALSE,
cvoffsetnfolds = 10,
alpha = 1,
...
)
X |
A numeric matrix of predictors. |
Y |
A response vector. For family = "multinomial", Y should be a factor with more than two levels. |
weights |
Optional observation weights. Default is NULL. |
family |
A character string specifying the model type. Options are "gaussian", "binomial", "cox", and "multinomial". Default is "gaussian". |
type.measure |
Loss function for cross-validation. Options are "mse", "deviance", "class", "auc". Default depends on the family. |
blocks.list |
list of the format |
max.coef.list |
list of |
block1.penalization |
Logical. If FALSE, the first block will not be penalized. Default is TRUE. |
lambda.type |
Type of lambda to select. Options are "lambda.min" or "lambda.1se". Default is "lambda.min". |
standardize |
Logical flag for variable standardization, prior to fitting the model. Default is TRUE. |
nfolds |
Number of folds for cross-validation. Default is 10. |
foldid |
Optional vector of values between 1 and |
cvoffset |
Logical. If TRUE, a cross-validated offset is used. Default is FALSE. |
cvoffsetnfolds |
Number of folds for cross-validation of the offset. Default is 10. |
alpha |
Elastic net mixing parameter. The elastic net penalty is defined as
Defaults to 1 (lasso penalty). |
... |
other arguments that can be passed to the function |
object of class cvm_priorityelasticnet
with the following elements. If these elements are lists, they contain the results for each penalized block of the best result.
lambda.ind
list with indices of lambda for lambda.type
.
lambda.type
type of lambda which is used for the predictions.
lambda.min
list with values of lambda for lambda.type
.
min.cvm
list with the mean cross-validated errors for lambda.type
.
nzero
list with numbers of non-zero coefficients for lambda.type
.
glmnet.fit
list of fitted glmnet
objects.
name
a text string indicating type of measure.
block1unpen
if block1.penalization = FALSE
, the results of either the fitted glm
or coxph
object.
best.blocks
character vector with the indices of the best block specification.
best.blocks.indices
list with the indices of the best block specification ordered by best to worst.
best.max.coef
vector with the number of maximal coefficients corresponding to best.blocks
.
best.model
complete priorityelasticnet
model of the best solution.
coefficients
coefficients according to the results obtained with best.blocks
.
call
the function call.
The function description and the first example are based on the R package ipflasso
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.