Quinn’s Dynamic Ecological Inference Model
The EI models accept several different formula syntaxes. If and are the column totals, and and are the row totals, and is the total in unit , then the formula can be expressed with just one row and one column, with the totals provided separately as:
z.out <- zelig(C1 ~ R1, N=N, data=data)
The argument N can be either a numeric vector of the total in each i-th unit, or the character name of a variable in the dataset that contains these values.
Or with both rows and columns coupled together, and omitting the totals:
z.out <- zelig( cbind(C1,C2) ~ cbind(R1,R2), data=data)
Additionally, if C1, C2, R1, R2 are percentages rather than counts, then either formula method above is acceptable, however, N must always be provided.
First load packages:
library("Zelig")
library("ZeligEI")
Here is an example of all the syntax for the analysis using the first syntax method, and the direct use of the reference classes:
z5 <- zeidynamic$new()
z5$zelig(C1 ~ R1, N=myN, weights = w, data = myData)
z5$setx()
z5$sim()
With the Zelig 4 compatibility wrappers this looks like:
z.out <- zelig(C1 ~ R1, N=N, model = "eidynamic", weights = w, data = myData)
x.out <- setx(z.out)
s.out <- sim(z.out, x = x.out)
In addition, Zelig accepts the following additional inputs for eidynamic to monitor the convergence of the Markov chain:
The model also accepts the following additional arguments to specify priors and other parameters:
Users may wish to refer to help(MCMCdynamicEI) for more options.
You can check for convergence before summarizing the estimates with three diagnostic tests. See the section Diagnostics for Zelig Models for examples of the output with interpretation:
z.out$geweke.diag()
z.out$heidel.diag()
z.out$raftery.diag()
The Quinn dynamic model is part of the MCMCpack package by Andrew Martin, Kevin Quinn, and Jong Hee Park. Advanced users may wish to refer to help(MCMCdynamicEI) in the MCMCpack package.
Quinn K (2004). “Ecological Inference in the Presence of Temporal Dependence.” In King G, Rosen O and Tanner M (eds.), Ecological Inference: New Methodological Strategies. Cambridge University Press, New York.
Martin AD, Quinn KM and Park JH (2011). “MCMCpack: Markov Chain Monte Carlo in R.” Journal of Statistical Software, 42 (9), pp. 22. <URL: http://www.jstatsoft.org/v42/i09/>.