Learn R Programming

MCMCpack (version 0.4-9)

MCMCpanel: Markov chain Monte Carlo for the General Linear Panel Model

Description

MCMCpanel generates a posterior density sample from a General Linear Panel Model using Algorithm 2 of Chib and Carlin (1999). This model uses a multivariate Normal prior for the fixed effects parameters, a Wishart prior on the random effects precision matrix, and a Gamma prior on the conditional error precision. The user supplies data and priors, and a sample from the posterior density is returned as an mcmc object, which can be subsequently analyzed with functions provided in the coda package.

Usage

MCMCpanel(obs, Y, X, W, burnin = 1000, mcmc = 10000, thin = 5, 
    verbose = FALSE, seed = 0, sigma2.start = NA,
    D.start = NA, b0 = 0, B0 = 1, eta0, R0, nu0 = 0.001,
    delta0 = 0.001, ...)

Arguments

obs
An $(nk \times 1)$ vector that contains unique observation numbers for each subject.
Y
An $(nk \times 1)$ vector of response variables, stacked across all subjects.
X
An $(nk \times p)$ matrix of fixed effects covariates, stacked across all subjects.
W
An $(nk \times q)$ matrix of random effects covariates, stacked across all subjects.
burnin
The number of burnin iterations for the sampler.
mcmc
The number of Gibbs iterations for the sampler.
thin
The thinning interval used in the simulation. The number of mcmc iterations must be divisible by this value.
seed
The seed for the random number generator. The code uses the Mersenne Twister, which requires an integer as an input. If nothing is provided, the Scythe default seed is used.
verbose
A switch which determines whether or not the progress of the sampler is printed to the screen. If TRUE, the iteration number and parameters are printed to the screen.
sigma2.start
The starting value for the conditional error variance. Default value of NA uses the least squares estimates.
D.start
The starting value for precision matrix of the random effects. This can either be a scalar or square matrix with dimension equal to the number of random effects. If this takes a scalar value, then that value multiplied by an identity matrix
b0
The prior mean of $\beta$. This can either be a scalar or a column vector with dimension equal to the number of betas. If this takes a scalar value, then that value will serve as the prior mean for all of the betas.
B0
The prior precision of $\beta$. This can either be a scalar or a square matrix with dimensions equal to the number of betas. If this takes a scalar value, then that value times an identity matrix serves as the prior precision of beta. D
eta0
The shape parameter for the Wishart prior on precision matrix for the random effects.
R0
The scale matrix for the Wishart prior on precision matrix for the random effects.
nu0
The shape parameter for the Gamma prior on the conditional error precision.
delta0
The scale parameter for the Gamma prior on the conditional error precision.
...
further arguments to be passed

Value

  • An mcmc object that contains the posterior density sample. This object can be summarized by functions provided by the coda package.

Details

MCMCpanel simulates from the posterior density sample using the blocked Gibbs sampler of Chib and Carlin (1999), Algorithm 2. 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 = X_i \beta + W_i b_i + \varepsilon_i$$ Where the random effects: $$b_i \sim \mathcal{N}_q(0,D)$$ And the errors: $$\varepsilon_i \sim \mathcal{N}(0, \sigma^2 I_k)$$ We assume standard, conjugate priors: $$\beta \sim \mathcal{N}(b0,B0^{-1})$$ And: $$\sigma^{-2} \sim \mathcal{G}amma(\nu_0/2, \delta_0/2)$$ And: $$D^{-1} \sim \mathcal{W}ishart(\eta_0, R_0^{-1})$$ See Chib and Carlin (1999) or Martin and Saunders (2002) for more details. NOTE: Unlike most models in MCMCpack, we do not provide default parameters for the priors on the precision matrix for the random effects. When fitting one of these models, it is of utmost importance to choose a prior that reflects your prior beliefs about the random effects. Using the dwish and rwish functions might be useful in choosing these values. Also, the user is not allowed to specify a starting value for the $\beta$ parameters, as they are simulated in the first block of the sampler.

References

Siddhartha Chib and Bradley P. Carlin. 1999. ``On MCMC Sampling in Hierarchical Longitudinal Models." Statistics and Computing. 9: 17-26.

Andrew D. Martin, Kevin M. Quinn, and Daniel Pemstein. 2003. Scythe Statistical Library 0.4. http://scythe.wustl.edu. Andrew D. Martin and Kyle L. Saunders. 2002. ``Bayesian Inference for Political Science Panel Data.'' Paper presented at the 2002 Annual Meeting of the American Political Science Association. Martyn Plummer, Nicky Best, Kate Cowles, and Karen Vines. 2002. Output Analysis and Diagnostics for MCMC (CODA). http://www-fis.iarc.fr/coda/.

See Also

plot.mcmc,summary.mcmc