library("gamlss2")
## see ?mcmcBayesian Sampler for GAMLSS Models
Description
The function BS() implements an MCMC sampler for generalized additive models for location, scale, and shape (GAMLSS) as fitted by gamlss2. The sampler uses Metropolis-Hastings updates for regression coefficients of linear and smooth terms.
Usage
BS(x, y, specials, family, offsets,
weights, start, xterms, sterms, control)
Arguments
x
|
The full model matrix to be used for fitting. |
y
|
The response vector or matrix. |
specials
|
A named list of special model terms, for example including design and penalty matrices for fitting smooth terms using smooth.construct.
|
family
|
A family object, see gamlss2.family.
|
offsets
|
If supplied, a list or data frame of model offsets. See gamlss2 for details on the offset interface.
|
weights
|
If supplied, a numeric vector of prior weights used in the fitting process. |
start
|
Starting values for the parameters of the response distribution. See the examples for gamlss2.
|
xterms
|
A named list specifying the linear model terms. Each named list element represents one parameter as specified in the family object. |
sterms
|
A named list specifying the special model terms. Each named list element represents one parameter as specified in the family object. |
control
|
Further control arguments as specified in the call to gamlss2.
|
Details
Function BS() is typically called via mcmc or via the wrapper function bamlss2. It implements a blocked Metropolis-Hastings sampler using working responses and working weights. Smooth terms are updated using penalized weighted least squares proposals and their smoothing variances are sampled using univariate slice sampling.
The function uses the following control arguments:
-
n.iter: integer, the total number of MCMC iterations; -
burnin: integer, the burn-in period; -
thinning: integer, the thinning parameter for saved samples; -
trace: logical, should information be printed while the sampler is running; -
flush: logical, whether to useflush.consoleto display current output in the console; -
nullmodel: logical, should an intercept-only null model be evaluated to compute a null deviance and deviance reduction?; -
binning: logical, should binning be used for smooth terms if available?
Value
A fitted model object containing posterior samples and summary information. Typically it includes:
-
samples: posterior draws for coefficients and smoothing variances; -
coefficients: posterior means of coefficients; -
fitted.values: posterior mean fitted values for each distributional parameter; -
edf: estimated degrees of freedom for smooth terms; -
logLik: log-likelihood at the posterior mean predictor.
References
Umlauf N, Klein N, Zeileis A (2018). BAMLSS: Bayesian Additive Models for Location, Scale and Shape (and Beyond). Journal of Computational and Graphical Statistics, 27(3), 612–627. doi:10.1080/10618600.2017.1407325
See Also
gamlss2, RS, CG, mcmc, bamlss2