Announcement

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

  • Histogram of fixed effects

    Dear Statalist users,

    I am working with panel data (id, year) and I am running fixed effects regressions (using areg or xtreg, fe). Now, I want to get a histogram of the fixed effects.

    I cannot run the fixed effects regression with i.id and then look at the coefficient vector because there are too many different ids and I get a matsize error ('matsize too small'). I also cannot change the matsize.

    Is there any way I can get a histogram of the fixed effects with the areg or xtreg, fe command? Unfortunately, it seems like those two do not store the fixed effects in the coefficient vector.


    Thanks!

    Markus

  • #2
    Hi Markus,

    You can do it trivially with reghdfe (ssc install reghdfe) but do note that plotting the histograms of the FEs is usually either useless or misleading (because they are not identified unless you have large T)

    The example:

    Code:
    sysuse auto
    reghdfe price weight, absorb(FE=turn)
    bys turn: gen first = _n==1
    hist FE if first
    For why it's wrong, feel free to shoot me an email.

    Cheers,
    Sergio

    Comment


    • #3
      Without saying it is useful, you can also use predict after xtreg to predict the fixed or random effect. I assume it will duplicate the effect for each observation in a panel, so you would need to do something like Sergio's _n==1 if you want one observation per panel.

      Comment


      • #4
        Hi there,

        I have a similar question regarding the generation of a histogram of fixed effects. I am interested in investigating manager-fixed effects, thus applied the methodology of Bertrand & Schoar (2003) and created a manager-firm matched panel dataset in accordance to their paper. My dataset has about 2,000 (mover) dummy variables for each individual manager that has been employed by at least one other firm in the sample (ID_CEO_1, ... ID_CEO_n; ID_CFO_1, ... , ID_CFO_n). In a first step, I run a benchmark model and then add the manager-fixed effects to the model and test (via F-stats) for the significance of the manager-fixed effects. In the related literature, I find distribution tables as well as histograms of the manager-fixed effects (mean, sd, percentiles), however I do not know how to end up with a distribution of the "consolidated" manager-fixed effects. I use the reghdfe command by Sergio Correia.

        Code:
        reghdfe leverage roa lag_tobins_q lag_ln_at gvkey_* fyear_* ID_*, noabsorb vce(cluster gvkey)
        Can anyone help me? I am wondering how to end up with a distribution of my manager-fixed effects? Thank you very much.

        Kind regards, L

        Comment

        Working...
        X