Gary King Homepage Previous: Information on Program Updates Up: : A Program for Next: Advanced Topics: Bayesian Model

Overview

As only four commands are required to use $ {\mathfrak{E}I}$ 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 $ {\mathfrak{E}I}$. (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 ($ X_i$), the fraction turning out to vote ($ T_i$), and the number of voting age people ($ {N_i}$) in each precinct ( $ i=1,\ldots,p$) to infer the fraction of blacks who vote ($ \beta_i^b$) and the fraction of whites who vote ($ \beta_i^w$), also in each precinct.

Table 1: Notation for Precinct $ i$. The goal is to infer the quantities of interest, $ \beta_i^b$ (the fraction of blacks who vote) and $ \beta_i^w$ (the fraction of whites who vote), from the aggregate variables $ X_i$ (the fraction of voting age people who are black) and $ T_i$ (the fraction of people who vote), along with $ {N_i}$ (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     $ \beta^b_i$      $ 1-\beta_i^b$      $ X_i$
white     $ \beta^w_i$      $ 1-\beta_i^w$      $ 1-X_i$
      $ T_i$     $ 1-T_i$       


Of course, this is only an example; $ {\mathfrak{E}I}$ 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). $ {\mathfrak{E}I}$ can also be used without modification if $ T_i$ 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).

  1. At the start of every program, use library ei; to initialize $ {\mathfrak{E}I}$. (To reinitialize all globals between programs, use eiset; if desired.)
  2. Run the main procedure, dbuf = ei(t,x,n,1,1);, which takes three $ p\times 1$ 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.
  3. 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:
    1. 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.
    2. 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 $ \beta_i^b$, ci80w for 80% confidence intervals for $ \beta_i^w$, or sum to print a summary of district-level estimates and information.



Gary King 2006-09-13