ei {ei} | R Documentation |
Ecological Inference Estimation
Description
ei
is the main command in the package EI
. It gives observation-level estimates (and various related statistics) of \beta_i^b
and \beta_i^w
given variables T_i
and X_i
(i=1,...,n
) in this accounting identity: T_i=\beta_i^b*X_i + \beta_i^w*(1-X_i)
. Results are stored in an ei
object, that can be read with summary()
or eiread()
and graphed in plot()
.
Usage
ei(formula, total = NULL, Zb = 1, Zw = 1, id = NA, data =NA, erho = 0.5,
esigma = 0.5, ebeta = 0.5, ealphab = NA, ealphaw = NA, truth = NA,
simulate = TRUE, covariate = NULL, lambda1 = 4, lambda2 = 2,
covariate.prior.list = NULL, tune.list = NULL, start.list = NULL,
sample = 1000, thin = 1, burnin = 1000, verbose = 0, ret.beta = "r",
ret.mcmc = TRUE, usrfun = NULL)
Arguments
formula |
A formula of the form |
total |
‘total’ is the name of the variable in the dataset that contains the number of individuals in each unit |
Zb |
|
Zw |
|
id |
‘id’ is the nae of the variable in the dataset that identifies the precinct. Used for ‘movie’ and ‘movieD’ plot functions. |
data |
data frame that contains the variables that
correspond to formula. If using covariates and data is specified, data should also contain |
erho |
The standard deviation of the normal prior on |
esigma |
The standard deviation of an underlying normal distribution, from which a half normal is constructed as a prior for both |
ebeta |
Standard deviation of the "flat normal" prior on |
ealphab |
cols(Zb) x 2 matrix of means (in the first column) and standard deviations (in the second) of an independent normal prior distribution on elements of |
ealphaw |
cols(Zw) x 2 matrix of means (in the first column) and standard deviations (in the second) of an independent normal prior distribution on elements of |
truth |
A length(t) x 2 matrix of the true values of the quantities of interest. |
simulate |
default = TRUE:see documentation in |
covariate |
see documentation in |
lambda1 |
default = 4:see documentation in |
lambda2 |
default = 2:see documentation in |
covariate.prior.list |
see documentation in |
tune.list |
see documentation in |
start.list |
see documentation in |
sample |
default = 1000 |
thin |
default = 1 |
burnin |
default = 1000 |
verbose |
default = 0:see documentation in |
ret.beta |
default = "r": see documentation in |
ret.mcmc |
default = TRUE: see documentation in |
usrfun |
see documentation in |
Details
The EI
algorithm is run using the ei
command. A summary of the results can be seen graphically using plot(ei.object)
or numerically using summary(ei.object)
. Quantities of interest can be calculated using eiread(ei.object)
.
Author(s)
Gary King <<email: king@harvard.edu>> and Molly Roberts <<email: molly.e.roberts@gmail.com>>
References
Gary King (1997). A Solution to the Ecological Inference Problem. Princeton: Princeton University Press.
Examples
data(sample)
form <- t ~ x
dbuf <- ei(form,total="n",data=sample)
summary(dbuf)