EMcvfusedlasso: cross validation for EM fused-lasso

View source: R/cvEM.R

EMcvfusedlassoR Documentation

cross validation for EM fused-lasso

Description

cross validation function for EMfusedlasso.

Usage

EMcvfusedlasso(
  X,
  y,
  lambda1,
  lambda2,
  nbFolds = 10,
  maxSteps = 1000,
  burn = 50,
  intercept = TRUE,
  model = c("linear", "logistic"),
  eps = 1e-05,
  eps0 = 1e-08,
  epsCG = 1e-08
)

Arguments

X

the matrix (of size n*p) of the covariates.

y

a vector of length n with the response.

lambda1

Values of lambda1 at which prediction error should be computed. Can be a single value.

lambda2

Values of lambda2 at which prediction error should be computed. Can be a single value.

nbFolds

the number of folds for the cross-validation.

maxSteps

Maximal number of steps for EM algorithm.

burn

Number of steps for the burn period.

intercept

If TRUE, there is an intercept in the model.

model

"linear" or "logistic".

eps

Tolerance of the algorithm.

eps0

Zero tolerance. Coefficients under this value are set to zero.

epsCG

Epsilon for the convergence of the conjugate gradient.

Value

A list containing

cv

Mean prediction error for each value of index.

cvError

Standard error of cv.

minCv

Minimal cv criterion.

lambda1

Values of lambda1 at which prediction error should be computed.

lambda2

Values of lambda2 at which prediction error should be computed.

lambda.optimal

Value of (lambda1,lambda2) for which the cv criterion is minimal.

Author(s)

Quentin Grimonprez, Serge Iovleff

Examples

dataset <- simul(50, 100, 0.4, 1, 10, matrix(c(0.1, 0.8, 0.02, 0.02), nrow = 2))
result <- EMcvfusedlasso(
  X = dataset$data, y = dataset$response, lambda1 = 3:1,
  lambda2 = 3:1, nbFolds = 5, intercept = FALSE
)

HDPenReg documentation built on March 31, 2023, 9:31 p.m.