Announcement

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

  • FE with four-way error-components

    Hello everyone,

    I am estimating a DiD (difference in difference) with Least-squares dummy-variables (LSDV).

    My data set contains 8,232 students (i) from 60 schools (j) and 460 classes (c) with a panel data format with T=5 (wave). For each student, I have the test scores (profic_mat) and a list of observed variables ($controlvar) over the time period.
    During the time series (2003-2008), a policy change is implemented in state schools in year 2007. Then, students from state schools are my treatment group and students from municipal schools are the control group. My DiD is 1 if student is enrolled in state schools (treated) in post-treatment period (time).

    Since the educational achievements follow a hierarchical structure, I assume individual, time, school and class fixed effects.

    Fitting two-way fixed-effects models is relatively simple. I estimate a model with individual and time fixed effects including the time effects as dummies and eliminating the individual effects by the withhin transformation.

    Code:
    xtreg profic_mat DiD time treated $controlvar wave_*, fe i(IDstudent) nonest cluster(IDschool)
    By defining a spell, I can fit a three-way fixed-effects. Then I treat as one spell all unique combinations of i and j.
    Code:
    egen spell=group(IDstudent IDschool)
    xtreg profic_mat DiD time treated $controlvar wave_*, fe i(spell) cluster(IDschool)
    My question now is how can I fit a model with a four-way error-components?
    I have estimated the two following models, but no one produced reliable values.

    Code:
    egen spellThree=group(IDstudent IDschool IDclass)
    xtreg profic_mat DiD time treated $controlvar wave_*, fe i(spellThree) cluster(IDschool)
                                                               /*(AND)*/
    xtreg profic_mat DiD time treated $controlvar wave_* IDclass_*, fe i(IDstudent) nonest cluster(IDschool)
    Any advice would be highly appreciated!

  • #2
    Hi Tharsicio
    I would suggest looking into "reghdfe" by Sergio Correira. This command estimates models with many "high dimensional" fixed effects.
    Best Regards
    Fernando

    Comment


    • #3
      Dear Fernando,

      First of all: Thanks for your reply.

      "reghdfe" is a nice command, but I cannot use it for some GMM-Estimates, such as xtabond, xtdpd and xtabond2.

      Any other Suggestion?

      Comment


      • #4
        Hi Tharcisio
        Unfortunately, I do not know of any command that would deal with high dimensional fixed effects with the context of GMM estimations, like the ones you describe.
        That being said. Unless students change schools or classes, I don't think it really matters if you control for school or classes fixed effects, because their effect will be already nested within student fixed effect.
        HTH
        Fernando
        Last edited by FernandoRios; 18 Nov 2019, 06:59.

        Comment


        • #5
          Dear Fernando,

          thank you for your continued efforts and collaboration.

          Unfortunately, the students can change between schools and classes. Moreover, the schools can select the students based on their prior performance. For all these reasons, the estimate of FE is necessary.

          All the best.

          Comment


          • #6
            Dear FernandoRios

            one more question.

            Do you know how I can test the model for first-order and second-order serial correlation after the reghdfe estimations?

            I have tried to implement the Wooldridge test (xtserial) after REGHDFE. But this command will ignore the fixed effect and the cluster structure of my model. Similarly, I tried to use the command abar test (Baum, Schaffer, Stillman. Stata Journal 7:4, 2007), but this command may be applied only after regress, ivreg, ivregress and ivreg2. Therefore, I cannot use the abar test with my three-way error-components.

            Any advice would be highly appreciated!

            Comment


            • #7
              Hi Tharcisio,
              This is a bit outside of my expertise, however, I think it would be relatively straight forward to implement xtserial test after REGHDFE, but you will have to do it manually.
              I would suggest you to look into "xtserial" (viewsource xtserial.ado), you will see that the test is relatively straight forward.
              1. Gather residuals from the model.
              2. regress the residuals againts their lags, without a constant and using clusters.
              3. test if lag residuals is significant. (or as in the command test if lag_res==-.5

              If I were you, I would try to replicate what xtserial does manually, then try expanding it to what reghdfe does, and finally applying the multiple cluster.
              HTH

              Comment

              Working...
              X