knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width = 7,
  fig.height = 6
)

Introduction

Parametric survival models are often the preferred method of extrapolating survival data for use in economic models. The National Institute for Health and Care Excellence (NICE) Decision Support Unit (DSU) technical support document (TSD) 14 recommends that the Exponential, Weibull, Gompertz, log-logistic, log normal and Generalized Gamma parametric models should all be considered.[@latimer2011nice] More recently, NICE also discusses more flexible models in NICE DSU TSD 21, however, more these models are not in the scope of this package.[@rutherford2020nice] The Canadian Agency for Drugs and Technologies in Health (CADTH) additionally specifies that the Gamma distribution must also be considered. This document therefore details the characteristics of each of these distributions and demonstrates how the parameters from each distribution, outputted using the flexsurvPlus package, can be implemented within an economic model.[@cadth2020] The Generalized F distribution is not commonly used, however it has been included in this package in case more flexible modeling is required.

The flexsurvPlus package allows the inclusion of a treatment effect in the following three ways:

This document details the parameters for each of these three model types. A separate vignette; "Fitting parametric survival models in R" details how to perform the analyses in R using the flexsurvPlus package.

Properties of the distributions

The properties of each parametric distribution are summarized in the Table below.

By default, covariates are placed on the “location” parameter of the distribution, typically the "scale" or "rate" parameter, through a linear model, or a log-linear model if this parameter must be positive. This gives an accelerated failure time model or a proportional hazards model (see Table below) depending on how the distribution is parametrized.The other parameters are ancillary parameters that determine the shape, variance, or higher moments of the distribution. These parameters impact the hazard function, which can take a variety of shapes depending on the distribution:[@RbloggersPSM; @cox2008]

The log-hazard function of the Weibull model is linear with respect to the log of time. The log-hazard function of the Gompertz model is linear with respect to time.

Special cases

Initial diagnostics

Before fitting any models, the following initial diagnostic plots are helpful to understand which distribution might be the best fit to the data being modeled:

exponential <- c("Exponential",
                 "$1: \\ b$",
                 "rate (b)",
                 "NA",
                 "$e^{-b t}$",
                 "$b$",
                 "Constant",
                 "PH and AFT"#, 
                 #"NA"
                 )
weibull <- c("Weibull",
             "$2:\\ a, b$",
             "scale (b)",
             "shape (a)",
             "$e^{(\\frac{-t}{b})^{a}}$",
             "$a\\frac{t}{b}^{a -1}$",
             "Constant, monotonically increasing, monotonically decreasing",
             "AFT"#, 
             #"Reduces to an exponential model when $\\gamma = 1$, log-hazard function is linear with respect to the log of time"
             )
gompertz <- c("Gompertz",
              "$2:\\ a, b$",
              "rate (b)",
              "shape (a)",
              "$e^{\\frac{-b}{a} (e^{a t}-1)}$",
              "$b e^{a t}$",
              "Constant, monotonically increasing, monotonically decreasing",
              "PH"#, 
              #"Reduces to an exponential model when $\\sigma = 1$, log-hazard function is linear with respect to time"
              )

llogistic <- c("Log-logistic",
              "$2:\\ a, b$",
              "scale (b)",
              "shape (a)",
              "$\\frac{1}{1 + (\\frac{t}{b})^a}$",
              "$\\frac{\\frac{a}{b}(\\frac{t}{b})^{a - 1}}{1 + (\\frac{t}{b})^a}$",
              "Monotonically decreasing, initial increase the decrease",
              "AFT"#, 
              #"May have long tails"
              )

lnormal <- c("Log-normal",
              "$2: \\ \\mu, \\sigma$",
              "meanlog ($\\mu$)",
              "sdlog ($\\sigma$)",
              "$1 - \\Phi \\frac{log t - \\mu}{\\sigma}$",
              "$\\frac{\\frac{1}{\\sigma \\sqrt{2 \\pi}}t^{-1}e[-\\frac{(log t - \\mu)^2}{2 \\sigma^2}]}{S(t)}$",
              "Initially increases then decreases",
              "AFT"#, 
              #"May have long tails"
             )

