MCMClogit(formula, data = list(), burnin = 1000, mcmc = 10000,
thin=5, tune=1.1, verbose = FALSE, seed = 0, beta.start = NA,
b0 = 0, B0 = 0.001, ...)
MCMClogit
simulates from the posterior density of a logistic
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{B}ernoulli(\pi_i)$$
Where the inverse link function:
$$\pi_i = \frac{\exp(x_i'\beta)}{1 + \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
data(birthwt)
posterior <- MCMClogit(low~age+as.factor(race)+smoke, data=birthwt)
plot(posterior)
summary(posterior)
Run the code above in your browser using DataLab