| fit.models | R Documentation | 
Runs the survival analysis with several useful options, using either MLE (via flexsurv) or a Bayesian approach (via R-INLA or rstan)
fit.models(formula = NULL, data, distr = NULL, method = "mle", ...)
| formula | a formula specifying the model to be used, in the form
 | 
| data | A data frame containing the data to be used for the analysis.
This must contain data for the 'event' variable. In case there is no
censoring, then  | 
| distr | a (vector of) string(s) containing the name(s) of the model(s) to be fitted. Available options are: 
 | 
| method | A string specifying the inferential method ( | 
| ... | Additional options (for INLA or HMC). INLA specific options  HMC specific options  | 
On object in the class survHE containing the following elements
| models |  A list containing the fitted models. These contain
the output from the original inference engine ( | 
| model.fitting | A list containing the output of the model-fit statistics (AIC, BIC, DIC). The AIC and BIC are estimated for all methods, while the DIC is only estimated when using Bayesian inference. | 
| method |  A string indicating the method used to
fit the model, ie  | 
| misc |  A list containing the time needed to run the model(s) (in
seconds), the formula used, the results of the Kaplan-Meier analysis (which
is automatically performed using  | 
Gianluca Baio
G Baio (2019). survHE: Survival analysis for health economic evaluation and cost-effectiveness modelling. Journal of Statistical Software (2020). vol 95, 14, 1-47. doi:10.18637/jss.v095.i14
make.surv
## Not run: 
# Loads an example dataset from 'flexsurv'
data(bc)
# Fits the same model using the 3 inference methods
mle = fit.models(formula=Surv(recyrs,censrec)~group,data=bc,
    distr="exp",method="mle")
inla = fit.models(formula=Surv(recyrs,censrec)~group,data=bc,
    distr="exp",method="inla")
hmc = fit.models(formula=Surv(recyrs,censrec)~group,data=bc,
    distr="exp",method="hmc")
    
# Prints the results in comparable fashion using the survHE method
print(mle)
print(inla)
print(hmc)
# Or visualises the results using the original packages methods
print(mle,original=TRUE)
print(inla,original=TRUE)
print(hmc,original=TRUE)
# Plots the survival curves and estimates
plot(mle)
plot(mle,inla,hmc,labs=c("MLE","INLA","HMC"),colors=c("black","red","blue"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.