这是一些作者给的的程序,可以出来,我试过了。改第一个命令就行。
* Estimate the model
poisson trade lypex lypim lyex lyim ldist border comlang colony landl_ex landl_im lremot_ex lremot_im comfrt_wto open_wto, robust
* Get fitted values of trade
predict fitted
* Compute correlation between trade and fitted values
qui cor fitted trade
* Display R2 computed as the square of the correlation between trade and fitted values
di as txt " R-squared " (`r(rho)')^2