gamma <- c("Gamma", 
           "$2: \\ a, b$", 
           "rate (b)",
           "shape (a)",
           "$1 - \\frac{\\gamma(a, bt)}{\\Gamma(a)}$",
           "$\\frac{b^at^{a -1}e^{-bt}}{\\Gamma(a) S(t)}$",
           "Constant, monotonically increasing, monotonically decreasing",
           "AFT"#,
           #" "
           )

gengamma <- c("Generalized gamma", 
              "$3: \\ \\mu, \\sigma, Q$", 
              "mu ($\\mu$)",
              "sigma ($\\sigma$), Q",
              "$1 - \\frac{\\gamma(Q^{-2}, Q^{-2}e^{Q \\frac{log(t) – \\mu}{\\sigma}})}{\\Gamma(Q^{-2})}; \\  if \\ Q \\neq 0$ \\ $1 - \\Phi(\\frac{logt – \\mu}{\\sigma}); \\ if \\ Q = 0$",
              "$\\frac{|Q|(Q^{-2})^{Q^{-2}}}{\\sigma t \\Gamma(Q^{-2}) S(t)} \\exp\\left[Q^{-2}\\left(Q\\frac{logt – \\mu}{\\sigma}-e^{Q\\frac{logt – \\mu}{\\sigma}}\\right)\\right]$",
              "Constant, monotonically increasing, monotonically decreasing, bathtub, arc-shaped",
              "AFT"#, 
              #"Reduces to an exponential model, Weibull model (Q=1) and log-normal model (Q=0)"
              )

 genf <- c("Generalized F", 
               "$4: \\ \\mu, \\sigma, Q, P$", 
               "mu ($\\mu$)",
               "sigma ($\\sigma$), Q, P",
               "$$ \\int_{0}^{s_{1}(s_{2}+s_{1}e^{w})^{-1}} \\frac{x^{s_{2}-1}(1-x)^{s_{1}-1}}{B(s_{2}, s_{1})} \\ dx $$",
               "$$ \\frac{\\delta (s_{1}/s_{2})^{s_{1}}e^{s_{1}w}}{\\sigma x (1 + s_{1} e^{w}/s_{2})^{(s_{1} + s_{2})}B(s_{1}, s_{2})S(t)}$$",
               "Decreasing, arc-shaped",
               "AFT")

all.dists <- rbind.data.frame(exponential, 
                              weibull,
                              gompertz,
                              llogistic,
                              lnormal,
                              gamma,
                              gengamma,
                              genf)
knitr::kable(all.dists, 
             col.names = c("Distribution",
                           "Number of parameters",
                           "Location parameter",
                           "Ancillary parameter",
                           "Survival function: S(t)", 
                           "Hazard function: h(t)", 
                           "Possible shapes of the hazard function", 
                           "Treatment effect model assumption"#, 
                           #"Other properties"
                           ),
             escape = FALSE,
             caption = "Properties of common parametric survival distributions",
             format = "html") 

Exponential

Separate models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit two exponential models (one to data for the intervention treatment and one to data for the reference treatment). The R code for the fitted models is as follows:

flexsurvreg(formula = Surv(Time, Event)~1, data = data for intervention treatment , dist = "exp") flexsurvreg(formula = Surv(Time, Event)~1, data = data for reference treatment , dist = "exp")

The estimated rate parameter from each of these models can be then used within the following Excel formula to estimate survival at different time points:

EXP(-rate*time)

This is equivalent to running the following code in R:

summary( flexsurvreg exponential model , type="survival", B=0, t=time)

Common shape models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit one exponential model with a covariate for treatment. The R code for the fitted model is as follows:

flexsurvreg(formula = Surv(Time, Event)~ARM, data = data with a treatment variable named "ARM" , dist = "exp")

This model outputs a rate parameter and treatment coefficient. Rate parameters for each treatment are estimated in run_PSM as follows:

rate_calc <- c("Rate parameter + treatment coefficient",
               "Rate parameter"
                 )

