To test for groupwise heteroscedasticity in a fixed effect model: xtreg y x1 x2, fe * ssc install xttest3 xttest3 Use code with caution. Testing for Cross-Sectional Dependence (CD)
This will estimate a random-effects model of y on x1 and x2 .
xtreg y x1 x2, re
menbreg y x1 x2 || id: , exposure(log_population) stata panel data exclusive
Stata's default xtline is basic. Exclusive users create publication-ready graphs:
), variables may contain unit roots, leading to spurious regressions. Stata provides an exclusive suite of panel unit root tests ( xtunitroot ).
To follow the "exclusive" path, you need to escape the xtreg, fe comfort zone. Begin with a robust environment: To test for groupwise heteroscedasticity in a fixed
-statistics. Use the Wooldridge test for autocorrelation via xtserial .
* Predict fixed effects predict u, u
┌──────────────────────────┐ │ Pooled OLS (`reg`) │ └────────────┬─────────────┘ │ Is there unobserved heterogeneity? ▼ (Breusch-Pagan LM Test) ┌──────────────────────────┐ │ Random Effects (`re`) │ └────────────┬─────────────┘ │ Are individual effects correlated with X? ▼ (Hausman Test) ┌──────────────────────────┐ │ Fixed Effects (`fe`) │ └──────────────────────────┘ Pooled OLS Begin with a robust environment: -statistics
Choosing the correct estimator determines whether your coefficients represent causal relationships or mere correlations.
[ Run Pooled OLS ] │ ( Breusch-Pagan ) Is Var(u_i) = 0? / \ YES / \ NO v v [ Pooled OLS ] [ Run FE & RE ] │ ( Hausman Test ) Are errors correlated? / \ YES / \ NO v v [ Fixed Effects ] [ Random Effects ]