Announcement

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

  • Maximum amount of variables in a fixed effects regression?

    I have a panel dataset with data from every zip code in the US. When I use xi: regress ... i.zip, the program keeps running for minutes and I have to break. Is this because there are too many zip codes for this to work?

  • #2
    Yes. The -xi- command just adds an additional variable to the regression for each fixed effect. The computer will have a tough time inverting such a large matrix. You want to investigate -xtreg- or -areg- or one of many other commands that take out means before running the regression, and are much faster. I posted some advice on large panel dataset regressions at http://www.nber.org/stata/efficient/fixed-effects.html but it is likely -xtreg- is all you need.

    Comment


    • #3
      Zuti:
      welcome to this forum.
      As an aside to Daniel's helpful comment, please note that -regression- rarely outperforms -xtreg- when it comes to panel data analysis.
      Besides, as per your post, interested listers cannot have full information about what you ask Stata to do for you (by the way: did you impose -vce(cluster panelid)- standard errors since you have non-independent observations within panels?): hence, for the future, please share what you typed and what Stata gave you back via CODE delimiters (as reminded by FAQ). Thanks.
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment

      Working...
      X