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: RE: biprobit error (note:constraint number 1 caused error (303)


From   Lina Marcela Cardona Sosa <[email protected]>
To   [email protected]
Subject   Re: st: RE: biprobit error (note:constraint number 1 caused error (303)
Date   Wed, 13 Oct 2010 08:35:45 +0100

Dear Nick and Marteen Buis, thanks a lot for your soon reply.

Dear Nick,
I decided to read the stata tip 85 following the answer some one gave
to another stata user that got the same error(303), even thought the
program was different, the error was the same so I decided to read the
Stata tip 85 in case I could get something.

The program I am running is the following. When the program is
estimating the probit that has the constraint, the error appears but
still give me the final outcome.

I would appreciate any help,

Many thanks,

Regards,

Lina.

************************************************************************************
*Based on Program made by Todd/Altonji/Taber(2005)*
*Please cite it if you use it*********************************

gen rhoold=1
local rhoold=rhoold

biprobit (y2 = $xvars) (y1 = y2 $xvars)
predict xb1, xb1
gen xbb1=xb1
egen sdxbeta=sd(xbb1)
gen vxbeta=sdxbeta*sdxbeta

predict xb2, xb2
gen xbb2=xb2
egen sdxgamma=sd(xbb2)
gen vxgamma=sdxgamma*sdxgamma
egen sdxpy=sd(xbb1+xbb2)
gen varxpy=sdxpy*sdxpy
gen covxbxg=(varxpy-vxbeta-vxgamma)/2

gen rhonew=covxbxg/vxgamma
sum rhonew

local iter=1

while abs(rhoold-rhonew)>0.001 {
	replace rhoold=rhonew
	local rhoold=rhoold
	display "iteration `iter'"
	local iter=`iter' + 1
	local athrho=1/2*ln((1+rhoold)/(1-rhoold))

	constraint define 1 [athrho]_cons=`athrho'
	drop xb1 xb2 xbb1 xbb2 sdxbeta vxbeta sdxgamma vxgamma sdxpy varxpy
covxbxg rhonew

	qui biprobit (y2 = $xvars) (y1 = y2 $xvars), constraint(1)
	predict xb1, xb1
	gen xbb1=xb1
	egen sdxbeta=sd(xbb1)
	gen vxbeta=sdxbeta*sdxbeta
	
	predict xb2, xb2
	gen xbb2=xb2
	egen sdxgamma=sd(xbb2)
	gen vxgamma=sdxgamma*sdxgamma			
	egen sdxpy=sd(xbb1+xbb2)
	gen varxpy=sdxpy*sdxpy
	gen covxbxg=(varxpy-vxbeta-vxgamma)/2	

	gen rhonew=covxbxg/vxgamma

	sum rhoold rhonew
	}
	
** Correcting standard errors of the final estimation **
set seed 12345
bootstrap _b, reps(250): biprobit (y2 = $xvars) (y1 = y2 $xvars), constraint(1)

*Based on Program made by Todd/Altonji/Taber(2005)*
*Please cite it if you use it**********************
************************************************************************************



2010/10/12 Nick Cox <[email protected]>:
> The second reference I can supply as
>
> SJ-10-1 pr0051  . . . . . . . . . . . . Stata tip 85: Looping over nonintegers
>        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
>        Q1/10   SJ 10(1):160--163                                (no commands)
>        tip on using forvalues to loop over numbers
>
> but quite what it has to do with your problem I cannot say. I cannot imagine any connection.
>
> We need _precise_ detail:
>
> 1. What exactly is the constraint and how did you specify it?
>
> 2. What exactly did you type to get a bivariate probit model?
>
> 3. Precisely which email are you referring to? (It will have a URL.)
>
> Nick (not a Professor!)
> [email protected]
>
> Lina Marcela Cardona Sosa
>
> I am running a bivariate probit with a constraint. The constraint is
> built following a previous loop. If the condition holds it creates the
> constraint for the arthrho and then I use the constraint in the
> bivariate probit. Once the bivariate probit is running I got the note
> (note:constraint number 1 caused error (303) when the bivariate is
> fitting equation 1 and equation 2. In any case the bivariate continues
> and give me the final outcome. I am not sure whether is an actual
> error or if it was just a comment to take into account.
>
> In past stata lists someone got that error and someone addressed him
> to the Stata Journal, STATA TIP 85 written by professor Cox. I have
> read the article and it is most about looping among integers. actually
> my loop is on several iterations that are integers..so still I do not
> know what my problem is.
>
>
> *
> *   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/
>



-- 
Lina Marcela Cardona Sosa
0044(0)7728856936

"The good life is one inspired by love and guided by knowledge" B.Russell

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