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.
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, ...)
The model response, as returned from function
A bamlss family object, see
A named numeric vector containing possible starting values, the names are based on
Sets the number of samples that should be generated.
The Hessian matrix that should be used. Note that the row and column names
must be the same as the names of the
Arguments passed to function
MVNORM() returns samples of parameters. The samples are provided as a
## 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))#> AICc 310.9125 logPost -146.281 logLik -148.601 edf 6.7482 eps 2.4418 iteration 1 #> AICc 310.7117 logPost -146.181 logLik -148.501 edf 6.7482 eps 0.0062 iteration 2 #> AICc 310.7116 logPost -146.181 logLik -148.501 edf 6.7482 eps 0.0000 iteration 3 #> AICc 310.7116 logPost -146.181 logLik -148.501 edf 6.7482 eps 0.0000 iteration 3 #> elapsed time: 0.40sec## Sample. samps <- with(bf, sam_MVNORM(x, y, family, start = o$parameters))#>plot(samps)