Dear Statalist:

I am trying to make a comparison similar to that in Columns 1 and 2 of Table 6 in the paper http://www.ericzwick.com/stimulus/stimulus.pdf, which I have reproduced here:

Array

I am running the separate models using the code:

Code:
xi: ivreg2 outcome (treatment = instrument) control1 control2 i.year i.province if small == 1 [pw=triangle], cluster(clusterid)
estimates store ModelA
xi: ivreg2 outcome (treatment = instrument) control1 control2 i.year i.province if small == 0 [pw=triangle], cluster(clusterid)
estimates store ModelB
outcome is continuous, treatment is binary, the instrument is binary and small = 1 for the bottom 3 deciles of sales (within year province), 0 for the top 3 deciles, and missing otherwise. Triangle are triangular kernel weights.

I would like to compare the coefficients on treatment to see if they are significantly different.

1. The first part of my question is a Stata question: How do I properly code this comparison?

What I have tried:

I have found https://stats.idre.ucla.edu/stata/co...s-using-suest/, where the answer was to use suest. This does not appear to work with ivreg2; it throws errors for my triangular kernel weights and because ivreg2 doesn't cluster using vce(cluster).
(specifically my errors are "ModelA was estimated with pweights, you should re-estimate using iweights" and "ModelA was estimated with a nonstandard vce (cluster)")

Alternatively, I found https://www.stata.com/statalist/arch.../msg00487.html, which looked perfect.

Code:
gmm                                      ///
 (eq1: outcome - {b1}*treatment - {b2}*control1 - {b3}*control2 - {b0} if small == 1)       ///
 (eq2: outcome - {b1}*treatment - {b2}*control1 - {b3}*control2 - {b0} if small == 0),      ///
    instruments(eq1: instrument control1 control2)     ///
    instruments(eq2: instrument control1 control2)             ///
    onestep winitial(unadjusted, indep)

But it seems that I am unable to use if statements within the equation definitions using gmm. My error is "could not evaluate equation 1 r(498)."

Am I correct I cannot use these methods for my setting, or am I simply not setting them up correctly?


2. The second part of my question is more of a statistical question, but is related to my first because it concerns another way I have tried to do sub-sample analysis:

A final way I have found to do this is to estimate a pooled regressions including interactions with my small dummy

Code:
g treatxsmall = treatment*small
    g instrumentxsmall = instrument*small
    xi: ivreg2 outcome (treatment treatxsmall = instrument instrumentxsmall) small control1 control2 i.year i.province [pw = triangle] if small != ., cluster(clusteridi)
Am I correct in believing that then the coefficient on treatxsmall will tell me if the difference between small firms and large firms is significant, i.e., could I report the p-value in the table as the p-value in the above table?

From looking at the replication code included with the published version of the paper, that appears to be what the authors do, i.e., run the sub-sample regressions and report their coefficients and standard errors and then run the pooled regression and report the p-value on the interaction term between the subsample indicator and treatment. However, their code is quite advanced for my level (they appear to use nested Stata sub-routines they can call repeatedly ("program define...")) and I find it hard to back out what they are doing from code alone while the underlying data is confidential so I can't reverse-engineer it easily.

I am using Stata/MP, version 14.2


Thank you for your time, Ellen