Announcement

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

  • Two-way fixed effects

    Dear Madam/Sir,

    I want to estimate two-way fixed effect model for firm and CEO identifier and estimate the following regression and get the error message as follows:

    reg ln_audit gafscore mascore big4 cspec ln_nonaudit icw restatement gc auchange merger financing yearend abaccrual ln_at mb lev
    > erage roa loss fsalepro sq_segs ar_in special_item ln_tenure y2000-y2015 i.gvkey i.execid
    maxvar too small
    You have attempted to use an interaction with too many levels or attempted to fit a model with too many variables. You need
    to increase maxvar; it is currently 2048. Use set maxvar; see help maxvar.

    If you are using factor variables and included an interaction that has lots of missing cells, try set emptycells drop to
    reduce the required matrix size; see help set emptycells.

    If you are using factor variables, you might have accidentally treated a continuous variable as a categorical, resulting in
    lots of categories. Use the c. operator on such variables.
    r(907);

    Any idea to fix this issue will be highly appreciated.

    Sincerely,
    HJ

  • #2
    HJ:
    welcome to this forum.
    If, as it would seem from your post, you have a panel dataset, why not considering -xtreg,fe- first?
    I would also take a look at the community-contributed programme -reghdfe-.
    Last edited by Carlo Lazzaro; 19 Mar 2020, 04:03.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      I do believe the output in Stata is telling the truth, I mean, you can try to start with a simple model: no interaction term, treating year as a continuous variable, etc.

      By the way, it seems you created dummies for each year, which is unnecessary. Also, take a look at the "i." variables and check whether they can be taken as continuous variables.
      Best regards,

      Marcos

      Comment


      • #4
        Thank Carlo and Marcos for your comments. Even after making year dummies to continuous variables, I see the same error message. However, after designating "execid" as fixed effect identifier and include "gvkey" fixed effect in the regression, the command runs. Is it a usual way to run two-way fixed model?

        xtset execid
        xtreg ln_audit gafscore mascore big4 cspec ln_nonaudit icw restatement gc auchange merger financing yearend abaccrual ln_at mb leverage roa loss fsalepro sq_segs ar_in special_item ln_tenure fyear gvkey,fe

        Thank you very much for your help

        Sincerely,
        HJ

        Comment


        • #5
          The problem is that you have a large number of firms and a very large number of executives. When you do regress, it needs a matrix big enough to work with all those variables/parameters. But the maximum matrix size in Stata is 11000.

          When you run xtreg with fixed effect for executive, it doesn't need to estimate all the executive parameters so the matrix needed is much smaller. If you want both firm and exec fixed effects, reghdfe may be better than xtreg - it may be faster and doesn't waste a pile of output for all the firm dummies. .

          Phil

          Comment

          Working...
          X