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


From   Partha Deb <[email protected]>
To   [email protected]
Subject   Re: st: MLE Non-linear Program
Date   Fri, 19 Nov 2010 21:31:01 -0500

Steven,

I have a number of thoughts.

1. I'm not sure why you need to estimate your model using ML. A simple transformation of your model parameters renders the model linear in parameters, i.e., you can write

`xb'=`a0'+ `a1'*lnwaterdist +`a2'*totindexa  ///
+ `b1'*(forestsaa+`lambda'*forest_vdc5a)+ `b2'*(ldistkillnov+`gamma'*ltotkill)

can easily be written as

`xb'=`a0'+ `a1'*lnwaterdist +`a2'*totindexa  ///
+ `b11'*forestsaa + `b12'*forest_vdc5a + `b21'*ldistkillnov + `b22'*ltotkill

and this can be estimated using -regress- . Following regress, you can use -nlcom- to recover b1, lambda, b2 and gamma.

2. It does seem a bit odd that lambda is a logit type transformation of kappa, but after creating lambda2 as a logit transformation of gamma, it does not enter the specification.

3. An argument against what I have suggested is that your specification constrains lambda and lambda2 to be in (0,1) while OLS will not respect that. Perhaps this is an important constraint, but if it is true, OLS should recover that. Else, it might be evidence that your model is misspecified.

5. Why not use -lnnormalden- to specify the normal density? You would be sure then, that there are no coding errors there.

6. sigma should be constrained to be positive. The Stata-ish solution is to think of lnsigma as the parameter and specify sigma = exp(lnsigma).

Hope this helps.

Partha



On 11/19/2010 2:03 PM, Steven Archambault wrote:
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/

--
Partha Deb
Professor of Economics
Director of Graduate Studies
Hunter College
ph:  (212) 772-5435
fax: (212) 772-5398
http://urban.hunter.cuny.edu/~deb/

Emancipate yourselves from mental slavery
None but ourselves can free our minds.
	- Bob Marley

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