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: ml mixture distribution
From
Maarten Buis <[email protected]>
To
[email protected]
Subject
Re: st: ml mixture distribution
Date
Mon, 9 Jul 2012 18:25:36 +0200
Have you looked at -fmm- (In stata type: -ssc desc fmm-)?
Hope this helps,
Maarten
On Mon, Jul 9, 2012 at 6:14 PM, Lukas Kornher <[email protected]> wrote:
> Dear Statalisters,
>
> I am trying to set up a ml model for a mixture distribution function with
> three regimes. Stata cannot find a maximum and returns:
> /could not calculate numerical derivatives -- discontinuous region with
> missing values encountered/.
> I am quite new to ml in Stata and I find very little on mixture distribution
> on the web and in MLE with Stata. Any comments would be really appreciated.
> Especially how one can constraint the sum of the regime probabilities to 1.
> Many thanks.
>
> Lukas
>
> STATA CODE:
>
> program define pbm_mixture ;
> args todo b lnf;
> tempvar lnf_j;
> tempname lambda1 lambda2 sigma_1 sigma_2 sigma_3 mu;
> scalar `mu' = `b'[1,1];
> scalar `sigma_1' = exp(`b'[1,2]);
> scalar `sigma_2' = exp(`b'[1,3]);
> scalar `sigma_3' = exp(`b'[1,4]);
> scalar `lambda1' = normal(`b'[1,5]);
> scalar `lambda2' = normal(`b'[1,6]);
> gen double `lnf_j' =
> `lambda1' * (1/`sigma_1') * normalden(($ML_y1 - `mu')/`sigma_1') +
>
>
> `lambda2'*(2/sqrt(`sigma_1'^2+`sigma_2'^2)) * normalden(($ML_y1 - `mu')/
> sqrt(`sigma_1'^2+`sigma_2'^2))*
> (1-normal((-($ML_y1 - `mu')*(`sigma_1'/`sigma_2'))/
> sqrt(`sigma_1'^2+`sigma_2'^2)))+
>
> (1-`lambda1'-`lambda2') * (2/sqrt(`sigma_1'^2+`sigma_3'^2)) *
> normalden(($ML_y1 - `mu')/ sqrt(`sigma_1'^2+`sigma_3'^2))*
> (1-normal((($ML_y1 - `mu')*(`sigma_1'/`sigma_3'))/
> sqrt(`sigma_1'^2+`sigma_3'^2)));
> mlsum `lnf' = log(`lnf_j');
>
>
> end;
> gen mu = -0.00001;
>
> ml model d0 pbm_mixture (tau = mu, noconst technique(dfp) ) /ln_sigma_1
> /ln_sigma_2 /ln_sigma_3 /inv_lambda1 /inv_lambda2 ;
> ml init mu=0;
> ml check;
> ml search lambda1 0 1 lambda2 0 1, repeat(250);
> ml maximize;
>
> --
> Lukas Kornher
>
> Phd Candidate
> Department of Economic and Technological Change
> Center for Development Research
> University of Bonn
>
> Tel.: +49 (0) 228 / 73-1842
> Room 1.031
>
>
>
>
> *
> * 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/
--
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* 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/