MCMCpoisson(formula, data = list(), burnin = 1000, mcmc = 10000,
thin = 5, tune = 1.1, verbose = FALSE, seed = 0, beta.start = NA,
b0 = 0, B0 = 0.001, ...)
MCMCpoisson
simulates from the posterior density of a Poisson
regression model using a random walk Metropolis algorithm. The simulation
proper is done in compiled C++ code to maximize efficiency. Please consult
the coda documentation for a comprehensive list of functions that can be
used to analyze the posterior density sample.
The model takes the following form:
$$y_i \sim \mathcal{P}oisson(\mu_i)$$
Where the inverse link function:
$$\mu_i = \exp(x_i'\beta)$$
We assume a multivariate Normal prior on $\beta$:
$$\beta \sim \mathcal{N}(b_0,B_0^{-1})$$
The candidate generating density is a multivariate Normal density centered
at the current value of $\beta$ with variance-covariance matrix
that is an approximation of the posterior based on the maximum likelihood
estimates and the prior precision multiplied by the tuning parameter
squared.plot.mcmc
,summary.mcmc
, glm
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
posterior <- MCMCpoisson(counts ~ outcome + treatment)
plot(posterior)
summary(posterior)
Run the code above in your browser using DataLab