Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Double Hurlde Models


From   "Chris Thomas" <[email protected]>
To   [email protected]
Subject   st: Double Hurlde Models
Date   Mon, 22 Aug 2005 16:07:22 +0000

I was wondering whether anyone would be help with a problem Im having with building Double Hurdle models in stata. I have the following code from a recently published article but stata says that d is an �ambiguous abbreviation�. If I change the name of the variable d to dd throughout the program, then I get a different error message � variable dd not found.
I was wondering whether there was an obvious mistake that is immediately noticable in my work (included below), or whether there is some precode that I need before the program will function correctly.


rename loss_only y
capture program drop dh

program define dh
version 6
args lnf theta1 theta2 theta3 theta4
tempvar d p z p0 p1 l yt

quietly gen double `d'=$ML_y1>0
quietly gen double `p'=normprob(`theta3')
quietly gen double `l'=`theta4'
quietly gen double `yt'=($ML_y1^`l'-1)/`l'
quietly gen double `z'=(`yt'-`theta1')/(`theta2')
quietly gen double `p0'=1-(`p'*normprob(-`z'))
quietly gen double `p1'=(($ML_y1+(1-`d'))^(`l'-1))*`p'*normd(`z')/`theta2'
quietly replace `lnf'=ln((1-`d')*`p0'+`d'*`p1')
end

ml model lf dh (y = curr_bal) () (d= gbp) ()
ml search
ml maximize

I have just included curr_bal and gbp as two example independents I plan on using to predict loss_only (y).

Thanks

Chris


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index