Calculates the restricted mean duration, given the form of a parametric distribution of Royston-Parmar splines
Arguments
- Tw
is the time horizon (weeks) over which the mean should be calculated.
- type
is either "par" for regular parametric form (exponential, weibull etc) or "spl" for Royston-Parmar splines.
- spec
is a list comprising: If type=="par":
distis the statistical distribution (named per flexsurv::flexsurvreg) andparsis a vector of the parameters for that distribution.Exponential distribution (
exp) requires the rate parameter.Weibull distribution (both
weibullPHandweibullformulations) requires the shape and scale parameters.Log-logistic distribution (
llogis) requires the shape and scale parameters.Log-normal distribution (
lnorm) requires the meanlog and sdlog parameters.Gamma and Gompertz distributions (
gammaandgompertz) require the shape and rate parameters.Generalized Gamma requires the mu, sigma and Q parameters if using the standard parameterization (
gengamma) or shape, scale and k parameters if using the original parameterization (gengamma.orig). If type=="spl":gamma- Vector of parameters describing the baseline spline function, as described in flexsurv::flexsurvspline. This may be supplied as a vector with number of elements equal to the length of knots, in which case the parameters are common to all times. Alternatively a matrix may be supplied, with rows corresponding to different times, and columns corresponding to knots.knots- Vector of locations of knots on the axis of log time, supplied in increasing order. Unlike in flexsurv::flexsurvspline, these include the two boundary knots.scale- Either "hazard", "odds", or "normal", as described in flexsurv::flexsurvspline. With the default of no knots in addition to the boundaries, this model reduces to the Weibull, log-logistic and log-normal respectively. The scale must be common to all times.
- survobj
is a survival fit object from flexsurv::flexsurvspline or flexsurv::flexsurvreg
