xtreg y x, fe
est store m_fe
est table m_ols m_fe, b(%6.3f) star(0.1 0.05 0.01)
*---拟合值和残差
* y_it = u_i + x_it*b + e_it
* predict newvar, [option]
/*
xb xb, fitted values; the default
stdp calculate standard error of the fitted values
ue u_i + e_it, the combined residual
xbu xb + u_i, prediction including effect
u u_i, the fixed- or random-error component
e e_it, the overall error component */
xtreg market invest stock, fe
predict y_hat
predict a , u
predict res , e
predict cres, ue
gen ares = a + res
list ares cres in 1/10