Description Usage Arguments Value See Also Examples
View source: R/predict.flexsurvreg.R
Predict outcomes from flexible survival models at the covariate values
specified in newdata
.
1 2 3 4 5 6 7 8 9 10 11 12 13 
object 
Output from 
newdata 
Data frame containing covariate values at which to produce
fitted values. There must be a column for every covariate in the model
formula used to fit If 
type 
Character vector for the type of predictions desired.

times 
Vector of time horizons at which to compute fitted values.
Only applies when If not specified, predictions for For 
start 
Optional lefttruncation time or times. The returned
survival, hazard, or cumulative hazard will be conditioned on survival up
to this time. 
conf.int 
Logical. Should confidence intervals be returned?
Default is 
conf.level 
Width of symmetric confidence intervals, relative to 1. 
se.fit 
Logical. Should standard errors of fitted values be returned?
Default is 
p 
Vector of quantiles at which to return fitted values when

... 
Not currently used. 
A tibble
with same number of rows as newdata
and in the same order. If multiple predictions are requested, a
tibble
containing a single listcolumn of data frames.
For the listcolumn of data frames  the dimensions of each data frame
will be identical. Rows are added for each value of times
or
p
requested.
summary.flexsurvreg
,
residuals.flexsurvreg
1 2 3 4 5 6 7 8 9 10 11 12 13 14  fitg < flexsurvreg(formula = Surv(futime, fustat) ~ age, data = ovarian, dist = "gengamma")
## Simplest prediction: mean or median, for covariates defined by original dataset
predict(fitg)
predict(fitg, type = "quantile", p = 0.5)
## Simple prediction for userdefined covariate values
predict(fitg, newdata = data.frame(age = c(40, 50, 60)))
predict(fitg, type = "quantile", p = 0.5, newdata = data.frame(age = c(40,50,60)))
## Predict multiple quantiles and unnest
require(tidyr)
pr < predict(fitg, type = "survival", times = c(600, 800))
tidyr::unnest(pr, .pred)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.