Announcement

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

  • LSDV with dummy variable interacting with independent variables

    Dear community members,

    I have a beginner question.

    I have two groups: Control and treatment. It is panel data and I want to test the effects of treatment comparing the two groups.
    My issue is that I want to control individual fixed effect as well.
    Since fixed effect eliminates dummy variables, I am thinking of using LSDV and adding a dummy variable interacting with independent variables.

    The code is like:

    xtset id time
    xi: reg y I.treatment|x1 I.treatment|x2 i.id, vce(cluster id)

    I am wondering if it is okay to do that. I am thinking of trying RE or mixed effect or just presenting results of two groups without the comparison. I would appreciate for any comment.
    Thank you.
    Last edited by Sam Jung; 15 Oct 2023, 22:02.

  • #2
    A few recommendations:

    1. xtset doesn't do anything in the context of your model command.

    2. xi: is pretty much obsolete.
    Code:
    help factor variables
    3. You probably intended to include the time variable in your list of predictors. xtset id year doesn't do it.

    Instead, you need to add it explicitly.
    Code:
    regress y i.treatment##c.x? i.year . . .
    4. For id as fixed effect, either treatment condition (control treatment versus experimental treatment) or both xs need to vary within id, or they'll drop out.

    5. Look into xtreg . . . , i(id) fe as an alternative estimation command.

    Comment


    • #3
      Thank you Joseph. I will check them.
      And could you explain to me more about the xtreg ..., i(id) ?

      Comment


      • #4
        Originally posted by Sam Jung View Post
        . . . could you explain to me more about the xtreg ..., i(id) ?
        Is there something in particular that's not clear in the help file?

        (The use of the i() option as an alternative to xtset I believe is no longer documented in the help file, if that's what you're asking about.)

        Comment

        Working...
        X