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

View source: R/mainFunctions.R

predict.rq.pen.seqR Documentation

Predictions from rq.pen.seq object

Description

Predictions from rq.pen.seq object

Usage

## S3 method for class 'rq.pen.seq'
predict(
  object,
  newx,
  tau = NULL,
  a = NULL,
  lambda = NULL,
  modelsIndex = NULL,
  lambdaIndex = NULL,
  ...
)

Arguments

object

rq.pen.seq 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.

a

Tuning parameter of a. Default is NULL, which returns coefficients for all values of a. Should not be specified if modelsIndex is used.

lambda

Tuning parameter of \lambda. Default is NULL, which returns coefficients for all values of \lambda.

modelsIndex

Index of the models for which coefficients should be returned. Does not need to be specified if tau or a are specified.

lambdaIndex

Index of the lambda values for which coefficients should be returned. Does not need to be specified if lambda is specified.

...

Additional parameters passed to coef.rq.pen.seq()

Value

A matrix of predictions for each tau and a combination

Author(s)

Ben Sherwood, ben.sherwood@ku.edu

Examples

x <- matrix(runif(800),ncol=8)
y <- 1 + x[,1] + x[,8] + (1+.5*x[,3])*rnorm(100)
m1 <- rq.pen(x,y,penalty="ENet",a=c(0,.5,1),tau=c(.25,.75),lambda=c(.1,.05,.01))
newx <- matrix(runif(80),ncol=8)
allCoefs <- predict(m1,newx)
targetCoefs <- predict(m1,newx,tau=.25,a=.5,lambda=.1)
idxApproach <- predict(m1,newx,modelsIndex=2)
bothIdxApproach <- predict(m1,newx,modelsIndex=2,lambdaIndex=1)

rqPen documentation built on Aug. 25, 2023, 1:07 a.m.