rq.group.pen.cv: Performs cross validation for a group penalty. #'

View source: R/mainFunctions.R

rq.group.pen.cvR Documentation

Performs cross validation for a group penalty. #'

Description

Performs cross validation for a group penalty. #'

Usage

rq.group.pen.cv(
  x,
  y,
  tau = 0.5,
  groups = 1:ncol(x),
  lambda = NULL,
  a = NULL,
  cvFunc = NULL,
  nfolds = 10,
  foldid = NULL,
  groupError = TRUE,
  cvSummary = mean,
  tauWeights = rep(1, length(tau)),
  printProgress = FALSE,
  weights = NULL,
  ...
)

Arguments

x

Matrix of predictors.

y

Vector of responses.

tau

Vector of quantiles.

groups

Vector of group assignments for the predictors.

lambda

Vector of lambda values, if set to NULL they will be generated automatically.

a

Vector of the other tuning parameter values.

cvFunc

Function used for cross-validation error, default is quantile loss.

nfolds

Number of folds used for cross validation.

foldid

Fold assignments, if not set this will be randomly created.

groupError

If errors are to be reported as a group or as the average for each fold.

cvSummary

The

tauWeights

Weights for the tau penalty.

printProgress

If set to TRUE will print which fold the process is working on.

weights

Weights for the quantile loss function. Used in both model fitting and cross-validation.

...

Additional parameters that will be sent to rq.group.pen().

Value

An rq.pen.seq.cv object.

cverr

Matrix of cvSummary function, default is average, cross-validation error for each model, tau and a combination, and lambda.

cvse

Matrix of the standard error of cverr foreach model, tau and a combination, and lambda.

fit

The rq.pen.seq object fit to the full data.

btr

A data.table of the values of a and lambda that are best as determined by the minimum cross validation error and the one standard error rule, which fixes a. In btr the values of lambda and a are selected seperately for each quantile.

gtr

A data.table for the combination of a and lambda that minimize the cross validation error across all tau.

gcve

Group, across all quantiles, cross-validation error results for each value of a and lambda.

call

Original call to the function.

Author(s)

Ben Sherwood, ben.sherwood@ku.edu and Shaobo Li shaobo.li@ku.edu

Examples

set.seed(1)
x <- matrix(rnorm(100*8,sd=1),ncol=8)
y <- 1 + x[,1] + 3*x[,3] - x[,8] + rt(100,3)
g <- c(1,1,1,1,2,2,3,3)
tvals <- c(.25,.75)
## Not run: 
m1 <- rq.group.pen.cv(x,y,tau=c(.1,.3,.7),groups=g)
m2 <- rq.group.pen.cv(x,y,penalty="gAdLASSO",tau=c(.1,.3,.7),groups=g)
m3 <- rq.group.pen.cv(x,y,penalty="gSCAD",tau=c(.1,.3,.7),a=c(3,4,5),groups=g)
m4 <- rq.group.pen.cv(x,y,penalty="gMCP",tau=c(.1,.3,.7),a=c(3,4,5),groups=g)

## End(Not run)

bssherwood/rqpen documentation built on April 23, 2024, 9:50 a.m.