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   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: Introducing constraints to biprobit model
Date   Tue, 28 Aug 2012 11:05:59 +0200

--- On Tue, Aug 28, 2012 at 10:17 AM, Huybregts wrote:
> 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.
<snip>
> * 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)
<snip>
> The error I get is (just after the model with constraints)
> (note: constraint number 1 caused error r(131))
> (note: constraint number 2 caused error r(131))

In general in Stata one never refers to coefficients by their location
in a matrix and always by their name. For more see the helpfile for
-constraint-. Below is an example that works.

*------------------- begin example ----------------------
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
*-------------------- end example -----------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )

Hope this helps,
Maarten

---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
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/


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