all.params <- rbind.data.frame(rate_calc)
knitr::kable(all.params, 
             col.names = c("Rate (intervention treatment)",
                           "Rate (reference treatment)"
                           ),
             escape = FALSE,
             caption = "Rate parameter for intervention and reference treatments from a common shape model",
             format = "html") 

Survival can then be estimated in Excel using these two rate parameters, as for the separate models, with formula:

EXP(-rate*time)

This is equivalent to running the following code in R:

summary( flexsurvreg exponential model , type="survival", B=0, t=time)

Weibull

The Weibull model may be parametrized as either a proportional hazards model or as an accelerated failure time model; however, the flexsurv package parametrizes the Weibull as an accelerated failure time model.

Separate models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit two weibull models (one to data for the intervention treatment and one to data for the reference treatment). The R code for the fitted models is as follows:

flexsurvreg(formula = Surv(Time, Event)~1, data = data for intervention treatment , dist = "weibull") flexsurvreg(formula = Surv(Time, Event)~1, data = data for reference treatment , dist = "weibull")

Estimated shape and scale parameters from each of these models can be then used within the following Excel formula to estimate survival at different time points:

1-WEIBULL(time,shape,scale,TRUE)

This is equivalent to running the following code in R:

summary( flexsurvreg weibull model , type="survival", B=0, t=time)

Common shape models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit one weibull model with a covariate for treatment. The R code for the fitted model is as follows:

flexsurvreg(formula = Surv(Time, Event)~ARM, data = data with a treatment variable named "ARM" , dist = "weibull")

This model outputs shape and scale parameters and a treatment coefficient on the scale parameter. Shape and scale parameters for each treatment are estimated in run_PSM as follows:

shape_calc <- c("Shape",
               "Shape parameter",
               "Shape parameter"
                 )

scale_calc <- c("Scale",
               "Scale parameter + treatment coefficient",
               "Scale parameter"
                 )

all.params <- rbind.data.frame(shape_calc, scale_calc)
knitr::kable(all.params, 
             col.names = c("Parameter",
                           "Intervention",
                           "Reference"
                           ),
             escape = FALSE,
             caption = "Shape and scale parameters for intervention and reference treatments from a common shape model",
             format = "html") 

Survival can then be estimated in Excel using the shape and scale parameters specific to each treatment with formula:

1-WEIBULL(time,shape,scale,TRUE)

This is equivalent to running the following code in R:

summary( flexsurvreg weibull model , type="survival", B=0, t=time)

Independent shape models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit one weibull model with a covariate for treatment on both the scale and shape parameters. The R code for the fitted model is as follows:

flexsurvreg(formula = Surv(Time, Event) ~ ARM + shape(ARM), data = data with a treatment variable named "ARM" , dist = "weibull")

This model outputs shape and scale parameters and a treatment coefficient for both shape and scale. Shape and scale parameters for each treatment are estimated in run_PSM as follows:

shape_calc <- c("Shape",
               "Shape parameter + treatment coefficient for shape",
               "Shape parameter"
                 )

scale_calc <- c("Scale",
               "Scale parameter + treatment coefficient for scale",
               "Scale parameter"
                 )

all.params <- rbind.data.frame(shape_calc, scale_calc)
knitr::kable(all.params, 
             col.names = c("Parameter",
                           "Intervention",
                           "Reference"
                           ),
             escape = FALSE,
             caption = "Shape and scale parameters for intervention and reference treatments from an independent shape model",
             format = "html") 

Survival can then be estimated in Excel using the shape and scale parameters specific to each treatment with formula:

1-WEIBULL(time,shape,scale,TRUE)

This is equivalent to running the following code in R:

summary( flexsurvreg weibull model , type="survival", B=0, t=time)

Gompertz

Separate models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit two gompertz models (one to data for the intervention treatment and one to data for the reference treatment). The R code for the fitted models is as follows:

flexsurvreg(formula = Surv(Time, Event)~1, data = data for intervention treatment , dist = "gompertz") flexsurvreg(formula = Surv(Time, Event)~1, data = data for reference treatment , dist = "gompertz")

Estimation of the rate and shape parameters from each of these models can be then used within the following Excel formula to estimate survival at different time points:

