Announcement

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

  • Tabulating country fixed effects predicted in Stata

    Hello to everyone again,

    For my thesis, I aim on deriving country fixed effects. A suggested by a fellow Statalist member, I used the xtreg, fe command together with predict fe, u. Here is my code:

    Code:
    eststo a: qui xtreg patmfpc crisis i.agebrack sex brncntr ethminor i.edulvla ecoinsec lbrforce i.hinctnta  religious i.safe i.strgov i.trad i.rule lrscale, fe vce(robust)
    predict fea, u 
    eststo b: qui xtreg patmfse crisis i.agebrack sex brncntr ethminor i.edulvla ecoinsec lbrforce i.hinctnta  religious i.safe i.strgov i.trad i.rule lrscale, fe vce(robust)
    predict feb, u
    eststo c: qui xtreg patmfde crisis i.agebrack sex brncntr ethminor i.edulvla ecoinsec lbrforce i.hinctnta   religious i.safe i.strgov i.trad i.rule lrscale, fe vce(robust)
    predict fec, u
    eststo d: qui xtreg imp_eco crisis i.agebrack sex brncntr ethminor i.edulvla ecoinsec lbrforce i.hinctnta  religious i.safe i.strgov i.trad i.rule lrscale, fe vce(robust)
    predict fed, u
    eststo e: qui xtreg imp_cult crisis i.agebrack sex brncntr ethminor i.edulvla ecoinsec lbrforce i.hinctnta  religious i.safe i.strgov i.trad i.rule lrscale, fe vce(robust)
    predict fee, u
    This all works as intended. However, I could not figure out how to tabulate the country fixed effects of each country for all 5 dependent variables in a nice table. Just for you to understand: I am using five regressions with five different dependent variables. The countries however are always the same. After using the predict command, I have a new variable for fea, feb, fec, fed and fee. For each country, the variable is always the same for the respective model.

    Does anyone have any suggestions?

    Best,
    Aileen

  • #2
    You can do something like:

    Code:
    preserve
    keep country year fe*
    collapse fe*, by(country)
    mkmat country fe*, mat(FE)
    esttab mat(FE)
    restore
    Depending on what format you want the tables, there may be better ways to export the result as country names which are strings cannot be held in Stata matrices.

    Comment


    • #3
      Many thanks Andrew, it worked!

      Comment

      Working...
      X