parse.formula             package:Zelig             R Documentation

_P_a_r_s_i_n_g _u_s_e_r-_i_n_p_u_t _f_o_r_m_u_l_a_s _i_n_t_o _m_u_l_t_i_p_l_e _s_y_n_t_a_x

_D_e_s_c_r_i_p_t_i_o_n:

     Parse the input formula (or list of formulas) into the  standard
     format described below.  Since labels for this format will vary 
     by model, 'parse.formula' will evaluate a function
     'describe.model', where 'model' is given as an input to
     'parse.formula'.

     If the 'describe.model' function has more than one parameter for
     which 'ExpVar = TRUE' and 'DepVar = TRUE', then the user-specified
     equations must have labels to match those parameters, else
     'parse.formula' should return an error. In addition, if the
     formula entries are not unambiguous, then 'parse.formula' returns
     an error.

_U_s_a_g_e:

     parse.formula(formula, model, data = NULL)

_A_r_g_u_m_e_n_t_s:

 formula: either a single formula or a list of 'formula' objects

   model: a character string specifying the name of the model

    data: an optional data frame for models that require a factor
          response variable

_D_e_t_a_i_l_s:

     Acceptable user inputs are as follows:

                              User Input                           Output from 'parse.formula'
                                                                   
       Same covariates,       cbind(y1, y2) ~ x1 + x2 * x3         list(mu1 = y1 ~ x1 + x2 * x3,
       separate effects                                            mu2 = y2 ~ x1 + x2 * x3,
                                                                   rho = ~ 1)
                                                                   
       With 'rho' as a        list(cbind(y1, y2) ~ x1 + x2,        list(mu1 = y1 ~ x1 + x2,
       systematic equation    rho = ~ x4 + x5)                     mu2 = y2 ~ x1 + x2,
                                                                   rho = ~ x4 + x5)
                                                                   
       With constraints       list(mu1 = y1 ~ x1 + tag(x2, "x2"),  list(mu1 = y1 ~ x1 + tag(x2, "x2"),
       (same variable)        mu2 = y2 ~ x3 + tag(x2, "x2"))       mu2 = y2 ~ x3 + tag(x2, "x2"),
                                                                   rho = ~ 1)
                                                                   
       With constraints       list(mu1 = y1 ~ x1 + tag(x2, "z1"),  list(mu1 = y1 ~ x1 + tag(x2, "z1"),
       (different variables)  mu2 = y2 ~ x3 + tag(x4, "z1"))       mu2 = y2 ~ x3 + tag(x4, "z1"),
                                                                   rho = ~ 1)

_V_a_l_u_e:

     The output is a list of formula objects with class  'c("multiple",
     "list")'.  Let's say that the name of the model is 
     '"bivariate.probit"', and the corresponding describe function is 
     'describe.bivariate.probit', which identifies 'mu1' and  'mu2' as
     systematic components, and an ancillary parameter 'rho', which may
     be parameterized, but is estimated as a scalar by default.

_A_u_t_h_o_r(_s):

     Kosuke Imai <kimai@princeton.edu>; Gary King <king@harvard.edu>;
     Olivia Lau <olau@fas.harvard.edu>; Ferdinand Alimadhi 
     <falimadhi@iq.harvard.edu>

_S_e_e _A_l_s_o:

     'parse.par', 'model.frame.multiple',  'model.matrix.multiple', and
     the full Zelig manual at <URL: http://gking.harvard.edu/zelig>.

_E_x_a_m_p_l_e_s:

     ## Not run: 
     data(sanction)
     formulae <- list(cbind(import, export) ~ coop + cost + target)
     fml <- parse.formula(formulae, model = "bivariate.probit")
     D <- model.frame(fml, data = sanction)
     ## End(Not run)

