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 Non-linear Program


From   Steven Archambault <[email protected]>
To   [email protected]
Subject   st: MLE Non-linear Program
Date   Fri, 19 Nov 2010 12:03:18 -0700

Hi all,
I am running this MLE nonlinear program below. It has trouble
converging , I guess because of the complexity of having to estimate
kappa and gamma. Does anybody have any suggestions for improving the
code, while still getting estimates for gamma and kappa?
It works fine for estimating kappa only and gamma only. Thanks!

capture program drop simplemle
program simplemle
args lnL a0 a1 a2 eta b1 b2 kappa gamma
tempvar xb sigma lambda lambda2
quietly gen double `lambda'=exp(`kappa')/(1+exp(`kappa'))
quietly gen double `lambda2'=exp(`gamma')/(1+exp(`gamma'))
quietly gen double `xb'=`a0'+ `a1'*lnwaterdist +`a2'*totindexa  ///
+ `b1'*(forestsaa+`lambda'*forest_vdc5a)+ `b2'*(ldistkillnov+`gamma'*ltotkill)

quietly gen double `sigma'=exp(`eta')
quietly replace
`lnL'=-.5*ln(2*_pi)-.5*ln((`sigma')^2)-.5*(foodindx10-`xb')^2/(`sigma')^2
end
ml model lf simplemle (a0:) (a1:) (a2:) (eta:) (b1:) (kappa:) (b2:) (gamma:)
ml init  1 1 .1 .1 .1 1 1 1 , copy
ml maximize

I get messages like: (Iteration 70:  log likelihood = -3354.8283  (not concave)
numerical derivatives are approximate

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