I would like to generate a table of margins in order to visualize a panel data regression model estimated via xtreg, fe. However, the margins command does not allow me to use the option predict(xbu), which would be needed to incorporate the fixed effect into the margins. Here is a (simplified) example:
Obviously, the predicted values se_adt_litr_zs_hat differ from se_adt_litr_zs_hat_fe, with the latter ones taking the fixed effect into account. Is there an alternative to estimate margins at specified values of the indepedent variable -- an alternative which includes the fixed effect?
Best regards,
Sebastian van Baal
Code:
wbopendata, language(en - English) country() topics() indicator(ST.INT.ARVL; SE.ADT.LITR.ZS) long clear encode countryname, generate(ctry) xtset ctry year xtreg se_adt_litr_zs st_int_arvl year, fe cl(ctry) predict se_adt_litr_zs_hat if e(sample) predict se_adt_litr_zs_hat_fe if e(sample), xbu margins, at(st_int_arvl=(1000000(1000000)10000000)) // This works (ignore the warning) margins, at(st_int_arvl=(1000000(1000000)10000000)) predict(xbu) // This is needed
Best regards,
Sebastian van Baal
Comment