Description Usage Arguments Details Value Note Author(s) References See Also Examples
Runs the survival analysis with several useful options, using either MLE (via flexsurv) or a Bayesian approach (via RINLA or rstan)
1  fit.models(formula=NULL,data,distr,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 modelfit 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 KaplanMeier analysis (which is automatically performed using 
Something will go here
Gianluca Baio
Something will go here
Something will go here
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  # 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"))

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