Announcement

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

  • Fixed and random effect regression

    Hi all, I am conducting some analysis using an unbalanced panel dataset.

    I am using outreg2 to set up a table with three models where I conduct fixed effect regression and I would like to do an identical but seperate table using random effects regression.

    I am using the following code to create a word document displaying three different fixed effect models without time fixed effects and the same three fixed effect models but now including time fixed effects. This part works fine.

    Code:
    . xtreg dg1 $xlist Risk , fe vce(cluster ID)
    outreg2 using Diffgrowth, word dec (3) replace ctitle(Diff Growth FY1) addtext(State FE, Yes, Year FE, No) adjr2
    . xtreg dg2 $xlist Risk , fe vce(cluster ID)
    outreg2 using Diffgrowth, word dec (3) append ctitle(Diff Growth FY2) addtext(State FE, Yes, Year FE, No) adjr2
    . xtreg dg3 $xlist Risk , fe vce(cluster ID)
    outreg2 using Diffgrowth, word dec (3) append ctitle(Diff Growth FY3) addtext(State FE, Yes, Year FE, No) adjr2
    
    . xtreg dg1 $xlist Risk i.T, fe vce(cluster ID)
    outreg2 using Diffgrowth, word dec (3) append ctitle(Diff Growth FY1) addtext(State FE, Yes, Year FE, Yes) adjr2
    . xtreg dg2 $xlist Risk i.T, fe vce(cluster ID)
    outreg2 using Diffgrowth, word dec (3) append ctitle(Diff Growth FY2) addtext(State FE, Yes, Year FE, Yes) adjr2
    . xtreg dg3 $xlist Risk  i.T, fe vce(cluster ID)
    outreg2 using Diffgrowth, word dec (3) append ctitle(Diff Growth FY3) addtext(State FE, Yes, Year FE, Yes) adjr2
    And get this:
    Click image for larger version

Name:	Fixed effect table.png
Views:	1
Size:	99.2 KB
ID:	1659035


    To create the second table with random effects regression I use the following code

    Code:
    . xtreg dg1 $xlist Risk , re vce(cluster ID)
    outreg2 using DiffgrowthRE, word dec (3) replace ctitle(Diff Growth FY1) addtext(State RE, Yes, Year FE, No)
    . xtreg dg2 $xlist Risk , re vce(cluster ID)
    outreg2 using DiffgrowthRE, word dec (3) append ctitle(Diff Growth FY2) addtext(State RE, Yes, Year FE, No)
    . xtreg dg3 $xlist Risk , re vce(cluster ID)
    outreg2 using DiffgrowthRE, word dec (3) append ctitle(Diff Growth FY3) addtext(State RE, Yes, Year FE, No)
    
    . xtreg dg1 $xlist Risk i.T, re vce(cluster ID)
    outreg2 using DiffgrowthRE, word dec (3) append ctitle(Diff Growth FY1) addtext(State RE, Yes, Year FE, Yes)
    . xtreg dg2 $xlist Risk i.T, re vce(cluster ID)
    outreg2 using DiffgrowthRE, word dec (3) append ctitle(Diff Growth FY2) addtext(State RE, Yes, Year FE, Yes)
    . xtreg dg3 $xlist Risk  i.T, re vce(cluster ID)
    outreg2 using DiffgrowthRE, word dec (3) append ctitle(Diff Growth FY3) addtext(State RE, Yes, Year FE, Yes)
    And get this:
    Click image for larger version

Name:	random effect table.png
Views:	1
Size:	99.8 KB
ID:	1659036


    I have a few questions regarding the above
    1. I would like to include r2 in my table with random effects models, however when trying to include "adjr2" I get the following error: "Adjusted R-squared (e(r2_a)) not defined; cannot use adjr2 option"
    2. Is there anyway I can include both within, between, and overall r2 using outreg2?
    3. How is time fixed effect coefficients to be interpreted?

    Thank you in advance
    Best

    Oskar

  • #2
    Answering your 3. question: you've not omitted your intercept, which means that Stata has dropped one time dummy for identification purposes, which is your reference period. Coefficients on time dummies in this case represent the relative effect on the outcome of the observation being in that time period, relative to your baseline time period.

    Comment


    • #3
      Originally posted by Maxence Morlet View Post
      Answering your 3. question: you've not omitted your intercept, which means that Stata has dropped one time dummy for identification purposes, which is your reference period. Coefficients on time dummies in this case represent the relative effect on the outcome of the observation being in that time period, relative to your baseline time period.
      Thanks for your response.

      Adding on that, through model 1-3 in the first picture where I estimated fixed effects regression. An intercept is estimated, as far as I can find it seems that the coefficient is estimated using the entitiy-demeaned method. How should I understand the intercept when there are no time effects? is this simply the average entity fixed effects?

      Comment


      • #4
        There is no intercept on the within regression. The intercept you see is some fabrication, and you need to read the Stata manual to see what they have fabricated.

        Regarding your question 1. type after your regression -ereturn list- and you will see what you have availabe post estimation of -xtreg, re-.

        Regarding your question 2. the within, between and overall R^2 are not related to the fixed or random effects regressions. They are a bit controversial decompositions of variance which is not tied to fixed or random effects estimation. R^2 strictly makes sense only in OLS regressions, the rest are tenuous interpretations.

        Comment


        • #5
          You may find this interesting Oskar Ipsen : https://www.stata.com/support/faqs/s...effects-model/

          Comment

          Working...
          X