sam_Cox | R Documentation |
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, ...)
x |
The |
y |
The model response, as returned from function |
family |
A bamlss family object, see |
start |
A named numeric vector containing possible starting values, the names are based on
function |
weights |
Prior weights on the data, as returned from function |
offset |
Can be used to supply model offsets for use in fitting,
returned from function |
n.iter |
Sets the number of MCMC iterations. |
burnin |
Sets the burn-in phase of the sampler, i.e., the number of starting samples that should be removed. |
thin |
Defines the thinning parameter for MCMC simulation. E.g., |
verbose |
Print information during runtime of the algorithm. |
digits |
Set the digits for printing when |
step |
How many times should algorithm runtime information be printed, divides |
... |
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.
The function returns samples of parameters. The samples are provided as a
mcmc
matrix.
Umlauf N, Klein N, Zeileis A (2016). Bayesian Additive Models for Location Scale and Shape (and Beyond). (to appear)
opt_Cox
, cox_bamlss
, surv_transform
,
simSurv
, bamlss
## Not run: 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)
## Plot estimated effects.
plot(b)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.