jkcshea / ivmte

An R package for implementing the method in Mogstad, Santos, and Torgovitsky (2018, Econometrica).
GNU General Public License v3.0
18 stars 2 forks source link

Revisit how individual factor levels are called #202

Closed jkcshea closed 3 years ago

jkcshea commented 3 years ago

While reviewing #201, you also reviewed #102. While the syntax factor(x)-1 in #102 works when selecting single levels of a factor variable in the components argument, it is unclear how this works in the ivlike or m0, m1 arguments.

e.g. suppose m0 ~ factor(x)-1. R would interpret factor(x)-1 as meaning "factor(x) and no intercept", rather than "level 1 of factor(z)." Investigate this and determine the right way to declare factor levels.

jkcshea commented 3 years ago

@jongohkim91 Ah, I had forgotten we had actually addressed how to specify single elements of factor variables. For single factors, just declare a boolean expression. e.g.,

ivmte(m0 = ~ u + (yob == 55) + (yob == 60),
      ...)

See the section 'Specifying the MTR Functions: Basics' on the GitHub page.