This is partly a statistics question. The xt
context here makes no difference to a standard feature of regression: if no predictors are specified, then the prediction returned is necessarily constant and equal to the mean response. We can't see your data, but the principle is universal. Here is a reproducible example:
. webuse grunfeld
. xtset
panel variable: company (strongly balanced)
time variable: year, 1935 to 1954
delta: 1 year
. xtreg mvalue
Random-effects GLS regression Number of obs = 200
Group variable: company Number of groups = 10
R-sq: Obs per group:
within = 0.0000 min = 20
between = 0.0000 avg = 20.0
overall = 0.0000 max = 20
Wald chi2(0) = .
corr(u_i, X) = 0 (assumed) Prob > chi2 = .
------------------------------------------------------------------------------
mvalue | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_cons | 1081.681 422.1377 2.56 0.010 254.3064 1909.056
-------------+----------------------------------------------------------------
sigma_u | 1332.6401
sigma_e | 348.51426
rho | .93598465 (fraction of variance due to u_i)
------------------------------------------------------------------------------
. predict predict
(option xb assumed; fitted values)
. su predict
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
predict | 200 1081.681 0 1081.681 1081.681
. su mvalue
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
mvalue | 200 1081.681 1314.47 58.12 6241.7
Note that the names you use (examples in your case xb
and u
) have no implications for what is produced by predict
. The default of predict
in either case, with no predictors specified, is the predicted mean outcome.
You should check out the options of predict
in this case, such as
predict u, u