splinesurv: Bayesian survival analysis with B-spline baseline hazard and...

Description Usage Arguments Value References See Also Examples

Description

Allows the fitting of proportional hazards survival models to possibly clustered data using Bayesian methods. The function follows a MCMC method to sample from the posterior distribution of the regression parameters, frailties, and parameters specifying the hazard and frailty distribution.

The baseline hazard and random effects density are modeled as convex combinations of a parametric component (for example, a gamma frailty, or a weibull baseline hazard) and a nonparametric component modeled as a penalized B-splines, with the penalty depending on either the integrated squared second derivative of the curve, or the sum of squared second differences in the spline parameters.

Usage

1
2
3
4
## S3 method for class 'formula'
splinesurv(formula, data = parent.frame(), verbose = 3,
           hazard = NULL, frailty = NULL, control = NULL, coda = FALSE, 
           initial = NULL, usec = TRUE, ...)

Arguments

formula

a formula object, similar to coxph. The response to the left of the ~ should be a survival object generated by Surv. The right side may contain a cluster(x) term if x is the variable that indicates cluster membership.

data

a data.frame with columns corresponding to the terms in the formula.

verbose

an integer from 0 to 5 that determines the quantity of output printed to the screen. Setting verbose=0 is completely silent.

hazard

a list containing parameters defining the baseline hazard, with the following optional components. For any component that is not set, the default is used.

type

a string that determines whether the hazard is parametric, nonparametric, or has both components. Takes on values "spline", "parametric" or "both", with "spline" as default.

spline.adaptive

logical, determines whether adaptive knot selection should be used. Defaults to TRUE.

spline.ord

an integer greater than 1, giving the order of the spline defining the baseline hazard. Defaults to spline.ord=4, corresponding to cubic B-splines.

spline.nknots

an integer giving the number of interior knots used in the baseline hazard spline. If NULL, the number of knots is chosen automatically, which is the default. If spline.adaptive=TRUE, this only serves as the initial number of knots.

spline.nknots.prior

a string specifying the type of prior on the number of knots to use. Options are "poisson", "geometric", "poissonmix", "negbin" and "power".

spline.nknots.hyper

the parameter(s) for the prior on the number of knots. For the Poisson prior, the mean, for the Geometric, the probability, for the Poisson-mixture, two means, and for the Power prior, the exponent.

spline.knotspacing

string that determines the way that knots are automatically chosen, if applicable. Possible values are "quantile" to place knots at quantiles of observed event times, or "equal" to equally space knots over the range of observed times. Defaults to "equal". If spline.adaptive=TRUE, this affects selection of candidate knot positions.

spline.knots

a vector of length spline.nknots+2*spline.ord-2 giving the positions of all the knots used in the baseline hazard spline (including boundary knots). If NULL, knots are chosen automatically. Defaults to NULL.

spline.penalty

a string giving the type of penalty to be used for the baseline hazard splines. Possible values are "none" for a standard Gaussian prior (default), "2diff", for a penalty on the second differences, or "2deriv" for a penalty on the integrated squared second derivative.

spline.hyper

a vector of length 2, containing hyperparameters for the spline weights. These control the smoothness of the spline when spline.adaptive=FALSE. Defaults to c(0.01,0.01).

param.dist

a string giving the desired parametric form of the hazard. Currently supported are "exponential" and "weibull".

...

other parameters can be set as well, including tuning parameters, prior variances, hyperparameters, initial values for weights, etc, but this should not be attempted by someone unfamiliar with the source code.

frailty

a list containing parameters defining the frailty density, analogous to hazard, except for the following differences:

param.dist

a string giving the desired parametric form of the frailty. Currently supported are "gamma" and "lognormal".

control

a list containing control parameters for the MCMC and optimization, with the following optional components. For any component that is not set, the default is used.

burnin

an integer giving the number of iterations discarded as burn-in. Default is burnin=500.

maxiter

an integer giving the total number of MCMC iterations, must be greater than burnin. Default is maxiter=1000.

