MCMCpanel {MCMCpack}R Documentation

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 = 0, seed = NA, sigma2.start = NA,
    D.start = NA, b0 = 0, B0 = 1, eta0, R0, nu0 = 0.001,
    delta0 = 0.001, ...)
   

Arguments

obs An (nk * 1) vector that contains unique observation numbers for each subject.
Y An (nk * 1) vector of response variables, stacked across all subjects.
X An (nk * p) matrix of fixed effects covariates, stacked across all subjects.
W An (nk * 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. If NA, the Mersenne Twister generator is used with default seed 12345; if an integer is passed it is used to seed the Mersenne twister. The user can also pass a list of length two to use the L'Ecuyer random number generator, which is suitable for parallel computation. The first element of the list is the L'Ecuyer seed, which is a vector of length six or NA (if NA a default seed of rep(12345,6) is used). The second element of list is a positive substream number. See the MCMCpack specification for more details.
verbose A switch which determines whether or not the progress of the sampler is printed to the screen. If verbose is greater than 0 the iteration number and parameters are printed to the screen every verboseth iteration.
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 will be the starting value. Default value of NA uses an identity matrix multiplied by 0.5 the OLS sigma2 estimate.
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. Default value of 0 is equivalent to an improper uniform prior for beta.
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

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 + epsilon_i

Where the random effects:

b_i ~ N_q(0,D)

And the errors:

epsilon_i ~ N(0, sigma^2 I_k)

We assume standard, conjugate priors:

beta ~ N(b0,B0^(-1))

And:

sigma^(-2) ~ Gamma(nu0/2eate Cowles, and Karen Vines. 2002. Output Analysis and Diagnostics for MCMC (CODA). http://www-fis.iarc.fr/coda/.

See Also

plot.mcmc, summary.mcmc, factanal, MCMCfactanal, MCMCirt1d, MCMCirtKd

Examples

   ## Not run: 
   data(painters)
   new.painters <- painters[,1:4]
   cuts <- apply(new.painters, 2, quantile, c(.25, .50, .75))
   for (i in 1:4){
      new.painters[new.painters[,i]<cuts[1,i],i] <- 100
     new.painters[new.painters[,i]<cuts[2,i],i] <- 200
     new.painters[new.painters[,i]<cuts[3,i],i] <- 300
     new.painters[new.painters[,i]<100,i] <- 400
   }

   posterior <- MCMCordfactanal(~Composition+Drawing+Colour+Expression,
                        data=new.painters, factors=1,
                        lambda.constraints=list(Drawing=list(2,"+")),
                        burnin=5000, mcmc=500000, thin=200, verbose=500,
                        L0=0.5, store.lambda=TRUE,
                        store.scores=TRUE, tune=1.2)
   plot(posterior)
   summary(posterior)
   ## End(Not run)

[Package MCMCpack version 0.6-4 Index]
./usr/lib/R/site-library/MCMCpack/html/MCMCpanel.html0000644000000000000