cvm_priorityelasticnet {priorityelasticnet}R Documentation

priorityelasticnet with several block specifications

Description

Runs priorityelasticnet for a list of block specifications and gives the best results in terms of cv error.

Usage

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,
  ...
)

Arguments

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 list(list(bp1=...,bp2=...,), list(bp1=,...,bp2=...,), ...). For the specification of the entries, see priorityelasticnet.

max.coef.list

list of max.coef vectors. The first entries are omitted if block1.penalization = FALSE. Default is NULL.

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 nfolds identifying what fold each observation is in. Default is NULL.

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

(1 - \alpha)/2||\beta||_2^2 + \alpha||\beta||_1

Defaults to 1 (lasso penalty).

...

other arguments that can be passed to the function priorityelasticnet.

Value

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.

Note

The function description and the first example are based on the R package ipflasso.


[Package priorityelasticnet version 0.1.0 Index]