Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Introducing constraints to biprobit model


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Introducing constraints to biprobit model
Date   Tue, 28 Aug 2012 10:29:47 +0100

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 <lievenhu@gmail.com> 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

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index