Learn R Programming

rqPen (version 4.1.3)

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

Description

Predictions from rq.pen.seq.cv object

Usage

# S3 method for 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,
  ...
)

Value

A matrix of predictions for each tau and a combination

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

Author

Ben Sherwood, ben.sherwood@ku.edu

Examples

Run this code
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)

Run the code above in your browser using DataLab