This function provides Markov chain Monte Carlo [MCMC] methods for fitting Tweedie compound Poisson linear models within the Bayesian framework. Both generalized linear models and mixed models can be handled. In computing the posterior distribution, the series evaluation method (see, e.g., dtweedie
) is employed to evaluate the compound Poisson density.
In the Bayesian model, prior distributions have to be specified for all parameters in the model. Here, Normal distributions are used for the fixed effects (\(\beta\)), a Uniform distribution for the dispersion parameter (\(\phi\)), a Uniform distribution for the index parameter (\(p\)). If a mixed model is specified, prior distributions must be specified for the variance component. If there is one random effect in a group, the inverse Gamma (scale = 0.001
, shape = 0.001
) is specified as the prior. If there is more than one random effects in a group, the inverse Wishart (identity matrix as the scale and the dimension of the covariance matrix as the shape) is specified as the prior.
Prior means and variances of the fixed effects can be supplied using the argument prior.beta.mean
and prior.beta.var
, respectively. The prior distribution of \(\phi\) is uniform on (0, bound.phi
). And the bounds of the Uniform for \(p\) can be specified in the argument bound.p
. See details in section 'Arguments'.
In implementing the MCMC, a Gibbs sampler is constructed in which parameters are updated one at a time given the current values of all the other parameters. Specifically, we use the random-walk Metropolis-Hastings algorithm in updating each parameter except for the variance components, which can be simulated directly due to conjugacy.
Before the MCMC, there is a tuning process where the proposal variances of the (truncated) Normal proposal distributions are updated according to the sample variances computed from the simulations in each tuning loop. The goal is to make the acceptance rate roughly between 40% and 60% for univariate M-H updates. The argument tune.iter
determines how many iterations are used for the tuning process, and n.tune
determines how many loops these iterations should be divided into. These iterations will not be used in the final output.
The simulated values of all model parameters are stored in the sims.list
slot of the returned bcplm
object. It is a list of n.chains
matrices and each matrix has approximately n.sims
rows. The sims.list
slot is further coerced to be of class "mcmc.list"
so that various methods from the coda
package can be directly applied to get Markov chain diagnostics, posterior summary and plots. See coda
for available methods.