Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

MVNORM

Create Samples for BAMLSS by Multivariate Normal Approximation


Description

This sampler function for BAMLSS uses estimated parameters and the Hessian information to create samples from a multivariate normal distribution. Note that smoothing variance uncertainty is not accounted for, therefore, the resulting credible intervals are most likely too narrow.

Usage

sam_MVNORM(x, y = NULL, family = NULL, start = NULL,
  n.samples = 500, hessian = NULL, ...)

MVNORM(x, y = NULL, family = NULL, start = NULL,
  n.samples = 500, hessian = NULL, ...)

Arguments

x

The x list, as returned from function bamlss.frame, holding all model matrices and other information that is used for fitting the model. Or an object returned from function bamlss.

y

The model response, as returned from function bamlss.frame.

family

A bamlss family object, see family.bamlss.

start

A named numeric vector containing possible starting values, the names are based on function parameters.

n.samples

Sets the number of samples that should be generated.

hessian

The Hessian matrix that should be used. Note that the row and column names must be the same as the names of the parameters. If hessian = NULL the function uses optim to compute the Hessian if it is not provided within x.

...

Arguments passed to function optim.

Value

Function MVNORM() returns samples of parameters. The samples are provided as a mcmc matrix.

See Also

Examples

## Simulated data example illustrating
## how to call the sampler function.
## This is done internally within
## the setup of function bamlss().
d <- GAMart()
f <- num ~ s(x1, bs = "ps")
bf <- bamlss.frame(f, data = d, family = "gaussian")

## First, find starting values with optimizer.
o <- with(bf, opt_bfit(x, y, family))

## Sample.
samps <- with(bf, sam_MVNORM(x, y, family, start = o$parameters))
plot(samps)

bamlss

Bayesian Additive Models for Location, Scale, and Shape (and Beyond)

v1.1-3
GPL-2 | GPL-3
Authors
Nikolaus Umlauf [aut, cre] (<https://orcid.org/0000-0003-2160-9803>), Nadja Klein [aut] (<https://orcid.org/0000-0002-5072-5347>), Achim Zeileis [aut] (<https://orcid.org/0000-0003-0918-3766>), Meike Koehler [ctb], Thorsten Simon [aut] (<https://orcid.org/0000-0002-3778-7738>), Stanislaus Stadlmann [ctb]
Initial release
2021-01-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.