[ADMB Users] Random effect as finite mixture
hskaug at gmail.com
Sun Feb 8 10:00:16 PST 2009
There was an error in the code of the previous email. It should be
g += log(p1*exp(-0.5*square(x[i]-mu1))+p2*exp(-0.5*square(x[i]-mu2)));
g *= -1; // ADMB does miminization!
On Sun, Feb 8, 2009 at 9:45 AM, H. Skaug <hskaug at gmail.com> wrote:
> You may have solved this already, but just for the record:
> ADMB has no special provision for finite mixture models, except that
> its fast and stable funciton minimizer clearly is an advantage
> when fitting such models. The random effects module is only for
> continous random effects. To implement a finite mixture model
> you have to write the C++ code directly. A simple example
> of a Gaussian mixture is:
> init_int n // Number of observations
> init_vector x(1,n) // data
> init_number p1 // Mixture probabilities
> init_number p2
> init_number mu1 // Mean values
> init_number mu2
> objective_function_value g // Log-likelihood
> for(int i=1;i<=n;i++)
> g += log(p1*square(x[i]-mu1)+p2*square(x[i]-mu2));
> g *= -1; // ADMB does miminization!
> This code does not enforce the constraint p1+p2=1 or deal
> with the identifiability issue regarding the mu's.
> >I am new to ADMB and find the approach it adopts very interesting. One
> >I would like to know is: does ADMB handle models in which the random
> >are not parameterized as continuous distributions (normal, gamma, etc.)
> >as discrete categories (e.g. finite mixture)? Handling finite mixture is
> >computation intensive and tends to be very slow for most statistical
> >packages; it can be a great strength (if ADMB handles it) of the unique
> >approach adopted by ADMB.
> >I would appreciate some examples, if any are available.
> >Many thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users