View source: R/A2_aux_functions.R
predict.ctqr | R Documentation |
This function returns predictions for an object of class “ctqr
”.
## S3 method for class 'ctqr'
predict(object, newdata, se.fit = FALSE, ...)
object |
a |
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. |
This function produces predicted values obtained by evaluating the regression function at newdata
(which defaults to model.frame(object)).
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:
fit |
a matrix of fitted values, as described above. |
se.fit |
a matrix of estimated standard errors. |
Paolo Frumento paolo.frumento@unipi.it
ctqr
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.