ctqr (version 1.0)

predict.ctqr: Prediction After Quantile Regression

Description

This function returns predictions for an object of class “ctqr”.

Usage

"predict"(object, newdata, se.fit = FALSE, ...)

Arguments

object
a ctqr object.
newdata
optional data frame in which to look for variables with which to predict. It must include all the covariates that enter the quantile regression model. If omitted, the fitted values are used.
se.fit
logical. If TRUE, standard errors of the predictions are also computed.
...
for future methods.

Value

If se = FALSE, a matrix of fitted values, with rows corresponding to different observations, and one column for each value of object$p. If se = TRUE, a list with two items: , a list with two items:

Details

This function produces predicted values obtained by evaluating the regression function at newdata (which defaults to model.frame(object)).

See Also

ctqr

Examples

Run this code
# Using simulated data

n <- 1000
x1 <- runif(n)
x2 <- runif(n)
t <- 1 + x1 + x2 + runif(n, -1,1)
c <- rnorm(n,3,1)
y <- pmin(t,c)
d <- (t <= c)

model <- ctqr(Surv(y,d) ~ x1 + x2, p = c(0.25,0.5))
pred <- predict(model) # the same as fitted(model)
predict(model, newdata = data.frame(x1 = c(0.2,0.6), x2 = c(0.1,0.9)), se.fit = TRUE)

Run the code above in your browser using DataLab