Built using Zelig version r packageVersion("Zelig")

knitr::opts_knit$set(
    stop_on_error = 2L
)
knitr::opts_chunk$set(
    fig.height = 11,
    fig.width = 7
)

options(cite = FALSE)

Quinn's Dynamic Ecological Inference Model with eidynamic in ZeligEI.

Syntax

The EI models accept several different formula syntaxes. If $C1$ and $C2$ are the column totals, and $R1$ and $R2$ are the row totals, and $N=R1_i + R2_i = C1_i + C2_i$ is the total in unit $i$, 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(zeligverse)

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)

With the Zelig 4 compatibility wrappers this looks like:

z.out <- zelig(C1 ~ R1, N=N, model = "eidynamic", weights = w,
               data = myData)

Additional Inputs

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.

Examples

rm(list=ls(pattern="\\.out"))
set.seed(1234)

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()

See also

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.

z5 <- zeidynamic$new()
z5$references()


IQSS/Zelig documentation built on Dec. 11, 2023, 1:51 a.m.