Survspline  R Documentation 
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 collected
together in a single argument gamma
. For the equivalent functions with
one argument per parameter, see Survsplinek
.
dsurvspline(
x,
gamma,
beta = 0,
X = 0,
knots = c(10, 10),
scale = "hazard",
timescale = "log",
spline = "rp",
offset = 0,
log = FALSE
)
psurvspline(
q,
gamma,
beta = 0,
X = 0,
knots = c(10, 10),
scale = "hazard",
timescale = "log",
spline = "rp",
offset = 0,
lower.tail = TRUE,
log.p = FALSE
)
qsurvspline(
p,
gamma,
beta = 0,
X = 0,
knots = c(10, 10),
scale = "hazard",
timescale = "log",
spline = "rp",
offset = 0,
lower.tail = TRUE,
log.p = FALSE
)
rsurvspline(
n,
gamma,
beta = 0,
X = 0,
knots = c(10, 10),
scale = "hazard",
timescale = "log",
spline = "rp",
offset = 0
)
Hsurvspline(
x,
gamma,
beta = 0,
X = 0,
knots = c(10, 10),
scale = "hazard",
timescale = "log",
spline = "rp",
offset = 0
)
hsurvspline(
x,
gamma,
beta = 0,
X = 0,
knots = c(10, 10),
scale = "hazard",
timescale = "log",
spline = "rp",
offset = 0
)
rmst_survspline(
t,
gamma,
beta = 0,
X = 0,
knots = c(10, 10),
scale = "hazard",
timescale = "log",
spline = "rp",
offset = 0,
start = 0
)
mean_survspline(
gamma,
beta = 0,
X = 0,
knots = c(10, 10),
scale = "hazard",
timescale = "log",
spline = "rp",
offset = 0
)
x , q , t 
Vector of times. 
gamma 
Parameters describing the baseline spline function, as
described in 
beta 
Vector of covariate effects. Not supported and ignored since version 2.3, and this argument will be removed in 2.4. 
X 
Matrix of covariate values. Not supported and ignored since version 2.3, and this argument will be removed in 2.4. 
knots 
Locations of knots on the axis of log time, supplied in
increasing order. Unlike in This may in principle be supplied as a matrix, in the same way as for

scale 

timescale 

spline 

offset 
An extra constant to add to the linear predictor

log , log.p 
Return log density or probability. 
lower.tail 
logical; if TRUE (default), probabilities are 
p 
Vector of probabilities. 
n 
Number of random numbers to simulate. 
start 
Optional lefttruncation time or times. The returned restricted mean survival will be conditioned on survival up to this time. 
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 rootfinding involved in qsurvspline
, it is slow compared
to typical random number generation functions.
Christopher Jackson <chris.jackson@mrcbsu.cam.ac.uk>
Royston, P. and Parmar, M. (2002). Flexible parametric proportionalhazards and proportionalodds models for censored survival data, with application to prognostic modelling and estimation of treatment effects. Statistics in Medicine 21(1):21752197.
Wang W, Yan J (2021). ShapeRestricted Regression Splines with R Package splines2. Journal of Data Science, 19(3), 498517.
flexsurvspline
.
## reduces to the weibull
regscale < 0.786; cf < 1.82
a < 1/regscale; b < exp(cf)
dweibull(1, shape=a, scale=b)
dsurvspline(1, gamma=c(log(1 / b^a), a)) # should be the same
## reduces to the lognormal
meanlog < 1.52; sdlog < 1.11
dlnorm(1, meanlog, sdlog)
dsurvspline(1, gamma = c(meanlog/sdlog, 1/sdlog), scale="normal")
# should be the same
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.