Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Implement interaction term in ivregress command

    Hi.

    consider the following simplified OLS baseline regression:

    y = ß0 + ß1X12X23X3 + e

    In a second model, a dummy variable X4 is included which interacts with X1:

    y = ß01X1++ß2X23X34X45(X1*X4) + e

    The robustness of the findings of both models should be checked using a 2SLS model with an instrument Z. The potentially endogenous variable is X1.

    The command for the baseline model, i.e., without the interaction term is:
    Code:
    ivregress 2sls Y X2 X3 (X1 = Z), first vce(robust)
    I am not sure how to implement the interaction term in the -ivregress- command though. Do I have to build the interaction manually like so?

    Code:
    gen Interaction  = X1*X4
    gen Interaction_IV = X4*Z
    2sls with interaction:
    Code:
    ivregress 2sls Y X2 X3 (X1 Interaction = Z Interaction_IV), first vce(robust)
    I read through this thread which gives me the feeling that the ivregress command is correct, neverless my questions would be:
    1.) Is there any mistake I made in the ivregress command?
    2.) I was wondering if there is a way to directly implement the Interaction term in the ivregress command without the need to create the interaction manually.

    Many thanks

  • #2
    On #1, x4 is missing from your command. On #2, see

    Code:
    help fvvarlist

    Comment


    • #3
      By the way, this statement

      The robustness of the findings of both models should be checked using a 2SLS model with an instrument Z. The potentially endogenous variable is X1.
      makes me think that this is homework. If so, read our policy on that in #4: https://www.statalist.org/forums/help#adviceextras

      Comment

      Working...
      X