EXP((-1/shape) * rate * (EXP(shape*time)-1))

This is equivalent to running the following code in R:

summary( flexsurvreg gompertz model , type="survival", B=0, t=time)

Common shape models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit one gompertz model with a covariate for treatment on the rate parameter. The R code for the fitted model is as follows:

flexsurvreg(formula = Surv(Time, Event)~ARM, data = data with a treatment variable named "ARM" , dist = "gompertz")

This model outputs rate and shape parameters and a treatment coefficient. Rate and shape parameters for each treatment are estimated in run_PSM as follows:

rate_calc <- c("Rate",
               "Rate parameter + treatment coefficient",
               "Rate parameter"
                 )

shape_calc <- c("Shape",
               "Shape parameter",
               "Shape parameter"
                 )


all.params <- rbind.data.frame(rate_calc, shape_calc)
knitr::kable(all.params, 
             col.names = c("Parameter",
                           "Intervention",
                           "Reference"
                           ),
             escape = FALSE,
             caption = "Rate and shape parameters for intervention and reference treatments from a common shape model",
             format = "html") 

Survival can then be estimated in Excel using the rate and shape parameters specific to each treatment with formula:

EXP((-1/shape) * rate * (EXP(shape*time)-1))

This is equivalent to running the following code in R:

summary( flexsurvreg gompertz model , type="survival", B=0, t=time)

Independent shape models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit one gompertz model with a covariate for treatment on both the rate and shape parameters. The R code for the fitted model is as follows:

flexsurvreg(formula = Surv(Time, Event) ~ ARM + shape(ARM), data = data with a treatment variable named "ARM" , dist = "gompertz")

This model outputs rate and shape parameters and a treatment coefficient for both rate and shape. Rate and shape parameters for each treatment are estimated in run_PSM as follows:

rate_calc <- c("Rate",
               "Rate parameter + treatment coefficient on rate",
               "Rate parameter"
                 )

shape_calc <- c("Shape",
               "Shape parameter + treatment coeffecient on shape",
               "Shape parameter"
                 )

all.params <- rbind.data.frame(rate_calc, shape_calc)
knitr::kable(all.params, 
             col.names = c("Parameter",
                           "Intervention",
                           "Reference"
                           ),
             escape = FALSE,
             caption = "Rate and shape parameters for intervention and reference treatments from an independent shape model",
             format = "html") 

Survival can then be estimated in Excel using the rate and shape parameters specific to each treatment with formula:

EXP((-1/shape) * rate * (EXP(shape*time)-1))

This is equivalent to running the following code in R:

summary( flexsurvreg gompertz model , type="survival", B=0, t=time)

Log-logistic

Separate models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit two log-logistic models (one to data for the intervention treatment and one to data for the reference treatment). The R code for the fitted models is as follows:

flexsurvreg(formula = Surv(Time, Event)~1, data = data for intervention treatment , dist = "llogis") flexsurvreg(formula = Surv(Time, Event)~1, data = data for reference treatment , dist = "llogis")

Estimation of the shape and scale parameters from each of these models can be then used within the following Excel formula to estimate survival at different time points:

1 /(1+((time / scale)^shape))

This is equivalent to running the following code in R:

summary( flexsurvreg log-logistic model , type="survival", B=0, t=time)

Common shape models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit one log-logistic model with a covariate for treatment. The R code for the fitted model is as follows:

flexsurvreg(formula = Surv(Time, Event)~ARM, data = data with a treatment variable named "ARM" , dist = "llogis")

This model outputs shape and scale parameters and a treatment coefficient. Shape and scale parameters for each treatment are estimated in run_PSM as follows:

shape_calc <- c("Shape",
               "Shape parameter",
               "Shape parameter"
                 )

scale_calc <- c("Scale",
               "Scale parameter + treatment coefficient",
               "Scale parameter"
                 )


all.params <- rbind.data.frame(shape_calc, scale_calc)
knitr::kable(all.params, 
             col.names = c("Parameter",
                           "Intervention",
                           "Reference"
                           ),
             escape = FALSE,
             caption = "Shape and scale parameters for intervention and reference treatments from a common shape model",
             format = "html") 

