set memory 500m use "CU_AFR.dta", clear set more off *********************************************** *** Table 1: Benchmark results, columns 1-9 *** *********************************************** * Column #7 * xtpqml rtrade_w0 cu ldist lrgdp_w0 lrgdppc_w0 comlang comborder fta landl island lareap comcol curcol evercol comctry , fe i(pairid) predict fitted7, xb gen yhat=exp(fitted7) egen meany=mean(rtrade_w0) if yhat !=., by(pairid) egen meanyhat=mean(yhat), by(pairid) gen exp_alpha=meany/meanyhat gen error_y=rtrade_w0 -yhat*exp_alpha su error_y