predict.gcrq: Prediction for "gcrq" objects

View source: R/predict.gcrq.R

predict.gcrqR Documentation

Prediction for "gcrq" objects

Description

Takes a "gcrq" objects and computes fitted values

Usage

## S3 method for class 'gcrq'
predict(object, newdata, se.fit=FALSE, transf=NULL, xreg, 
                      type=c("sandw","boot"), ...)

Arguments

object

a fitted "gcrq" object.

newdata

a dataframe including all the covariates of the model. The smooth term is represented by a covariate and proper basis functions will be build accordingly. If omitted, the fitted values are used. Ignored if xreg is provided.

se.fit

logical. If TRUE, standard errors of the fitted quantiles are computed using the bootstrap or the sandwich covariance matrix, according to the argument type.

transf

An optional character string (with "y" as argument) meaning a function to apply to the predicted values. E.g. "(exp(y)-0.1)". If NULL (default) it is taken as the inverse of function transf (*if*) supplied in gcrq. The standard errors (provided se.fit=TRUE has been set) are adjusted accordingly via the Delta method. See argument "transf" in gcrq(). If transf has been specified in gcrq(), use transf="y" to force predictions on the transformed scale, i.e. without back transforming.

xreg

the design matrix for which predictions are requested. If provided, xreg has to include the basis functions of the B-spline.

type

If se.fit=TRUE, which cov matrix should be used? 'boot' means case-resampling bootstrap (see n.boot in gcrq()), 'sandw' mean via the sandwich formula.

...

arguments passed to other functions

Details

predict.gcrq computes fitted quantiles as a function of observations included in newdata or xreg. Either newdata or xreg have to be supplied, but newdata is ignored when xreg is provided.

Value

If se.fit=FALSE, a matrix of fitted values with number of rows equal to number of rows of input data and number of columns depending on the number of fitted quantile curves (i.e length of taus). If se.fit=TRUE, a list of matrices (fitted values and standard errors).

Author(s)

Vito M.R. Muggeo

See Also

gcrq, plot.gcrq

Examples

##see ?gcrq
## predict(m1, newdata=data.frame(x=c(.3,.7)))



quantregGrowth documentation built on July 9, 2023, 6:06 p.m.