predict.rq.pen.seq.cv: Predictions from rq.pen.seq.cv object

View source: R/mainFunctions.R

predict.rq.pen.seq.cvR Documentation

Predictions from rq.pen.seq.cv object

Description

Predictions from rq.pen.seq.cv object

Usage

## S3 method for class 'rq.pen.seq.cv'
predict(
  object,
  newx,
  tau = NULL,
  septau = ifelse(object$fit$penalty != "gq", TRUE, FALSE),
  cvmin = TRUE,
  useDefaults = TRUE,
  sort = FALSE,
  lambda = NULL,
  lambdaIndex = NULL,
  ...
)

Arguments

object

rq.pen.seq.cv object

newx

Matrix of predictors

tau

Quantile of interest. Default is NULL, which will return all quantiles. Should not be specified if modelsIndex is used.

septau

Whether tuning parameter should be optimized separately for each quantile.

cvmin

If TRUE then minimum error is used, if FALSE then one standard error rule is used.

useDefaults

Whether the default results are used. Set to FALSE if you you want to specify specific models and lambda values.

sort

If there are crossing quantiles the predictions will be sorted to avoid this issue.

lambda

The value of lambda for which predictions are wanted. Ignored unless useDefaults is set to false.

lambdaIndex

The indices for lambda for which predictions are wanted. Ignored unless useDefaults is set to false.

...

Additional parameters sent to coef.rq.pen.seq.cv().

Value

A matrix of predictions for each tau and a combination

Author(s)

Ben Sherwood, ben.sherwood@ku.edu

Examples

x <- matrix(runif(1600),ncol=8)
y <- 1 + x[,1] + x[,8] + (1+.5*x[,3])*rnorm(200)
m1 <- rq.pen.cv(x,y,penalty="ENet",a=c(0,.5,1),tau=c(.25,.75),lambda=c(.1,.05,.01))
newx <- matrix(runif(80),ncol=8)
cvpreds <- predict(m1,newx)

rqPen documentation built on April 12, 2025, 1:55 a.m.