Predictions from rq.pen.seq object
# S3 method for rq.pen.seq
predict(
object,
newx,
tau = NULL,
a = NULL,
lambda = NULL,
modelsIndex = NULL,
lambdaIndex = NULL,
sort = FALSE,
...
)
A matrix of predictions for each tau and a combination
rq.pen.seq object
Matrix of predictors
Quantile of interest. Default is NULL, which will return all quantiles. Should not be specified if modelsIndex is used.
Tuning parameter of a. Default is NULL, which returns coefficients for all values of a. Should not be specified if modelsIndex is used.
Tuning parameter of
Index of the models for which coefficients should be returned. Does not need to be specified if tau or a are specified.
Index of the lambda values for which coefficients should be returned. Does not need to be specified if lambda is specified.
If there are crossing quantiles the predictions will be sorted to avoid this issue.
Additional parameters passed to coef.rq.pen.seq()
Ben Sherwood, ben.sherwood@ku.edu
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)
Run the code above in your browser using DataLab