As only four commands are required to use
the program can be
easily run interactively, or in batch mode as a regular Gauss program
(other Gauss commands can be used at any point if desired). Each
command may also be used with many optional globals and subcommands.
An example of these commands are as follows:
library ei; @ initialize EI @
dbuf = ei(t,x,n,1,1); @ run main prog., save results in dbuf @
call eigraph(dbuf,"tomog"); @ draw tomography graph @
v = eiread(dbuf,"betab"); @ extract precinct estimates from dbuf @
In most applications, eigraph and eiread would
likely be run multiple times with different options chosen, and other
commands would be included with these four to read in the data
(t, x, and n).2
In this section, I describe these four commands through a very simple
use of
. (Refer to the reference section below for further details
and more sophisticated uses. That section also includes sample data
you can run with simple examples, and minor differences required when
running under Unix.) For this purpose, and without loss of
generality, I use the running example from the book portrayed in Table
2.3 (page 31) and reproduced below in Table 1. This
example uses the fraction of the voting age population who are black
(
), the fraction turning out to vote (
), and the number of
voting age people (
) in each precinct (
) to infer
the fraction of blacks who vote (
) and the fraction of
whites who vote (
), also in each precinct.
Table 1:
Notation
for Precinct
. The goal is to infer the quantities of interest,
(the fraction of blacks who vote) and
(the
fraction of whites who vote), from the aggregate variables
(the fraction of voting age people who are black) and
(the
fraction of people who vote), along with
(the number of
voting age people). This is Table 2.3 (page 31) in the book.
| Race of |
| |
| Voting Decision |
| |
| |
| |
| Voting Age |
| |
| |
| |
| |
| |
| |
| Person |
| |
| Vote |
| |
| No vote |
| |
| |
| black |
| |
|  |
| |
|
 |
| |
|  |
| white |
| |
|  |
| |
|
 |
| |
|  |
| |
| |
|  |
| |
|  |
| |
| |
|
Of course, this is only an example;
can be used for any analogous
ecological inference. It can be used for larger tables, as
described in Sections 8.4 and 15.1 of the book (see procedure
ei2 in the reference section).
can also be used without
modification if
is an average of individual-level
dichotomous variables (as in the example), interval-coded
discrete variables, or fully continuous variables, so long
as the variables are scaled to the [0,1] interval (see Section 14.3).
- At the start of every program, use library
ei; to initialize
. (To reinitialize all globals
between programs, use eiset; if desired.)
- Run the main procedure, dbuf = ei(t,x,n,1,1);, which
takes three
vectors as inputs: t (e.g.,
the fraction of the voting age population turning out to vote);
x (e.g., the fraction of the voting age population who are
black); and n (e.g., the total number of people in the
voting age population). (The remaining two inputs are for optional
covariates; for the basic model, set them each to 1 for no
covariates.) The output of this procedure is dbuf,
a gauss data buffer. A data buffer is a single entity that can be
saved from gauss in a single file on disk, but which can include
many different strings, vectors, matrices, or other elements (see
the Gauss command vput in the Gauss manual for more
information). After running ei, it is a good idea to save
dbuf on disk (with a Gauss command such as save
dbuf;). While ei is running, various intermediate
results appear on the screen, such as iteration numbers, but no
final results of substantive interest are printed. As this step is
by far the longest (about 2-5 minutes for 250 observations on an HP
715/80 or Pentium 90), it is usually most convenient to run this
separately from the remaining steps.
- The output data buffer from ei includes a large variety
of different results useful for understanding the results of the
analysis. A minimal set of nonrepetitive information is stored in
this data buffer, and a large variety of other information can be
easily computed from it. Fortunately, you do not need to know
whether the information you request is stored or computed as both
are treated the same.3 To extract information from the data buffer, two
procedures are available:
- For graphics, use eigraph(dbuf,"name");, where
dbuf is the data buffer that is the output of
ei, and name can be any of a long list of
ready-made graphs. For example, use eigraph(dbuf,"fit");
to assess the fit of the model, eigraph(dbuf,"tomog"); to
print a tomography graph, or eigraph(dbuf,"xgraph"); to
display a scattercross graph.
- For numerical information, use v =
eiread(dbuf,"name"), where v is the item extracted,
dbuf is the data buffer that is the output of
ei, and name can be any of a long list of output
possibilities. For example, use betab for a vector of
point estimates of
, ci80w for 80% confidence
intervals for
, or sum to print a summary of
district-level estimates and information.
Gary King
2006-09-13