Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Comparing coefficients from two ivregress models

 From John Antonakis To statalist@hsphsun2.harvard.edu Subject Re: st: Comparing coefficients from two ivregress models Date Sat, 17 Sep 2011 17:20:06 +0200

```Shoot!  Did not notice my mistake! Thank you so much Tirthankar!

Your solution with GMM is so simple and elegant.

```
FYI (and those listening who are interested), what I wanted to test is whether coefficients b1, c1 and d1 differed. So I did:
```
. test [b1]_cons = [c1]_cons = [d1]_cons

( 1)  [b1]_cons - [c1]_cons = 0
( 2)  [b1]_cons - [d1]_cons = 0

chi2(  2) =    0.66
Prob > chi2 =    0.7179

Works like a charm.

```
This Wald test is an alternative to the Hausman test (which when I run using 2SLS was undefined).
```
Best,
J.

__________________________________________

Prof. John Antonakis
Department of Organizational Behavior
University of Lausanne
Internef #618
CH-1015 Lausanne-Dorigny
Switzerland
Tel ++41 (0)21 692-3438
Fax ++41 (0)21 692-3305
http://www.hec.unil.ch/people/jantonakis

Associate Editor
__________________________________________

On 17.09.2011 17:13, Tirthankar Chakravarty wrote:
> John, as in the code I sent, you need to add another line continuation
> "///" at the end of your penultimate line.
>
> T
>
```
> On Sat, Sep 17, 2011 at 8:09 AM, John Antonakis <John.Antonakis@unil.ch> wrote: >> Pardon the typo.....it was "onestep" that I had written (and not "onstep").
```>> Thus the syntax was:
>>
>> gmm (eq1: turnover - {b1}*lmx - {b0}) ///
```
>> (eq2: turnover - {c1}*lmx - {c2}*l_incentives - {c3}*f_neuro - {c0}) ///
```>>    (eq3: turnover - {d1}*lmx - {d2}*l_incentives - {d3}*l_iq -
```
>> {d4}*c_policies - {d5}*f_neuro - {d0}), ///instruments(eq1: l_extra f_IQ f_consc) ///
```>>    instruments(eq2: l_extra f_IQ f_consc l_incentives f_neuro) ///
>>    instruments(eq3: l_extra f_IQ f_consc l_incentives l_iq c_policies
>> f_neuro)
>>
>> The error still remains.
>>
>> Best,
>> J.
>>
>> __________________________________________
>>
>> Prof. John Antonakis
>> Faculty of Business and Economics
>> Department of Organizational Behavior
>> University of Lausanne
>> Internef #618
>> CH-1015 Lausanne-Dorigny
>> Switzerland
>> Tel ++41 (0)21 692-3438
>> Fax ++41 (0)21 692-3305
>> http://www.hec.unil.ch/people/jantonakis
>>
>> Associate Editor
>> __________________________________________
>>
>>
>> On 17.09.2011 17:02, John Antonakis wrote:
>>> Hi Tirthankar:
>>>
>>> In fact, I estimated the following:
>>>
>>> gmm (eq1: turnover - {b1}*lmx - {b0}) ///
```
>>> (eq2: turnover - {c1}*lmx - {c2}*l_incentives - {c3}*f_neuro - {c0})
```>>> ///
>>>     (eq3: turnover - {d1}*lmx - {d2}*l_incentives - {d3}*l_iq -
>>> {d4}*c_policies - {d5}*f_neuro - {d0}), ///
>>>     instruments(eq1: l_extra f_IQ f_consc) ///
>>>     instruments(eq2: l_extra f_IQ f_consc l_incentives f_neuro) ///
>>>     instruments(eq3: l_extra f_IQ f_consc l_incentives l_iq c_policies
>>> f_neuro)
>>>
```
>>> When running the above, I then get (notice, it cuts it off after defining
```>>> the equation 3 instruments):
>>>
>>> . gmm (eq1: turnover - {b1}*lmx - {b0}) ///
```
>>>> (eq2: turnover - {c1}*lmx - {c2}*l_incentives - {c3}*f_neuro - {c0})
```>>>> ///
>>>>     (eq3: turnover - {d1}*lmx - {d2}*l_incentives - {d3}*l_iq -
>>>> {d4}*c_policies - {d5}*f_neuro
>>>>  - {d0}), ///
>>>>     instruments(eq1: l_extra f_IQ f_consc) ///
```
>>>> instruments(eq2: l_extra f_IQ f_consc l_incentives f_neuro) ///
```>>>>         instruments(eq3: l_extra f_IQ f_consc l_incentives l_iq
>>>> c_policies f_neuro)
>>> initial weight matrix not positive definite
>>> r(506);
>>>
>>> end of do-file
>>>
>>> r(506);
>>>
>>> The data are generated from :
>>>
>>> clear
>>> set seed 1234
>>> set obs 1000
>>>
>>> gen l_extra = 50+ 3*rnormal()
>>> gen l_incentives = 10 + 3*rnormal()
>>> gen l_iq = 110 + 3*rnormal()
>>> gen c_policies = 20 + 3*rnormal()
>>> gen f_IQ = 105 + 3*rnormal()
>>> gen f_consc = 40 + 3*rnormal()
>>> gen f_neuro = 35 + 3*rnormal()
```
>>> gen lmx = -250+l_extra + l_incentives + l_iq + f_IQ + f_consc - f_neuro+
```>>> 3*rnormal()
>>> gen turnover = +150 -l_incentives  -l_iq - c_policies + f_neuro +
>>>  3*rnormal()
>>>
>>> Best,
>>> J.
>>>
>>> __________________________________________
>>>
>>> Prof. John Antonakis
>>> Faculty of Business and Economics
>>> Department of Organizational Behavior
>>> University of Lausanne
>>> Internef #618
>>> CH-1015 Lausanne-Dorigny
>>> Switzerland
>>> Tel ++41 (0)21 692-3438
>>> Fax ++41 (0)21 692-3305
>>> http://www.hec.unil.ch/people/jantonakis
>>>
>>> Associate Editor
>>> __________________________________________
>>>
>>>
>>> On 17.09.2011 16:57, Tirthankar Chakravarty wrote:
>>>> You appear to have not included the
>>>>
>>>>
>>>> option in your joint estimation.
>>>>
>>>> T
>>>>
```
>>>> On Sat, Sep 17, 2011 at 7:02 AM, John Antonakis <John.Antonakis@unil.ch>
```>>>> wrote:
>>>>> Hi:
>>>>>
```
>>>>> I am trying to use the procedure suggested by Tirthankar below. I have
```>>>>> three
>>>>> equations that I would like to "stack" and then make cross-equations
>>>>> tests.
```
>>>>> When I estimate the three equations separately, things work well, as I
```>>>>> show
>>>>> below:
>>>>>
>>>>> . *Eq 1 alone
>>>>> . gmm (turnover - {b1}*lmx - {b0}), ///
>>>>>>     instruments(l_extra f_IQ f_consc) ///
>>>>> Step 1
>>>>> Iteration 0:   GMM criterion Q(b) =  2025.9871
>>>>> Iteration 1:   GMM criterion Q(b) =  .06748029
>>>>> Iteration 2:   GMM criterion Q(b) =  .06748029
>>>>>
>>>>> GMM estimation
>>>>>
>>>>> Number of parameters =   2
>>>>> Number of moments    =   4
```
>>>>> Initial weight matrix: Unadjusted Number of obs =
```>>>>>  1000
>>>>>
>>>>>
```
>>>>> ------------------------------------------------------------------------------
```>>>>>             |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
>>>>> Interval]
>>>>>
```
>>>>> -------------+----------------------------------------------------------------
```>>>>>         /b1 |   .0184804    .043515     0.42   0.671    -.0668075
>>>>>  .1037682
>>>>>         /b0 |    44.4598   1.313379    33.85   0.000     41.88563
>>>>>  47.03398
>>>>>
```
>>>>> ------------------------------------------------------------------------------
```>>>>> Instruments for equation 1: l_extra f_IQ f_consc _cons
>>>>>
>>>>> .
>>>>> . *Eq 2 alone
```
>>>>> . gmm (turnover - {c1}*lmx - {c2}*l_incentives - {c3}*f_neuro - {c0}),
```>>>>> ///
>>>>>>     instruments(l_extra f_IQ f_consc l_incentives f_neuro) ///
>>>>> Step 1
>>>>> Iteration 0:   GMM criterion Q(b) =  2044.3282
>>>>> Iteration 1:   GMM criterion Q(b) =  .09468009
>>>>> Iteration 2:   GMM criterion Q(b) =  .09468009
>>>>>
>>>>> GMM estimation
>>>>>
>>>>> Number of parameters =   4
>>>>> Number of moments    =   6
```
>>>>> Initial weight matrix: Unadjusted Number of obs =
```>>>>>  1000
>>>>>
>>>>>
```
>>>>> ------------------------------------------------------------------------------
```>>>>>             |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
>>>>> Interval]
>>>>>
```
>>>>> -------------+----------------------------------------------------------------
```>>>>>         /c1 |  -.0010489   .0324056    -0.03   0.974    -.0645627
>>>>>  .0624648
>>>>>         /c2 |  -.9454141   .0641511   -14.74   0.000    -1.071148
>>>>> -.8196802
>>>>>         /c3 |   1.026038   .0621628    16.51   0.000     .9042014
>>>>>  1.147875
>>>>>         /c0 |   18.40918   2.636117     6.98   0.000     13.24249
>>>>>  23.57588
>>>>>
```
>>>>> ------------------------------------------------------------------------------
```>>>>> Instruments for equation 1: l_extra f_IQ f_consc l_incentives f_neuro
>>>>> _cons
>>>>>
>>>>> .
>>>>> . *Eq 3 alone
>>>>> . gmm (turnover - {d1}*lmx - {d2}*l_incentives - {d3}*l_iq -
>>>>> {d4}*c_policies
>>>>> - {d5}*f_neuro - {d
>>>>>> 0}), ///
>>>>>>     instruments(l_extra f_IQ f_consc l_incentives l_iq c_policies
>>>>>> f_neuro)
>>>>>> ///
>>>>> Step 1
>>>>> Iteration 0:   GMM criterion Q(b) =  2062.4499
>>>>> Iteration 1:   GMM criterion Q(b) =  .00820186
>>>>> Iteration 2:   GMM criterion Q(b) =  .00820186  (backed up)
>>>>>
>>>>> GMM estimation
>>>>>
>>>>> Number of parameters =   6
>>>>> Number of moments    =   8
```
>>>>> Initial weight matrix: Unadjusted Number of obs =
```>>>>>  1000
>>>>>
>>>>>
```
>>>>> ------------------------------------------------------------------------------
```>>>>>             |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
>>>>> Interval]
>>>>>
```
>>>>> -------------+----------------------------------------------------------------
```>>>>>         /d1 |  -.0173308   .0183817    -0.94   0.346    -.0533583
>>>>>  .0186967
>>>>>         /d2 |  -.9578794   .0357112   -26.82   0.000    -1.027872
>>>>> -.8878869
>>>>>         /d3 |  -.9651611   .0365803   -26.38   0.000    -1.036857
>>>>>  -.893465
>>>>>         /d4 |   -1.02468   .0292714   -35.01   0.000    -1.082051
>>>>> -.9673096
>>>>>         /d5 |   1.000026   .0346869    28.83   0.000     .9320408
>>>>>  1.068011
>>>>>         /d0 |   146.6398   3.823647    38.35   0.000     139.1456
>>>>> 154.134
>>>>>
```
>>>>> ------------------------------------------------------------------------------
```>>>>> Instruments for equation 1: l_extra f_IQ f_consc l_incentives l_iq
>>>>> c_policies f_neuro _cons
>>>>>
>>>>>
```
>>>>> However, when I estimate them all together I get and error with respect
```>>>>> to
>>>>> the weight matrix not being positive-definite:
>>>>>
>>>>>
>>>>> . gmm (eq1: turnover - {b1}*lmx - {b0}) ///
>>>>>>     (eq2: turnover - {c1}*lmx - {c2}*l_incentives - {c3}*f_neuro -
>>>>>> {c0})
>>>>>> ///
>>>>>>     (eq3: turnover - {d1}*lmx - {d2}*l_incentives - {d3}*l_iq -
>>>>>> {d4}*c_policies - {d5}*f_neuro
>>>>>>  - {d0}), ///
>>>>>>     instruments(eq1: l_extra f_IQ f_consc) ///
>>>>>>         instruments(eq2: l_extra f_IQ f_consc l_incentives f_neuro)
>>>>>> ///
>>>>>>         instruments(eq3: l_extra f_IQ f_consc l_incentives l_iq
>>>>>> c_policies
>>>>>> f_neuro)
>>>>> initial weight matrix not positive definite
>>>>>
>>>>> Is there anyway to get around this?
>>>>>
>>>>> Thanks,
>>>>> John.
>>>>>
>>>>> __________________________________________
>>>>>
>>>>> Prof. John Antonakis
>>>>> Faculty of Business and Economics
>>>>> Department of Organizational Behavior
>>>>> University of Lausanne
>>>>> Internef #618
>>>>> CH-1015 Lausanne-Dorigny
>>>>> Switzerland
>>>>> Tel ++41 (0)21 692-3438
>>>>> Fax ++41 (0)21 692-3305
>>>>> http://www.hec.unil.ch/people/jantonakis
>>>>>
>>>>> Associate Editor
>>>>> __________________________________________
>>>>>
>>>>>
>>>>> On 08.09.2011 10:48, Tirthankar Chakravarty wrote:
>>>>>> Use -gmm- and specify that you want the equations to be considered
>>>>>> independently (the moment conditions are independent). Note that the
```
>>>>>> point estimates are identical from two independent calls to -ivregress >>>>>> 2sls- and the corresponding -gmm-. Throughout, "turn" is the included
```>>>>>> endogenous variable.
>>>>>>
>>>>>> /**********************************************/
>>>>>> sysuse auto, clear
>>>>>> ivregress 2sls mpg gear_ratio (turn = weight length headroom)
>>>>>> ivregress 2sls mpg gear_ratio length (turn = weight length headroom)
>>>>>>
>>>>>> gmm (eq1: mpg - {b1}*turn - {b2}*gear_ratio - {b0}) ///
```
>>>>>> (eq2: mpg - {c1}*turn - {c2}*gear_ratio -{c3}*length - {c0}), ///
```>>>>>>     instruments(gear_ratio weight length headroom) ///
>>>>>> test [b2]_cons = [c2]_cons
>>>>>> /**********************************************/
>>>>>>
>>>>>> T
>>>>>>
```
>>>>>> On Thu, Sep 8, 2011 at 1:12 AM, Maarten Buis <maartenlbuis@gmail.com>
```>>>>>> wrote:
>>>>>>> On Thu, Sep 8, 2011 at 9:56 AM, YUNHEE CHANG wrote:
```
>>>>>>>> I am estimating two differently-specified IV regressions and trying
```>>>>>>>> to
>>>>>>>> compare coefficients between the two models. I tried:
>>>>>>>>
>>>>>>>> ivregress 2sls y x1 x2 (x1=z)
>>>>>>>> est store reg1
>>>>>>>>
>>>>>>>> ivregress 2sls y x1 x2 x3 (x1=z)
>>>>>>>> est store reg2
>>>>>>>>
>>>>>>>> test [reg1]_b[x1]=[reg2]_b[x1]
>>>>>>>>
```
>>>>>>>> Then I get "equation [reg1] not found" error. What am I doing wrong?
```>>>>>>> That might have worked after you combined both models with -suest-,
>>>>>>> but -ivregress- cannot be used together with -suest-. So what you
>>>>>>> want
>>>>>>> cannot be done.
>>>>>>>
>>>>>>> Sorry,
>>>>>>> Maarten
>>>>>>>
>>>>>>> --------------------------
>>>>>>> Maarten L. Buis
>>>>>>> Institut fuer Soziologie
>>>>>>> Universitaet Tuebingen
>>>>>>> Wilhelmstrasse 36
>>>>>>> 72074 Tuebingen
>>>>>>> Germany
>>>>>>>
>>>>>>>
>>>>>>> http://www.maartenbuis.nl
>>>>>>> --------------------------
>>>>>>> *
>>>>>>> *   For searches and help try:
>>>>>>> *   http://www.stata.com/help.cgi?search
>>>>>>> *   http://www.stata.com/support/statalist/faq
>>>>>>> *   http://www.ats.ucla.edu/stat/stata/
>>>>>>>
>>>>> *
>>>>> *   For searches and help try:
>>>>> *   http://www.stata.com/help.cgi?search
>>>>> *   http://www.stata.com/support/statalist/faq
>>>>> *   http://www.ats.ucla.edu/stat/stata/
>>>>>
>>>>
>>> *
>>> *   For searches and help try:
>>> *   http://www.stata.com/help.cgi?search
>>> *   http://www.stata.com/support/statalist/faq
>>> *   http://www.ats.ucla.edu/stat/stata/
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```