ARCHIVED: In Stata, why does .xtreg return an R-squared statistic for fixed-effects models that is different from that reported in SAS and LIMDEP?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

The Stata .xtreg command fits various panel data models, including fixed- and random-effects models. For the fixed-effects model, .xtreg estimates within-group variation by computing the differences between observed values and their means. This model produces correct parameter estimates without creating dummy variables; however, due to the larger degrees of freedom, its standard errors and, consequently, R-squared statistic are incorrect. That is, the R-squared statistic labeled R-sq: within = is not correct.

To get a correct estimate of the R-squared statistic, you have two options. You may use the Stata .areg or .regress commands to get the estimate; alternatively, you may fit the model using SAS (PROC PANEL) or LIMDEP (Regress), which report adjusted standard errors and R-squared.

For example, if you regress y on three independent variables, x1 through x3, and are interested in the fixed effects for the group variable month, you can estimate the fixed-effects model using .xtreg, .areg, and .regress:

  .xtreg y x1-x3, fe i(month)

  .areg y x1-x3, absorb(month)

  .regress y x1-x3 d1-d11

d1 through d11 are dummy variables for the months January through November. Keep in mind that .regress requires that you create dummy variables in advance. Both .regress and .areg produce correct parameter estimates, standard errors, and R-squared statistics. The .areg command is useful, particularly when the group variable has many categories.

If you have questions about using statistical and mathematical software at Indiana University, contact the UITS Research Applications and Deep Learning team.

This is document auur in the Knowledge Base.
Last modified on 2023-05-09 14:41:47.