Survival can then be estimated in Excel using the rate and shape parameters specific to each treatment with formula:

1 /(1+((time / scale)^shape))

This is equivalent to running the following code in R:

summary( flexsurvreg log-logistic model , type="survival", B=0, t=time)

Independent shape models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit one log-logistic model with a covariate for treatment on both the shape and scale parameters. The R code for the fitted model is as follows:

flexsurvreg(formula = Surv(Time, Event) ~ ARM + shape(ARM), data = data with a treatment variable named "ARM" , dist = "llogis")

This model outputs shape and scale parameters and a treatment coefficient for both shape and scale. Shape and scale parameters for each treatment are estimated in run_PSM as follows:

shape_calc <- c("Shape",
               "Shape parameter + treatment coefficient on shape",
               "Shape parameter"
                 )

scale_calc <- c("Scale",
               "Scale parameter + treatment coefficient on scale",
               "Scale parameter"
                 )


all.params <- rbind.data.frame(shape_calc, scale_calc)
knitr::kable(all.params, 
             col.names = c("Parameter",
                           "Intervention",
                           "Reference"
                           ),
             escape = FALSE,
             caption = "Shape and scale parameters for intervention and reference treatments from an independent shape model",
             format = "html") 

Survival can then be estimated in Excel using the rate and shape parameters specific to each treatment with formula:

1 /(1+((time / scale)^shape))

This is equivalent to running the following code in R:

summary( flexsurvreg log-logistic model , type="survival", B=0, t=time)

Log-normal

Separate models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit two log-normal models (one to data for the intervention treatment and one to data for the reference treatment). The R code for the fitted models is as follows:

flexsurvreg(formula = Surv(Time, Event)~1, data = data for intervention treatment , dist = "lnorm") flexsurvreg(formula = Surv(Time, Event)~1, data = data for reference treatment , dist = "lnorm")

Estimation of the meanlog and sdlog parameters from each of these models can be then used within the following Excel formula to estimate survival at different time points:

1-LOGNORMDIST(time, meanlog, sdlog))

This is equivalent to running the following code in R:

summary( flexsurvreg log-normal model , type="survival", B=0, t=time)

Common shape models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit one log-normal model with a covariate for treatment. The R code for the fitted model is as follows:

flexsurvreg(formula = Surv(Time, Event)~ARM, data = data with a treatment variable named "ARM" , dist = "lnorm")

This model outputs meanlog and sdlog parameters and a treatment coefficient. Shape and scale parameters for each treatment are estimated in run_PSM as follows:

meanlog_calc <- c("Meanlog",
               "Meanlog parameter + treatment coefficient",
               "Meanlog parameter"
                 )

sdlog_calc <- c("Sdlog",
               "Sdlog parameter",
               "Sdlog parameter"
                 )


all.params <- rbind.data.frame(meanlog_calc, sdlog_calc)
knitr::kable(all.params, 
             col.names = c("Parameter",
                           "Intervention",
                           "Reference"
                           ),
             escape = FALSE,
             caption = "Meanlog and sdlog parameters for intervention and reference treatments from a common shape model",
             format = "html") 

Survival can then be estimated in Excel using the meanlog and sdlog parameters specific to each treatment with formula:

1-LOGNORMDIST(time, meanlog, sdlog))

This is equivalent to running the following code in R:

summary( flexsurvreg log-normal model , type="survival", B=0, t=time)

Independent shape models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit one log-normal model with a covariate for treatment on both the meanlog and sdlog parameters. The R code for the fitted model is as follows:

flexsurvreg(formula = Surv(Time, Event==1) ~ ARM + sdlog(ARM), data = data with a treatment variable named "ARM" , dist = "lnorm")

This model outputs meanlog and sdlog parameters and a treatment coefficient for both meanlog and sdlog. Shape and scale parameters for each treatment are estimated in run_PSM as follows:

meanlog_calc <- c("Meanlog",
               "Meanlog parameter + treatment coefficient on meanlog",
               "Meanlog parameter"
                 )

