Announcement

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

  • Student and Subject Fixed effects

    Hi,

    I am running a panel data with 3000 observations and each student has two subjects recorded.

    I would like to run both student and subject fixed effects.

    My code was

    xtset STU_ID subject
    xtreg testscore i.STU_ID i.subject SubjGradeA, fe cluster(STU_ID)

    However, stata omitted all the dummy variables for STU_ID due to collinearity.
    Does that mean that I do not require i.STU_ID for student fixed effect?

    Thanks

  • #2
    Angie:
    as expected, Stata tells you that, being -xtset- with -STU_ID- as the panelid, -i.STU-ID- is collinear with the panel-wise fixed effect (please note that the -fe- machinery wipes out any time-invariant variable).
    Hence, you should remove that predictor from the right-hand side of your regression equation.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Does that imply that this code runs both student and subject fixed effect?

      xtreg testscore i.subject SubjGradeA, fe cluster(STU_ID)

      Whereas this code runs student fixed effect only?
      xtreg testscore SubjGradeA, fe cluster(STU_ID)

      Comment


      • #4
        Angie:
        the only fixed effect is the one you plug in -xtset- (that is, STU_ID).
        Your other categorical variables are preditors that adjust each other in coefficients estimate.
        If you want more than one -fe- (but I do not think that this is what you're after), you may want to take a look at the user-written command -reghdfe-.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment

        Working...
        X