This is similar to a question that has been asked before previously: Testing for significant difference between coefficients from 2 different IV regressions (Stata or in general)
However, a difference here is that I would like to compare the coefficients off of the endogenous variable across models, where each model comes from a different sample.
It seems like this might be related to how Stata stores estimations that were run, but I don't know how to get around it. I may be setting up the GMM incorrectly too. I'm attaching where (a) the comparison runs ok since I'm not doing any conditioning on a specific sample; (b) the comparison does not run because I am conditioning; and (c) the comparison does not run when I try reshaping the data, as I am told that I have fewer observations than parameters (which I don't think is right; I think this is related to having missing data, since in other datasets that were not this example dataset I was told I could not reach a positive definite matrix. But again I might just be missing something with the GMM command).
Any help would be much appreciated!
However, a difference here is that I would like to compare the coefficients off of the endogenous variable across models, where each model comes from a different sample.
It seems like this might be related to how Stata stores estimations that were run, but I don't know how to get around it. I may be setting up the GMM incorrectly too. I'm attaching where (a) the comparison runs ok since I'm not doing any conditioning on a specific sample; (b) the comparison does not run because I am conditioning; and (c) the comparison does not run when I try reshaping the data, as I am told that I have fewer observations than parameters (which I don't think is right; I think this is related to having missing data, since in other datasets that were not this example dataset I was told I could not reach a positive definite matrix. But again I might just be missing something with the GMM command).
Any help would be much appreciated!
Code:
* This works cls sysuse auto, clear ivregress 2sls mpg (turn = weight), robust ivregress 2sls mpg (turn = length), robust gmm (eq1: mpg - {b1}*turn - {b0}) /// (eq2: mpg - {c1}*turn - {c0}), /// instruments(eq1: weight) /// instruments(eq2: length) /// onestep winitial(unadjusted, indep) test [b1]_cons = [c1]_cons * This does not work cls sysuse auto, clear ivregress 2sls mpg (turn = weight) if foreign==1, robust ivregress 2sls mpg (turn = weight) if foreign==0, robust gmm (eq1: mpg - {b1}*turn - {b0}) /// (eq2: mpg - {c1}*turn - {c0}), /// instruments(eq1: weight) /// instruments(eq2: weight) /// onestep winitial(unadjusted, indep) test [b1]_cons = [c1]_cons * Nor does this cls sysuse auto, clear reshape wide mpg turn weight, i(make) j(foreign) ivregress 2sls mpg0 (turn0 = weight0), robust ivregress 2sls mpg1 (turn1 = weight1), robust gmm (eq1: mpg0 - {b1}*turn0 - {b0}) /// (eq2: mpg1 - {c1}*turn1 - {c0}), /// instruments(eq1: weight0) /// instruments(eq2: weight1) /// onestep winitial(unadjusted, indep) test [b1]_cons = [c1]_cons