## Sampler function:
GMCMC(x, y, family, start = NULL, weights = NULL, offset = NULL,
n.iter = 1200, burnin = 200, thin = 1, verbose = TRUE,
step = 20, propose = "iwlsC_gp", chains = NULL, ...)## Propose functions:
GMCMC_iwls(family, theta, id, eta, y, data,
weights = NULL, offset = NULL, ...)
GMCMC_iwlsC(family, theta, id, eta, y, data,
weights = NULL, offset = NULL, zworking, resids, rho, ...)
GMCMC_iwlsC_gp(family, theta, id, eta, y, data,
weights = NULL, offset = NULL, zworking, resids, rho, ...)
GMCMC_slice(family, theta, id, eta, y, data, ...)
bfit()
the x
list, as returned from function
bamlss.frame
, holding all model matrices and other information that is used for
fitting the model. For the updating functions an object as returned from function
smooth.construct
or smoothCon
.bamlss.frame
.family.bamlss
.parameters
.bamlss.frame
.bamlss.frame
.thin = 10
means,
that only every 10th sampled parameter will be stored.n.iter
.s(x)
in the model
formula. Per default this is set to "iwlsC"
, a character pointing to the set of propose
functions, see above. Other options are "iwls"
and "slice"
, however, this is
more experimental and should not be set by the user. Another option is to pass a full propose
function which should be used for each model term, the structure of propose functions is
described in the details below. Model terms may also have different propose functions, see
the example section.gaussian_bamlss
family object
theta[["mu"]][["s(x)"]]
extracts the current state of a model term "s(x)"
of the "mu"
parameter. Extraction is done with the id
argument.family.bamlss
. E.g., when using the gaussian_bamlss
family
object, the current values for the mean can be extracted by eta\$mu
and for the
standard deviation by eta\$sigma
.smooth.construct
or smoothCon
. The object is
preprocessed by function bamlss.engine.setup
.length(y)
, only for internal usage.length(y)
, only for internal usage.bamlss.engine.setup
and to the
propose functions.mcmc
matrix.
If chains > 1
, the samples are provided as a mcmc.list
.GMCMC()
cycles through all distributional parameters and corresponding
model terms in each iteration of the MCMC chain. Samples of the parameters of a model term (e.g.,
s(x)
) are generated by proposal functions, e.g. GMCMC_iwls()
. The default proposal function that should be used for all model terms is set with argument
propose
. For smooth terms, e.g. terms created with function s
, if
a valid propose function is supplied within the extra xt
list, this propose function will
be used. This way each model term may have its own propose function for creating samples
of the parameters. See the example section. The default proposal function GMCMC_iwlsC_gp
allows for general priors for the
smoothing variances and general penalty functions. Samples of smoothing variances are computed
using slice sampling. Function GMCMC_iwlsC
samples smoothing variances of univariate terms
assuming an inverse gamma prior. Terms of higher dimensions use again slice sampling for creating
samples of smoothing variances. Function GMCMC_iwls
is similar to function GMCMC_iwlsC
but uses plain R code. Function GMCMC_slice
applies slice sampling also for the regression coefficients and
is therefore relatively slow.bamlss
, bamlss.frame
,
bamlss.engine.setup
, set.starting.values
, s2
## Not run: ------------------------------------
# ## 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.
# opt <- with(bf, bfit(x, y, family))
#
# ## Sample.
# samps <- with(bf, GMCMC(x, y, family, start = opt$parameters))
# plot(samps)
## ---------------------------------------------
Run the code above in your browser using DataLab