Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: question with MLE and complex model


From   Partha Deb <partha.deb@hunter.cuny.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: question with MLE and complex model
Date   Wed, 30 Jul 2008 11:56:42 -0400

Jonathan,

It appears that the model you are trying to estimate (in principle) is a finite mixture of 3 normal densities - your code is not quite that, however. Unless you are sure yours is the model you want, I suggest you estimate a standard finite mixture model for the problem you describe. You can code that up yourself or use -fmm- . -findit fmm- will get you to the link to install it.

Best.

Partha


Jonathan Hanson wrote:

Greetings,

I am working on an MLE procedure to use in situations where there may be distinct, or at least mostly distinct, causal processes at work for different parts of the sample. For example, suppose there are three different states of the world, and the coefficients on key explanatory variables vary across these states. Additionally, suppose that there is a set of variables that determines (probabilistically) the extent to which to a particular case falls into each state.

In other words, I have three linear models: mod1, mod2, and mod3. Also, I have a weighting function, similar to that used in multinomial logit, that estimates a set of weights that sum to 1: p1 + p2 + p3.

I am fairly new to ML programming, so I started with the ML version of a standard linear regression (with adjustments to s_e suggested by Gould and Sribney) and incorporated the three linear models with their corresponding weighting functions. The trouble is, when I try to estimate the model, Stata goes through thousands of iterations, nearly all of which report "not concave". Convergence is achieved only rarely, and it depends very much upon specification.

program define stage3ml
args lnf mod1 st1 mod2 st2 mod3 ctrls s_e
tempvar den p1 p2 p3
quietly gen double `den' = 1 + exp(`st1') + exp(`st2')
quietly gen double `p1' = exp(`st1')/`den'
quietly gen double `p2' = exp(`st2')/`den'
quietly gen double `p3' = 1/`den'
quietly replace `lnf'=ln(normalden(($ML_y1 - `p1'*`mod1' - `p2'*`mod2' - `p3'*`mod3' - `ctrls')/exp(`s_e'))) - `s_e'
end

ml model lf stage3ml (mod1: y = x1 x2 x3) (p1: z1 z2 z3) (mod2: x1 x2 x3) (p2: z1 z2 z3) (mod3: x1 x2 x3) (ctrs: ) ()

Any advice on what steps I should next take would be greatly appreciated!

Many thanks,

Jonathan Hanson
Assistant Professor of Political Science
Maxwell School of Citizenship and Public Affairs
100 Eggers Hall
Syracuse University
Syracuse, NY 13244
johanson@maxwell.syr.edu




*
* 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
Department of Economics
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index