coef.bamlss
Extract BAMLSS Coefficients
Methods to extract coefficients of fitted bamlss
objects, either coefficients
returned from optimizer functions, or samples from a sampler functions.
Method confint.bamlss()
produces credible intervals or parameter samples
using quantiles.
- Keywords
- models, regression
Usage
# S3 method for bamlss
coef(object, model = NULL, term = NULL,
FUN = NULL, parameters = NULL,
pterms = TRUE, sterms = TRUE,
hyper.parameters = TRUE, list = FALSE,
full.names = TRUE, rescale = FALSE, ...)# S3 method for bamlss
confint(object, parm, level = 0.95,
model = NULL, pterms = TRUE, sterms = FALSE,
full.names = FALSE, hyper.parameters = FALSE, ...)
Arguments
- object
An object of class
"bamlss"
- model
Character or integer. For which model should coefficients be extracted?
- term
Character or integer. For which term should coefficients be extracted?
- FUN
A function that is applied on the parameter samples.
- parameters
If is set to
TRUE
, additionally adds estimated parameters returned from an optimizer function (if available).- pterms
Should coefficients of parametric terms be included?
- sterms
Should coefficients of smooths terms be included?
- hyper.parameters
For smooth terms, should hyper parameters such as smoothing variances be included?
- list
Should the returned object have a list structure for each distribution parameter?
- full.names
Should full names be assigned, indicating whether a term is parametric "p" or smooth "s".
- rescale
Should parameters of the linear parts be rescaled if the
scale.d
argument inbamlss.frame
is set toTRUE
.- parm
Character or integer. For which term should coefficients intervals be extracted?
- level
The credible level which defines the lower and upper quantiles that should be computed from the samples.
- …
Arguments to be passed to
FUN
and functionsamples
.
Value
Depending on argument list
and the number of distributional parameters, either a
list
or vector/matrix of model coefficients.
See Also
Examples
# NOT RUN {
## Simulate data.
d <- GAMart()
## Model formula.
f <- list(
num ~ s(x1) + s(x2) + s(x3),
sigma ~ s(x1) + s(x2) + s(x3)
)
## Estimate model.
b <- bamlss(f, data = d)
## Extract coefficients based on MCMC samples.
coef(b)
## Now only the mean.
coef(b, FUN = mean)
## As list without the full names.
coef(b, FUN = mean, list = TRUE, full.names = FALSE)
## Coefficients only for "mu".
coef(b, model = "mu")
## And "s(x2)".
coef(b, model = "mu", term = "s(x2)")
## With optimizer parameters.
coef(b, model = "mu", term = "s(x2)", parameters = TRUE)
## Only parameteric part.
coef(b, sterms = FALSE, hyper.parameters = FALSE)
## For sigma.
coef(b, model = "sigma", sterms = FALSE,
hyper.parameters = FALSE)
## 95 perc. credible interval based on samples.
confint(b)
# }