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]

st: MLE issues


From   Ishani Tewari <[email protected]>
To   statalist <[email protected]>
Subject   st: MLE issues
Date   Fri, 26 Jul 2013 16:23:24 -0400

Dear all
I have the following MLE program but upon maximizing immediately get "could
not find feasible values".  My instinct is that as a newcomer to Stata  ml
programming, I have done something very basic wrong like specifying too
many parameters.The goal of the program is to estimate parameters beta0-t
on ownership of various durables, prices, wages, household size
thank you!

program drop logit2_lf
program define logit2_lf
version 12.1
*Arguments of program
args lnf beta0 beta1 alpha0 alpha1 alpha2 tau0 tau1 v b t

*Declaring variables
tempvar ch owntv ownfr ownwash ownmb size prtv w nw EU_TV beta_a tmp
alpha_a tau_a bta k

*Initializing data
gen double `ch' = $ML_y1
gen double `owntv' = $ML_y2
gen double `ownfr' = $ML_y3
gen double `ownwash'=$ML_y4
gen double `ownmb'=$ML_y5
gen double `size'=$ML_y6
gen double `prtv'=$ML_y7
gen double `w'=$ML_y8
gen double `nw'=$ML_y9

quietly{
*Evaluate utility function
gen double `beta_a' = `beta0' + `beta1' * `owntv'
gen double `alpha_a' = `alpha0'+ (`alpha1' * `ownfr') + (`alpha2' * `ownwash')
gen double `tau_a'=`tau0'+(`tau1' * `ownmb')
gen double `bta'=exp(`beta_a')/(1+exp(`beta_a'))
gen double `k'=`bta'/(1-`bta')

*Expected utility
gen double `EU_TV'=((`k'*`w'^(-`bta'))*(`v'*`nw'-`b'*`prtv'+`alpha_a'*log(`alpha_a'/`w')))+((`k'*(`w'^(1-`bta')))*(`t'*`size'-`tau_a'-log(`alpha_a'/`w')))

*evaluate likelihood
replace `lnf' = ln(invlogit(`EU_TV')) if `ch'==1
replace `lnf' = ln(invlogit(-`EU_TV')) if `ch'==0
}

end

ml model lf logit2_lf (choicetv ownlagtv ownlagfridge ownlagwashing
ownlagmotorbike HH_size valtv wages nonwage=)

ml max, difficult
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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