Consider the following example that estimates the individual heterogeneity (or fixed-effects).
As the Stata manual "xtreg postestimation" page 2 states, the predict, u command caculates the heterogeneity only for the estimation sample (i.e. for the individuals with msp == 1).
Here, I want to estimate the heterogeneity for individuals with msp == 0.
So, I used the if condition:
But, the returns are just missing values.
Of course, I can fill the missing values manually (with additional command lines).
However, I am now wondering whether there is a way to get the estimates using one predict command.
If that is possible, how can I do that?
Code:
clear all webuse nlswork quietly xtset idcode year quietly xtreg ln_wage age i.race wks_work if msp == 1, fe predict het1, u
Here, I want to estimate the heterogeneity for individuals with msp == 0.
So, I used the if condition:
Code:
predict het0 if !e(sample), u
Of course, I can fill the missing values manually (with additional command lines).
However, I am now wondering whether there is a way to get the estimates using one predict command.
If that is possible, how can I do that?