cox.mcmc.Rd
This sampler function implements a derivative based MCMC algorithm for flexible Cox models with structured additive predictors.
sam_Cox(x, y, family, start, weights, offset,
n.iter = 1200, burnin = 200, thin = 1,
verbose = TRUE, digits = 4, step = 20, ...)
cox_mcmc(x, y, family, start, weights, offset,
n.iter = 1200, burnin = 200, thin = 1,
verbose = TRUE, digits = 4, step = 20, ...)
The x
list, as returned from function
bamlss.frame
and transformed by function surv_transform
,
holding all model matrices and other information that is used for
fitting the model.
The model response, as returned from function bamlss.frame
.
A bamlss family object, see family.bamlss
.
In this case this is the cox_bamlss
family object.
A named numeric vector containing possible starting values, the names are based on
function parameters
.
Prior weights on the data, as returned from function bamlss.frame
.
Can be used to supply model offsets for use in fitting,
returned from function bamlss.frame
.
Sets the number of MCMC iterations.
Sets the burn-in phase of the sampler, i.e., the number of starting samples that should be removed.
Defines the thinning parameter for MCMC simulation. E.g., thin = 10
means,
that only every 10th sampled parameter will be stored.
Print information during runtime of the algorithm.
Set the digits for printing when verbose = TRUE
.
How many times should algorithm runtime information be printed, divides n.iter
.
Currently not used.
The sampler uses derivative based proposal functions to create samples of parameters.
For time-dependent functions the proposals are based on one Newton-Raphson iteration centered
at the last state, while for the time-constant functions proposals can be based
on iteratively reweighted least squares (IWLS), see also function GMCMC
.
The integrals that are part of the time-dependent function updates are solved numerically.
In addition, smoothing variances are sampled using slice sampling.
Umlauf N, Klein N, Zeileis A (2016). Bayesian Additive Models for Location Scale and Shape (and Beyond). (to appear)
if (FALSE) library("survival")
set.seed(123)
## Simulate survival data.
d <- simSurv(n = 500)
## Formula of the survival model, note
## that the baseline is given in the first formula by s(time).
f <- list(
Surv(time, event) ~ s(time) + s(time, by = x3),
gamma ~ s(x1) + s(x2)
)
## Cox model with continuous time.
## Note the the family object cox_bamlss() sets
## the default optimizer and sampler function!
## First, posterior mode estimates are computed
## using function opt_Cox(), afterwards the
## sampler sam_Cox() is started.
b <- bamlss(f, family = "cox", data = d)
#> Error in Surv(time, event): could not find function "Surv"
## Plot estimated effects.
plot(b)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'plot': object 'b' not found