Dear All,
reading the Example 2, -areg postestimation- entry, Stata .pdf manual,
should be
instead, as per the following toy-example:
reading the Example 2, -areg postestimation- entry, Stata .pdf manual,
The squared residuals...
The squared fitted values...
Code:
. use https://www.stata-press.com/data/r18/auto2, clear (1978 automobile data) . areg mpg weight gear_ratio, absorb(rep78) Linear regression, absorbing indicators Number of obs = 69 Absorbed variable: rep78 No. of categories = 5 F(2, 62) = 41.64 Prob > F = 0.0000 R-squared = 0.6734 Adj R-squared = 0.6418 Root MSE = 3.5109 ------------------------------------------------------------------------------ mpg | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- weight | -.0051031 .0009206 -5.54 0.000 -.0069433 -.003263 gear_ratio | .901478 1.565552 0.58 0.567 -2.228015 4.030971 _cons | 34.05889 7.056383 4.83 0.000 19.95338 48.1644 ------------------------------------------------------------------------------ F test of absorbed indicators: F(4, 62) = 1.117 Prob > F = 0.356 . predict fitted, xb . g sq_fitted=fitted^2 . areg mpg fitted sq_fitted, absorb(rep78) Linear regression, absorbing indicators Number of obs = 69 Absorbed variable: rep78 No. of categories = 5 F(2, 62) = 46.50 Prob > F = 0.0000 R-squared = 0.6939 Adj R-squared = 0.6643 Root MSE = 3.3990 ------------------------------------------------------------------------------ mpg | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- fitted | -.9305602 .9537856 -0.98 0.333 -2.83715 .9760302 sq_fitted | .0462785 .0227219 2.04 0.046 .0008582 .0916989 _cons | 19.24899 9.725618 1.98 0.052 -.1922457 38.69022 ------------------------------------------------------------------------------ F test of absorbed indicators: F(4, 62) = 1.278 Prob > F = 0.288 .
Comment