- formula
A symbolic description of the model to be fit, specifying the
column and row margins of \(2 \times 2\) ecological tables. Y ~ X
specifies Y
as the column margin (e.g., turnout) and X
as the
row margin (e.g., percent African-American). Details and specific examples
are given below.
- data
An optional data frame in which to interpret the variables in
formula
. The default is the environment in which ecoNP
is
called.
- N
An optional variable representing the size of the unit; e.g., the
total number of voters. N
needs to be a vector of same length as
Y
and X
or a scalar.
- supplement
An optional matrix of supplemental data. The matrix has
two columns, which contain additional individual-level data such as survey
data for \(W_1\) and \(W_2\), respectively. If NULL
, no
additional individual-level data are included in the model. The default is
NULL
.
- context
Logical. If TRUE
, the contextual effect is also
modeled, that is to assume the row margin \(X\) and the unknown \(W_1\)
and \(W_2\) are correlated. See Imai, Lu and Strauss (2008, 2011) for
details. The default is FALSE
.
- mu0
A scalar or a numeric vector that specifies the prior mean for
the mean parameter \(\mu\) of the base prior distribution \(G_0\) (see
Imai, Lu and Strauss (2008, 2011) for detailed descriptions of Dirichlete
prior and the normal base prior distribution) . If it is a scalar, then its
value will be repeated to yield a vector of the length of \(\mu\),
otherwise, it needs to be a vector of same length as \(\mu\). When
context=TRUE
, the length of \(\mu\) is 3, otherwise it is 2. The
default is 0
.
- tau0
A positive integer representing the scale parameter of the
Normal-Inverse Wishart prior for the mean and variance parameter
\((\mu_i, \Sigma_i)\) of each observation. The default is 2
.
- nu0
A positive integer representing the prior degrees of freedom of
the variance matrix \(\Sigma_i\). the default is 4
.
- S0
A positive scalar or a positive definite matrix that specifies the
prior scale matrix for the variance matrix \(\Sigma_i\). If it is a
scalar, then the prior scale matrix will be a diagonal matrix with the same
dimensions as \(\Sigma_i\) and the diagonal elements all take value of
S0
, otherwise S0
needs to have same dimensions as
\(\Sigma_i\). When context=TRUE
, \(\Sigma\) is a \(3 \times 3\)
matrix, otherwise, it is \(2 \times 2\). The default is 10
.
- alpha
A positive scalar representing a user-specified fixed value of
the concentration parameter, \(\alpha\). If NULL
, \(\alpha\) will
be updated at each Gibbs draw, and its prior parameters a0
and
b0
need to be specified. The default is NULL
.
- a0
A positive integer representing the value of shape parameter of
the gamma prior distribution for \(\alpha\). The default is 1
.
- b0
A positive integer representing the value of the scale parameter
of the gamma prior distribution for \(\alpha\). The default is 0.1
.
- parameter
Logical. If TRUE
, the Gibbs draws of the population
parameters, \(\mu\) and \(\Sigma\), are returned in addition to the
in-sample predictions of the missing internal cells, \(W\). The default is
FALSE
. This needs to be set to TRUE
if one wishes to make
population inferences through predict.eco
. See an example below.
- grid
Logical. If TRUE
, the grid method is used to sample
\(W\) in the Gibbs sampler. If FALSE
, the Metropolis algorithm is
used where candidate draws are sampled from the uniform distribution on the
tomography line for each unit. Note that the grid method is significantly
slower than the Metropolis algorithm.
- n.draws
A positive integer. The number of MCMC draws. The default is
5000
.
- burnin
A positive integer. The burnin interval for the Markov chain;
i.e. the number of initial draws that should not be stored. The default is
0
.
- thin
A positive integer. The thinning interval for the Markov chain;
i.e. the number of Gibbs draws between the recorded values that are skipped.
The default is 0
.
- verbose
Logical. If TRUE
, the progress of the Gibbs sampler is
printed to the screen. The default is FALSE
.