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.

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, bfit(x, y, family))
#> AICc 310.9125 logPost -146.281 logLik -148.601 edf 6.7482 eps 2.4418 iteration 1 #> AICc 308.4063 logPost -135.263 logLik -148.941 edf 5.1966 eps 0.1422 iteration 2 #> AICc 306.2649 logPost -126.116 logLik -149.144 edf 3.9490 eps 0.0221 iteration 3 #> AICc 305.0141 logPost -136.724 logLik -149.282 edf 3.1979 eps 0.0667 iteration 4 #> AICc 304.8739 logPost -172.796 logLik -149.351 edf 3.0608 eps 0.0184 iteration 5 #> AICc 304.8739 logPost -172.796 logLik -149.351 edf 3.0608 eps 0.0000 iteration 6 #> AICc 304.8739 logPost -172.796 logLik -149.351 edf 3.0608 eps 0.0000 iteration 6 #> elapsed time: 0.47sec
## Sample. samps <- with(bf, MVNORM(x, y, family, start = o$parameters))
#>
plot(samps)