dmspline | R Documentation |
Density, distribution, quantile, hazard, cumulative hazard, and restricted mean survival time functions for the M-spline baseline hazards model.
dmspline(x, basis, scoef, rate, log = FALSE)
pmspline(q, basis, scoef, rate, lower.tail = TRUE, log.p = FALSE)
qmspline(p, basis, scoef, rate, lower.tail = TRUE, log.p = FALSE)
hmspline(x, basis, scoef, rate, log = FALSE)
Hmspline(x, basis, scoef, rate, log = FALSE)
rmst_mspline(t, basis, scoef, rate, start = 0)
x , q |
Vector of quantiles |
basis |
M-spline basis produced by |
scoef |
Vector (or matrix) of spline coefficients with length (or number
of columns) equal to the dimension of |
rate |
Vector of rate parameters |
log , log.p |
Logical; if |
lower.tail |
Logical; if |
p |
Vector of probabilities |
t |
Vector of times to which the restricted mean survival time is calculated |
start |
Optional left-truncation time or times. The returned restricted mean survival will be conditioned on survival up to this time |
Survival models with a flexible M-spline on the baseline hazard are described by \insertCiteBrilleman2020;textualmultinma. Piecewise-exponential baseline hazards are a special case where the degree of the M-spline polynomial is 0.
The d/p/h/H functions are calculated from their definitions. qmspline()
uses numerical inversion via flexsurv::qgeneric()
. rmst_mspline()
uses
numerical integration via flexsurv::rmst_generic()
, except for the
special case of the piecewise-exponential hazard (i.e. degree 0 M-splines)
which uses the explicit formula from
\insertCiteRoyston2013;textualmultinma.
Beyond the boundary knots, the hazard is assumed to be constant. (This
differs from the approach in splines2::mSpline()
that extrapolates the
polynomial basis functions, which is numerically unstable and highly
dependent on the data just before the boundary knots.) As with all
extrapolation, care should be taken when evaluating the splines at times
beyond the boundary knots (either directly through the d/p/h/H/rmst
functions, or indirectly by requesting quantiles with qmspline()
that
correspond to times beyond the boundary knots). For this reason evaluating
the (unrestricted) mean survival time is not generally recommended as this
requires integrating over an infinite time horizon (i.e. rmst_mspline()
with t = Inf
).
dmspline()
gives the density, pmspline()
gives the distribution
function (CDF), qmspline()
gives the quantile function (inverse-CDF),
hmspline()
gives the hazard function, Hmspline()
gives the cumulative
hazard function, and rmst_mspline()
gives restricted mean survival times.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.