thin

an integer giving the number of iterations to be discarded between every recorded iteration. That is, if iter=10, a total of maxiter*thin iterations will be run, but only maxiter will be recorded.

tun.auto

logical, determines whether to adaptively calibrate the tuning parameters during the burn-in period to achieve an acceptance rate of 0.25. Defaults to TRUE.

tun.int

an integer giving the interval in iterations between calibration of the tuning parameters, if tun.auto=TRUE. Default is 100.

initial

a list containing initial values for the chain. Not implemented and currently ignored.

coda

a logical variable indicating whether the coda package should be used to return the parameter history as mcmc objects. Defaults to FALSE.

usec

a logical variable, determines whether fast C code should be used. Defaults to TRUE, and should only be set to FALSE for debugging.

...

additional parameters (currently ignored).

Value

An object of class splinesurv, with the following components

call

the original call to the model-fitting function

posterior.mean

a list containing the posterior means of all parameters, with the following components

coefficients

regression coefficients

frailty

frailty estimates

hazard.spline.par

parameters defining the spline component (if applicable)

hazard.param.par

parameters defining the parametric component (if applicable)

hazard.weight

weight of the spline component (if applicable)

frailty.spline.par

parameters defining the spline component (if applicable)

frailty.param.par

parameters defining the parametric component (if applicable)

frailty.weight

weight of the spline component (if applicable)

history

a list containing the parameter history of the MCMC iterations, with the following components, either as matrices or vectors of length maxiter:

frailty

matrix of frailty estimates at each iteration.

coefficients

matrix of regression parameter estimates at each iteration.

hazard.spline.par

matrix of parameters defining the baseline hazard spline.

hazard.spline.knots

matrix of knots defining the baseline hazard spline.

frailty.spline.par

matrix of parameters defining the frailty density spline.

frailty.spline.knots

matrix of knots defining the frailty density spline.

frailty.spline.fvar

vector of estimated variances of the frailty density spline.

priorvar

matrix of prior variance parameters for the regression parameters, hazard spline, frailty density spline, hazard parameters, frailty parameters, hazard weight, frailty weight, in that order.

accept

binary vectors of Metropolis-Hastings acceptance indicators for the regression parameters, hazard spline, frailty density spline, hazard parameters, frailty parameters, hazard weight, frailty weight, and frailties respectively.

If in the input, coda=TRUE, then the returned objects are of class mcmc instead of matrix.

frailty

a list analogous to frailty in the input, additionally containing the number and placement of knots, if not specified in the input

hazard

a list analogous to hazard in the input, additionally containing the number and placement of knots, if not specified in the input

control

a list analogous to control in the input, containing the control parameters used in the procedure, even those not set explicitly in the call.

References

E. Sharef, R. Strawderman, D. Ruppert, M. Cowen, and L. Halasyamani, “Bayesian adaptive B-spline estimation in proportional hazards frailty models”, Electron. J. Statist. Volume 4 (2010), 606-642

See Also

summary.splinesurv, plot.splinesurv, coxph

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
    ## Generate a small survival data set:
    s <- sim.sample(m = 10, Ji = rep(10, 10))
    agdata <- s$agdata
    
    ## Run a (very) short MCMC chain
    fit <- splinesurv(Surv(time, delta) ~ Z + cluster(i), data = agdata, control = list(maxiter = 50, burnin = 25))
    
    ## Run another chain,  with a Weibull hazard and linear B-spline frailties
    # with fixed knots.
    fit2 <- splinesurv(Surv(time, delta) ~ Z + cluster(i), data = agdata, control = list(maxiter = 50, burnin = 25), hazard = list(type = "parametric", param.dist = "weibull"), frailty = list(type = "spline", spline.ord = 2, spline.adaptive = FALSE))
    ## View summaries and plots of the fits
    summary(fit)
    plot(fit, "all")
    summary(fit2)
    plot(fit2, "all")

splinesurv documentation built on May 2, 2019, 4:57 p.m.