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