sdlog_calc <- c("Sdlog",
               "Sdlog parameter + treatment coefficient on sdlog",
               "Sdlog parameter"
                 )


all.params <- rbind.data.frame(meanlog_calc, sdlog_calc)
knitr::kable(all.params, 
             col.names = c("Parameter",
                           "Intervention",
                           "Reference"
                           ),
             escape = FALSE,
             caption = "Meanlog and sdlog parameters for intervention and reference treatments from an independent shape model",
             format = "html") 

Survival can then be estimated in Excel using the meanlog and sdlog parameters specific to each treatment with formula:

1-LOGNORMDIST(time, meanlog, sdlog))

This is equivalent to running the following code in R:

summary( flexsurvreg log-normal model , type="survival", B=0, t=time)

Gamma

Separate models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit two gamma models (one to data for the intervention treatment and one to data for the reference treatment). The R code for the fitted models is as follows:

flexsurvreg(formula = Surv(Time, Event)~1, data = data for intervention treatment , dist = "gamma") flexsurvreg(formula = Surv(Time, Event)~1, data = data for reference treatment , dist = "gamma")

Estimation of the rate and shape parameters from each of these models can be then used within the following Excel formula to estimate survival at different time points:

1-GAMMA.DIST(time, shape, 1/(rate),TRUE)

This is equivalent to running the following code in R:

summary( flexsurvreg gamma model , type="survival", B=0, t=time)

Common shape models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit one gamma model with a covariate for treatment. The R code for the fitted model is as follows:

flexsurvreg(formula = Surv(Time, Event)~ARM, data = data with a treatment variable named "ARM" , dist = "gamma")

This model outputs rate and shape parameters and a treatment coefficient. Rate and shape parameters for each treatment are estimated in run_PSM as follows:

rate_calc <- c("Rate",
               "Rate parameter + treatment coefficient",
               "Rate parameter"
                 )

shape_calc <- c("Shape",
               "Shape parameter",
               "Shape parameter"
                 )


all.params <- rbind.data.frame(rate_calc, shape_calc)
knitr::kable(all.params, 
             col.names = c("Parameter",
                           "Intervention",
                           "Reference"
                           ),
             escape = FALSE,
             caption = "Rate and shape parameters for intervention and reference treatments from a common shape model",
             format = "html") 

Survival can then be estimated in Excel using the rate and shape parameters specific to each treatment with formula:

1-GAMMA.DIST(time, shape, 1/(rate),TRUE)

This is equivalent to running the following code in R:

summary( flexsurvreg gamma model , type="survival", B=0, t=time)

Independent shape models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit one gamma model with a covariate for treatment on both the rate and shape parameters. The R code for the fitted model is as follows:

flexsurvreg(formula = Surv(Time, Event) ~ ARM + shape(ARM), data = data with a treatment variable named "ARM" , dist = "gamma")

This model outputs rate and shape parameters and a treatment coefficient for both rate and shape. Rate and shape parameters for each treatment are estimated in run_PSM as follows:

rate_calc <- c("Rate",
               "Rate parameter + treatment coefficient on rate",
               "Rate parameter"
                 )

shape_calc <- c("Shape",
               "Shape parameter + treatment coeffecient on shape",
               "Shape parameter"
                 )

all.params <- rbind.data.frame(rate_calc, shape_calc)
knitr::kable(all.params, 
             col.names = c("Parameter",
                           "Intervention",
                           "Reference"
                           ),
             escape = FALSE,
             caption = "Rate and shape parameters for intervention and reference treatments from an independent shape model",
             format = "html") 

Survival can then be estimated in Excel using the rate and shape parameters specific to each treatment with formula:

1-GAMMA.DIST(time, shape, 1/(rate),TRUE)

This is equivalent to running the following code in R:

summary( flexsurvreg gamma model , type="survival", B=0, t=time)

Generalized gamma

Separate models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit two generalized gamma models (one to data for the intervention treatment and one to data for the reference treatment). The R code for the fitted models is as follows:

