Survspline: Royston/Parmar spline survival distribution In flexsurv: Flexible Parametric Survival and Multi-State Models

Description

Probability density, distribution, quantile, random generation, hazard, cumulative hazard, mean and restricted mean functions for the Royston/Parmar spline model. These functions have all parameters of the distribution collecte together in a single argument gamma. For the equivalent functions with one argument per parameter, see Survsplinek.

Usage

 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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 dsurvspline( x, gamma, beta = 0, X = 0, knots = c(-10, 10), scale = "hazard", timescale = "log", offset = 0, log = FALSE ) psurvspline( q, gamma, beta = 0, X = 0, knots = c(-10, 10), scale = "hazard", timescale = "log", offset = 0, lower.tail = TRUE, log.p = FALSE ) qsurvspline( p, gamma, beta = 0, X = 0, knots = c(-10, 10), scale = "hazard", timescale = "log", offset = 0, lower.tail = TRUE, log.p = FALSE ) rsurvspline( n, gamma, beta = 0, X = 0, knots = c(-10, 10), scale = "hazard", timescale = "log", offset = 0 ) Hsurvspline( x, gamma, beta = 0, X = 0, knots = c(-10, 10), scale = "hazard", timescale = "log", offset = 0 ) hsurvspline( x, gamma, beta = 0, X = 0, knots = c(-10, 10), scale = "hazard", timescale = "log", offset = 0 ) rmst_survspline( t, gamma, beta = 0, X = 0, knots = c(-10, 10), scale = "hazard", timescale = "log", offset = 0, start = 0 ) mean_survspline( gamma, beta = 0, X = 0, knots = c(-10, 10), scale = "hazard", timescale = "log", offset = 0 )

Arguments

 x, q, t Vector of times. gamma Parameters describing the baseline spline function, as described in 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. beta Vector of covariate effects (deprecated). X Matrix of covariate values (deprecated). knots Locations of knots on the axis of log time, supplied in increasing order. Unlike in flexsurvspline, these include the two boundary knots. If there are no additional knots, the boundary locations are not used. If there are one or more additional knots, the boundary knots should be at or beyond the minimum and maximum values of the log times. In flexsurvspline these are exactly at the minimum and maximum values. This may in principle be supplied as a matrix, in the same way as for gamma, but in most applications the knots will be fixed. scale "hazard", "odds", or "normal", as described in 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. timescale "log" or "identity" as described in flexsurvspline. offset An extra constant to add to the linear predictor eta. log, log.p Return log density or probability. lower.tail logical; if TRUE (default), probabilities are P(X <= x), otherwise, P(X > x). p Vector of probabilities. n Number of random numbers to simulate. start Optional left-truncation time or times. The returned restricted mean survival will be conditioned on survival up to this time.

Value

dsurvspline gives the density, psurvspline gives the distribution function, hsurvspline gives the hazard and Hsurvspline gives the cumulative hazard, as described in flexsurvspline.

qsurvspline gives the quantile function, which is computed by crude numerical inversion (using qgeneric).

rsurvspline generates random survival times by using qsurvspline on a sample of uniform random numbers. Due to the numerical root-finding involved in qsurvspline, it is slow compared to typical random number generation functions.

Author(s)

Christopher Jackson <chris.jackson@mrc-bsu.cam.ac.uk>

References

Royston, P. and Parmar, M. (2002). Flexible parametric proportional-hazards and proportional-odds models for censored survival data, with application to prognostic modelling and estimation of treatment effects. Statistics in Medicine 21(1):2175-2197.