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.

# 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 in bamlss.frame is set to TRUE.

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 function samples.

Value

Depending on argument list and the number of distributional parameters, either a

list or vector/matrix of model coefficients.

See also

Examples

if (FALSE) ## 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)
#> Error in eval(expr, envir, enclos): object 'd' not found

## Extract coefficients based on MCMC samples.
coef(b)
#> Error in eval(expr, envir, enclos): object 'b' not found

## Now only the mean.
coef(b, FUN = mean)
#> Error in eval(expr, envir, enclos): object 'b' not found

## As list without the full names.
coef(b, FUN = mean, list = TRUE, full.names = FALSE)
#> Error in eval(expr, envir, enclos): object 'b' not found

## Coefficients only for "mu".
coef(b, model = "mu")
#> Error in eval(expr, envir, enclos): object 'b' not found

## And "s(x2)".
coef(b, model = "mu", term = "s(x2)")
#> Error in eval(expr, envir, enclos): object 'b' not found

## With optimizer parameters.
coef(b, model = "mu", term = "s(x2)", parameters = TRUE)
#> Error in eval(expr, envir, enclos): object 'b' not found

## Only parameteric part.
coef(b, sterms = FALSE, hyper.parameters = FALSE)
#> Error in eval(expr, envir, enclos): object 'b' not found

## For sigma.
coef(b, model = "sigma", sterms = FALSE,
  hyper.parameters = FALSE)
#> Error in eval(expr, envir, enclos): object 'b' not found

## 95 perc. credible interval based on samples.
confint(b)
#> Error in eval(expr, envir, enclos): object 'b' not found