ecoBD                  package:eco                  R Documentation

_C_a_l_c_u_l_a_t_i_n_g _t_h_e _B_o_u_n_d_s _f_o_r _E_c_o_l_o_g_i_c_a_l _I_n_f_e_r_e_n_c_e _i_n _R_x_C _T_a_b_l_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     'ecoBD' is used to calculate the bounds for missing internal cells
     of R times C ecological table. The data can be entered either in
     the form of counts or proportions.

_U_s_a_g_e:

     ecoBD(formula, data = parent.frame(), N = NULL)

_A_r_g_u_m_e_n_t_s:

 formula: A symbolic description of ecological table to be used,
          specifying the column and row margins of R times C ecological
          tables. 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 'ecoBD' is
          called.  

       N: An optional variable representing the size of the unit; e.g.,
          the total number of voters. If 'formula' is entered as counts
          and the last row and/or column is omitted, this input is
          necessary.

_D_e_t_a_i_l_s:

     The data may be entered either in the form of counts or
     proportions. If proportions are used, 'formula' may omit the last
     row and/or column of tables, which can be calculated from the
     remaining margins. For example, 'Y ~ X' specifies 'Y' as the first
     column margin and 'X' as the first row margin in 2 times 2 tables.
     If counts are used, 'formula' may omit the last row and/or column
     margin of the table only if 'N' is supplied. For larger tables,
     one can use 'cbind()' and '+'. For example, 'cbind(Y1, Y2, Y3) ~
     X1 + X2 + X3 + X4)' specifies 3 times 4 tables.

     An R times C ecological table in the form of counts:

       n_{i11}  n_{i12}  ...  n_{i1C}  n_{i1.}
       n_{i21}  n_{i22}  ...  n_{i2C}  n_{i2.}
       ...        ...    ...    ...      ...
       n_{iR1}  n_{iR2}  ...  n_{iRC}  n_{iR.}
       n_{i.1}  n_{i.2}  ...  n_{i.C}    N_i

     where n_{nr.} and n_{i.c} represent the observed margins, N_i
     represents the size of the table, and n_{irc} are unknown
     variables. Note that for each i, the following deterministic
     relationships hold; n_{ir.} = sum_{c=1}^C n_{irc} for r=1,...,R,
     and n_{i.c}=sum_{r=1}^R n_{irc} for c=1,...,C. Then, each of the
     unknown inner cells can be bounded in the following manner,

   max(0, n_{ir.}+n_{i.c}-N_i) <= n_{irc} <= min(n_{ir.}, n_{i.c}).

     If the size of tables, 'N', is provided,

     An R times C ecological table in the form of proportions:

       W_{i11}  W_{i12}  ...  W_{i1C}  Y_{i1}
       W_{i21}  W_{i22}  ...  W_{i2C}  Y_{i2}
       ...        ...    ...    ...     ...
       W_{iR1}  W_{iR2}  ...  W_{iRC}  Y_{iR}
       X_{i1}   X_{i2}   ...  X_{iC}      

     where Y_{ir} and X_{ic} represent the observed margins, and
     W_{irc} are unknown variables. Note that for each i, the following
     deterministic relationships hold; Y_{ir} = sum_{c=1}^C X_{ic}
     W_{irc} for r=1,...,R, and sum_{r=1}^R W_{irc}=1 for c=1,...,C.
     Then, each of the inner cells of the table can be bounded in the
     following manner,

 max(0, (X_{ic} + Y_{ir}-1)/X_{ic}) <= W_{irc} <= min(1, Y_{ir}/X_{ir}).

_V_a_l_u_e:

     An object of class 'ecoBD' containing the following elements (When
     three dimensional arrays are used, the first dimension indexes the
     observations, the second dimension indexes the row numbers, and
     the third dimension indexes the column numbers):  

    call: The matched call.

       X: A matrix of the observed row margin, X.

       Y: A matrix of the observed column margin, Y.

       N: A vector of the size of ecological tables, N.

 aggWmin: A three dimensional array of aggregate lower bounds for
          proportions.

 aggWmax: A three dimensional array of aggregate upper bounds for
          proportions.

    Wmin: A three dimensional array of lower bounds for proportions.

    Wmax: A three dimensional array of upper bounds for proportions.

    Nmin: A three dimensional array of lower bounds for counts.

    Nmax: A three dimensional array of upper bounds for counts.

     The object can be printed through 'print.ecoBD'.

_A_u_t_h_o_r(_s):

     Kosuke Imai, Department of Politics, Princeton University
     kimai@Princeton.Edu, <URL: http://www.princeton.edu/~kimai>; Ying
     Lu, Institute for Quantitative Social Sciences,  Harvard
     University ylu@Latte.Harvard.Edu

_R_e_f_e_r_e_n_c_e_s:

     Imai, Kosuke. (2005) "Ecological Inference in R times C Tables"
     Working Paper, Princeton University.

_S_e_e _A_l_s_o:

     'eco', 'ecoNP'

_E_x_a_m_p_l_e_s:

     ## load the registration data
     data(reg)

     ## calculate the bounds
     res <- ecoBD(Y ~ X, N = N, data = reg)
     ## print the results
     print(res)