flexsurvreg(formula = Surv(Time, Event)~1, data = data for intervention treatment , dist = "gengamma") flexsurvreg(formula = Surv(Time, Event)~1, data = data for reference treatment , dist = "gengamma")

Estimation of the mu, sigma and Q parameters from each of these models can be then used within the following Excel formula to estimate survival at different time points:

IF(Q<0,GAMMADIST((-Q^-2) * EXP(-Q* -((LN(time)-(mu))/sigma)),-Q^-2,1,1),1-GAMMADIST((-Q^-2) * EXP(-Q * -((LN(time)-(mu))/sigma)),-Q^-2,1,1))

This is equivalent to running the following code in R:

summary( flexsurvreg Generalized Gamma model , type="survival", B=0, t=time)

Common shape models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit one Generalized Gamma model with a covariate for treatment. The R code for the fitted model is as follows:

flexsurvreg(formula = Surv(Time, Event)~ARM, data = data with a treatment variable named "ARM" , dist = "gengamma")

This model outputs mu, sigma and Q parameters and a treatment coefficient. Mu, sigma and Q parameters for each treatment are estimated in run_PSM as follows:

mu_calc <- c("mu",
             "mu coefficient + treatment coefficient",
             "mu coefficient"
                 )

sigma_calc <- c("Scale",
               "sigma coefficient",
               "sigma coefficient"
                 )

Q_calc <- c("Q",
            "Q coefficient",
            "Q coefficient"
                 )


all.params <- rbind.data.frame(mu_calc, sigma_calc, Q_calc)
knitr::kable(all.params, 
             col.names = c("Parameter",
                           "Intervention",
                           "Reference"
                           ),
             escape = FALSE,
             caption = "Mu, sigma and Q parameters for intervention and reference treatments from a common shape model",
             format = "html") 

Survival can then be estimated in Excel using the mu, sigma and Q parameters specific to each treatment with formula:

IF(Q<0,GAMMADIST((-Q^-2) * EXP(-Q* -((LN(time)-(mu))/sigma)),-Q^-2,1,1),1-GAMMADIST((-Q^-2) * EXP(-Q * -((LN(time)-(mu))/sigma)),-Q^-2,1,1))

This is equivalent to running the following code in R:

summary( flexsurvreg Generalized Gamma model , type="survival", B=0, t=time)

Independent shape models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit one Generalized Gamma model with a covariate for treatment on both the mu, sigma and Q parameters. The R code for the fitted model is as follows:

flexsurvreg(formula = Surv(Time, Event) ~ ARM + sigma(ARM) + Q(ARM), data = data with a treatment variable named "ARM" , dist = "gengamma")

This model outputs mu, sigma and Q parameters and a treatment coefficient for mu, sigma and Q. Parameters for each treatment are estimated in run_PSM as follows:

mu_calc <- c("mu",
             "mu coefficient + treatment coefficient for mu",
             "mu coefficient"
                 )

sigma_calc <- c("Scale",
               "sigma coefficient + treatment coefficient for sigma",
               "sigma coefficient"
                 )

Q_calc <- c("Q",
            "Q coefficient + treatment coefficient for Q",
            "Q coefficient"
                 )


all.params <- rbind.data.frame(mu_calc, sigma_calc, Q_calc)
knitr::kable(all.params, 
             col.names = c("Parameter",
                           "Intervention",
                           "Reference"
                           ),
             escape = FALSE,
             caption = "Mu, sigma and Q parameters for intervention and reference treatments from an independent shape model",
             format = "html") 

Survival can then be estimated in Excel using the mu, sigma and Q parameters specific to each treatment with formula:

IF(Q<0,GAMMADIST((-Q^-2) * EXP(-Q* -((LN(time)-(mu))/sigma)),-Q^-2,1,1),1-GAMMADIST((-Q^-2) * EXP(-Q * -((LN(time)-(mu))/sigma)),-Q^-2,1,1))

This is equivalent to running the following code in R:

summary( flexsurvreg Generalized Gamma model , type="survival", B=0, t=time)

Generalized F

Separate models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit two generalized F models (one to data for the intervention treatment and one to data for the reference treatment). The R code for the fitted models is as follows:

