Hello Stata listers,

I am regressing a count outcome variable on an interaction using GMM and do not think I've used MARGINS correctly when attempting to plot the effects of this interaction.

My code is as follows:

gmm (f.flowsdint- exp({xb: c.rdint##c.simvar c.fdi3 stockgap totalli lnlocus5 size numdrug3 init }+{b0})), ///
instruments( `inst' c.rdint##c.simvar c.fdi3 totalli stockgap lnlocus5 size numdrug3 init , cons ) twostep vce(cluster firm )

quietly margins, at(rdint=(0(.4)4.65) simvar=(0 .7) ) atmeans expression(exp(predict(xb)))
marginsplot, plot1opts(lpattern(dash) lwidth(thick)) plot2opts(lpattern(longdash) lwidth(thick)) ///
noci title("c.rdint##c.simvar ") name(fdipat12, replace) graphregion(fcolor(white)) xtitle("R&D Intensity") ytitle("Citation Weighted Patents" )


where f.flowsdint is a firm's citation-weighted patent count in year+1. rdint is a firm's r&d intensity in year and simvar is a measure of research activity in year.

My results are:
GMM estimation

Number of parameters = 11
Number of moments = 12
Initial weight matrix: Unadjusted Number of obs = 1,049
GMM weight matrix: Cluster (firm)

(Std. err. adjusted for 361 clusters in firm)
----------------------------------------------------------------------------------
| Robust
| Coefficient std. err. z P>|z| [95% conf. interval]
-----------------+----------------------------------------------------------------
rdint | .3907011 .2034535 1.92 0.055 -.0080605 .7894627
simvar | -.6270033 .4541132 -1.38 0.167 -1.517049 .2630422
c.rdint#c.simvar | 1.055543 .5191094 2.03 0.042 .0381076 2.07297
fdi3 | -2.920182 1.69457 -1.72 0.085 -6.241479 .4011152
stockgap | .002953 .0005308 5.56 0.000 .0019127 .0039933
totalli | -.0512495 .0550264 -0.93 0.352 -.1590993 .0566003
lnlocus5 | .651147 .145428 4.48 0.000 .3661133 .9361807
size | .4684344 .0565983 8.28 0.000 .3575038 .5793649
numdrug3 | .0117014 .0438742 0.27 0.790 -.0742903 .0976932
init | .0216249 .0061251 3.53 0.000 .0096199 .0336299
-----------------+----------------------------------------------------------------
/b0 | -7.986238 .9439357 -8.46 0.000 -9.836318 -6.136158
----------------------------------------------------------------------------------
Instruments for equation 1: clintrial rdint simvar c.rdint#c.simvar fdi3 totalli stockgap lnlocus5 size numdrug3 init
_cons


My graph of the interaction via MARGINS and MARGINSPLOT is:

Array

My problem is that f.flowsdint's maximum value in my actual data is 200 but the predicted values (on my graph's y-axis) end around 250,000.
Based on other posts here (and elsewhere) I believe the statement of my MARGINS expression option [i.e., expression(exp(predict(xb))] may not account for my clustered standard errors (but I may be wrong).

Can anyone suggested improvements/corrections in my coding?

Thanks in advance for help. Have a good weekend,
Ed