# Analysis.R for How uncertain is the survival extrapolation? A study of the impact of different parametric survival models on extrapolated uncertainty about hazard functions, lifetime mean survival and cost-effectiveness

Code used to analyse the dataset "Data.Rda" provided in this project. Produces extrapolations, estimates of lifetime mean survival and a hypothetical cost-effectiveness analysis. These are summarised via figures and tables, as presented in the manuscript "How uncertain is the survival extrapolation? A study of the impact of different parametric survival models on extrapolated uncertainty about hazard functions, lifetime mean survival and cost-effectiveness."

To use this code, the libraries loaded at the start of the script need to be pre-installed, and Data.Rda should be placed in the same folder as this script.

To visualise the hazard function, the functions 'pehaz' and 'muhaz' are used from the 'muhaz' library, giving noisy (piece-wise) and smooth estimates, respectively. Uncertainty about these estimates is obtained via bootstrapping.

The package 'flexsurv' is used to fit seven standard parametric survival models (exponential, Weibull, Gompertz, Gamma, log-normal, loglogistic and generalised gamma).

Also included is code for a simple two-state (well-death) markov model and corresponding health economic evaluation (cost-effectiveness analysis). Probabilistic sensitivity analysis (PSA) is carried out - this uses 10,000 samples. Only uncertainty in the survival models is considered. To output the results of this PSA it is assumed that a folder exists called 'SAVI' - data are exported into this folder, ready for analysis at http://savi.shef.ac.uk/SAVI/ (note the results of this further analysis are not reported as most value of information estimates were zero).