sergiocorreia / ivreghdfe

Run IV/2SLS with many levels of fixed effects (i.e. ivreg2+reghdfe)
MIT License
77 stars 27 forks source link

Test for equality of coefficients of 2 different regressions #23

Open hangbh opened 4 years ago

hangbh commented 4 years ago

Hi Sergio, I'm using ivreghdfe to run 2 different regressions for 2 different samples. E.g. ivreghdfe y d (x=z) if sample==1, absorb(a) cluster(clustervar) ivreghdfe y d (x=z) if sample==2, absorb(a) cluster(clustervar) After having the result, I want to test if the coefficients on the endogenous variable (e.g. x) of the two regressions are similar or not. I process according to what is written here https://www.stata.com/statalist/archive/2009-11/msg01485.html . i.e. g d1=d(sample==1) g d2=d(sample==2) g x1=x(sample==1) g x2=x(sample==2) g z1=z(sample==1) g z2=z(sample==2) ivreghdfe y d? (x?=z?), absorb(a) cluster(clustervar)

But three problems occur: i) Cluster: The cluster variable in the "stacked" regression should be sample. But in my original regression, the standard error is clustered at the clustervar level. How should I deal with the cluster in the "stacked" regression in this case? Can I do like the following: egen clid=group(sample clustervar) ivreghdfe y d? (x?=z?), absorb(a) cluster(clid) ii) Fixed effect in the absorb option: do I need to generate a1=a(sample==1) and a2=a(sample==2), and use absorb(a?) instead of absorb(a) in the "stacked" regression? iii) If I run the above "stacked" regression (i.e. ivreghdfe y d? (x?=z?), absorb(a) cluster(clustervar)), the coefficients on the endogenous variable for 2 different samples in the "stacked" regression are the same as the ones in the two original regressions, but the coefficients on the exogenous variable for 2 different samples in the "stacked" regression is different to the ones in the two original regressions. Did I make any mistake here?

I highly appreciate if you could reply to my questions. Thank you!