Bookmark and Share

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Introducing constraints to biprobit model


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Introducing constraints to biprobit model
Date   Tue, 28 Aug 2012 14:35:23 +0100

There is plenty of good will to help you, but there is no way round
this: you have yet to post the entire syntax that you used. So I don't
think anyone can see what you are doing wrong even in trying to
reproduce Maarten's example. This logic should seem compelling even to
first-time posters.

Nick

On Tue, Aug 28, 2012 at 12:50 PM, Huybregts <[email protected]> wrote:
> Nick, you're quite right, it' s the first time I post here, thought it would add my first message as well.
> Maarten corrected mistakes in my original coding (so that's solved).  My remaining question is regarding the code he proposed.
>
> If I run Maarten's code, for the "model with constraints" (biprobit (cat mpg price) (foreign mpg price), constraint (1 2),
> I get the error message:
> (note: constraint number 1 caused error r(111))  ( no variables defined;)
> (note: constraint number 2 caused error r(111))
> It does not seem to accept the constraints, but runs the full model nevertheless. Can I assume for this that since the constraints entail coefficients from both models, when stata runs model 1 and model 2 separately it cannot apply the constraints because they are not known yet (seems logic enough). Just to be sure. The LR test gives results do I assume that stata acknowledged the constraints (as difference in df).
>
> Thanks for your help and sorry for the mess,
> Lieven
>
>
>
> On Aug 28, 2012, at 11:29 AM, Nick Cox wrote:
>
>> Asking this question without showing what you typed wastes everybody's time.
>>
>> What is the entire and exact syntax that you typed?
>>
>> Can you reproduce Maarten's example? What is different about what you typed.
>>
>> Nick
>>
>> On Tue, Aug 28, 2012 at 10:29 AM, Huybregts <[email protected]> wrote:
>>> Many thanks for the reply and the coding Maarten, however if I run the model with constraints, I get the error message:
>>> (note: constraint number 1 caused error r(111))  ( no variables defined;)
>>> (note: constraint number 2 caused error r(111))
>>>
>>> It does not seem to accept the constraints, but runs the full model nevertheless. Can I assume for this that since the constraints entail coefficients from both models, when stata runs model 1 and model 2 separately it cannot apply the constraints because they are not known yet (seems logic enough). Just to be sure.
>>> Cheers,
>>>
>>> Lieven
>>>
>>>
>>>
>>>
>>> On Aug 28, 2012, at 11:05 AM, Maarten Buis wrote:
>>>
>>>> sysuse auto.dta,clear
>>>> egen cat=cut(rep78),grou(2) label
>>>>
>>>> // model without constraints
>>>> biprobit (cat mpg price)      ///
>>>>        (foreign mpg price)
>>>> estimates store R1
>>>>
>>>> // replay the model, but see the coefficient names:
>>>> biprobit, coeflegend
>>>>
>>>> // use those name to define the constraints
>>>> constraint define 1  _b[cat:mpg]   =  _b[foreign:mpg]
>>>> constraint define 2  _b[cat:price] =  _b[foreign:price]
>>>>
>>>> // Model with constraints
>>>> biprobit (cat mpg price) ///
>>>>        (foreign mpg price), constraint (1 2)
>>>> estimates store R2
>>>> lrtest R1 R2
>
>
>
>>> On Aug 28, 2012, at 10:05 AM, Huybregts wrote:
> <Dear Stata listers,
> <
> <To test if two binary outcomes have the same underlying pattern of predictors, we compared 2 biprobit models (one with constraints, one without) using a LR test. However we encounter a <recurring error for which we can't find a solution. To make this understandable I use the auto.dta dataset to replicate our problem from a different dataset.
> <
> <************************************************
> sysuse auto.dta,clear
> egen cat=cut(rep78),grou(2) label
>
> * model without constraints
> xi: biprobit (cat mpg price) (foreign mpg price)
> estimates store R1
> matrix define coef=e(b)
> matrix list coef
> constraint define 1 coef[1,1] = coef[1,4]
> constraint define 2 coef[1,2] = coef[1,5]
>
> * Model with constraints
> xi: biprobit (cat mpg price) (foreign mpg price), constraint (1 2)
> estimates store R2
> lrtest R1 R2
> <************************************************
> <The error I get is (just after the model with constraints)
> <
> <Fitting comparison equation 1:
> <(note: constraint number 1 caused error r(131))
> <(note: constraint number 2 caused error r(131))
> <
> <I did not find a similar problem on the statalist, would it be impossible for the biprobit to converge adding constraints of equal coefficients?
> <I use Stata 11.1.
> <Many thanks for any help anyone could provide.
> <

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index