1\name{predict.rq} 2\alias{predict.rq} 3\alias{predict.rqs} 4\alias{predict.rq.process} 5\title{Quantile Regression Prediction} 6\description{ 7Prediction based on fitted quantile regression model 8} 9\usage{ 10\method{predict}{rq}(object, newdata, type = "none", interval = c("none", "confidence"), 11 level = .95, na.action = na.pass, ...) 12\method{predict}{rqs}(object, newdata, type = "Qhat", stepfun = FALSE, na.action = na.pass, ...) 13\method{predict}{rq.process}(object, newdata, type = "Qhat", stepfun = FALSE, na.action = na.pass, ...) 14} 15\arguments{ 16 \item{object}{ object of class rq or rqs or rq.process produced by \code{rq} } 17 \item{newdata}{An optional data frame in which to look for variables with 18 which to predict. If omitted, the fitted values are used.} 19 \item{interval}{type of interval desired: default is 'none', when set to 20 'confidence' the function returns a matrix predictions with point predictions 21 for each of the 'newdata' points as well as lower and upper confidence limits.} 22 \item{level}{converage probability for the 'confidence' intervals.} 23 \item{type}{For \code{predict.rq}, the method for 'confidence' intervals, if desired. 24 If 'percentile' then one of the bootstrap methods is used to generate percentile 25 intervals for each prediction, if 'direct' then a version of the Portnoy and Zhou 26 (1998) method is used, and otherwise an estimated covariance matrix for the parameter 27 estimates is used. Further arguments to determine the choice of bootstrap 28 method or covariance matrix estimate can be passed via the \dots argument. 29 For \code{predict.rqs} and \code{predict.rq.process} when \code{stepfun = TRUE}, 30 \code{type} is "Qhat", "Fhat" or "fhat" depending on whether the user would 31 like to have estimates of the conditional quantile, distribution or density functions 32 respectively. As noted below the two former estimates can be monotonized with the 33 function \code{rearrange}. When the "fhat" option is invoked, a list of conditional 34 density functions is returned based on Silverman's adaptive kernel method as 35 implemented in \code{akj} and \code{approxfun}.} 36 \item{stepfun}{If 'TRUE' return stepfunctions otherwise return matrix of predictions. 37 these functions can be estimates of either the conditional quantile or distribution 38 functions depending upon the \code{type} argument. When \code{stepfun = FALSE} 39 a matrix of point estimates of the conditional quantile function at the points 40 specified by the \code{newdata} argument. } 41 \item{na.action}{ function determining what should be done with missing values 42 in 'newdata'. The default is to predict 'NA'.} 43 \item{\dots}{ Further arguments passed to or from other methods.} 44} 45\details{ 46 Produces predicted values, obtained by evaluating the quantile 47 regression function in the frame 'newdata' (which defaults to 48 'model.frame(object)'. These predictions purport to estimate 49 the conditional quantile function of the response variable of 50 the fitted model evaluated at the covariate values specified 51 in "newdata" and the quantile(s) specified by the "tau" argument. 52 Several methods are provided to compute confidence intervals for 53 these predictions. 54} 55\value{ 56 A vector or matrix of predictions, depending upon the setting of 57 'interval'. In the case that there are multiple taus in \code{object} 58 when object is of class 'rqs' setting 'stepfun = TRUE' will produce a 59 \code{stepfun} object or a list of \code{stepfun} objects. 60 The function \code{rearrange} can be used to monotonize these 61 step-functions, if desired. 62} 63\references{ 64Zhou, Kenneth Q. and Portnoy, Stephen L. (1998) 65Statistical inference on heteroscedastic models based on regression quantiles 66Journal of Nonparametric Statistics, 9, 239-260 67} 68\author{R. Koenker} 69\seealso{ \code{\link{rq}} \code{\link{rearrange}}} 70\examples{ 71data(airquality) 72airq <- airquality[143:145,] 73f <- rq(Ozone ~ ., data=airquality) 74predict(f,newdata=airq) 75f <- rq(Ozone ~ ., data=airquality, tau=1:19/20) 76fp <- predict(f, newdata=airq, stepfun = TRUE) 77fpr <- rearrange(fp) 78plot(fp[[2]],main = "Conditional Ozone Quantile Prediction") 79lines(fpr[[2]], col="red") 80legend(.2,20,c("raw","cooked"),lty = c(1,1),col=c("black","red")) 81fp <- predict(f, newdata=airq, type = "Fhat", stepfun = TRUE) 82fpr <- rearrange(fp) 83plot(fp[[2]],main = "Conditional Ozone Distribution Prediction") 84lines(fpr[[2]], col="red") 85legend(20,.4,c("raw","cooked"),lty = c(1,1),col=c("black","red")) 86 } 87\keyword{regression} 88