flexsurvreg(formula = Surv(Time, Event)~1, data = data for intervention treatment , dist = "genf") flexsurvreg(formula = Surv(Time, Event)~1, data = data for reference treatment , dist = "genf")

Estimation of the mu, sigma, Q and P parameters from each of these models can be then used within the following Excel formulas to estimate survival at different time points:

BETA.DIST(h_m2/(h_m2 + h_m1*time^(h_d/sigma)/EXP(h_d/sigma*mu)),h_m2,h_m1,TRUE)

This is equivalent to running the following code in R:

summary( flexsurvreg Generalized F model , type="survival", B=0, t=time)

Common shape models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit one Generalized F model with a covariate for treatment. The R code for the fitted model is as follows:

flexsurvreg(formula = Surv(Time, Event)~ARM, data = data with a treatment variable named "ARM" , dist = "genf")

This model outputs mu, sigma Q and P parameters and a treatment coefficient. Mu, sigma Q and P parameters for each treatment are estimated in run_PSM as follows:

mu_calc <- c("mu",
             "mu coefficient + treatment coefficient",
             "mu coefficient"
                 )

sigma_calc <- c("Sigma",
               "sigma coefficient",
               "sigma coefficient"
                 )

Q_calc <- c("Q",
            "Q coefficient",
            "Q coefficient"
                 )

P_calc <- c("P",
            "P coefficient",
            "P coefficient"
                 )

all.params <- rbind.data.frame(mu_calc, sigma_calc, Q_calc, P_calc)
knitr::kable(all.params, 
             col.names = c("Parameter",
                           "Intervention",
                           "Reference"
                           ),
             escape = FALSE,
             caption = "Mu, sigma, Q and P parameters for intervention and reference treatments from a common shape model",
             format = "html") 

Survival can then be estimated in Excel using the mu, sigma, Q and P parameters specific to each treatment with formula:

BETA.DIST(h_m2/(h_m2 + h_m1*time^(h_d/sigma)/EXP(h_d/sigma*mu)),h_m2,h_m1,TRUE)

This is equivalent to running the following code in R:

summary( flexsurvreg Generalized f model , type="survival", B=0, t=time)

Independent shape models

The run_PSM function in the flexsurvPlus package with the following arguments:

uses the flexsurv package to fit one Generalized F model with a covariate for treatment on both the mu, sigma, Q and P parameters. The R code for the fitted model is as follows:

flexsurvreg(formula = Surv(Time, Event) ~ ARM + sigma(ARM) + Q(ARM) + P(ARM), data = data with a treatment variable named "ARM" , dist = "genf")

This model outputs mu, sigma, Q and P parameters and a treatment coefficient for mu, sigma, Q and P. Parameters for each treatment are estimated in run_PSM as follows:

mu_calc <- c("mu",
             "mu coefficient + treatment coefficient for mu",
             "mu coefficient"
                 )

sigma_calc <- c("Scale",
               "sigma coefficient + treatment coefficient for sigma",
               "sigma coefficient"
                 )

Q_calc <- c("Q",
            "Q coefficient + treatment coefficient for Q",
            "Q coefficient"
                 )

P_calc <- c("P",
            "P coefficient + treatment coefficient for P",
            "P coefficient"
                 )


all.params <- rbind.data.frame(mu_calc, sigma_calc, Q_calc, P_calc)
knitr::kable(all.params, 
             col.names = c("Parameter",
                           "Intervention",
                           "Reference"
                           ),
             escape = FALSE,
             caption = "Mu, sigma, Q and P parameters for intervention and reference treatments from an independent shape model",
             format = "html") 

Survival can then be estimated in Excel using the mu, sigma, Q and P parameters specific to each treatment with formula:

BETA.DIST(h_m2/(h_m2 + h_m1*time^(h_d/sigma)/EXP(h_d/sigma*mu)),h_m2,h_m1,TRUE)

This is equivalent to running the following code in R:

summary( flexsurvreg Generalized F model , type="survival", B=0, t=time)

References



Roche/flexsurvPlus documentation built on May 8, 2023, 12:27 a.m.