[ADMB Users] Random effect as finite mixture

H. Skaug 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

PROCEDURE_SECTION
  for(int i=1;i<=n;i++)
    g += log(p1*exp(-0.5*square(x[i]-mu1))+p2*exp(-0.5*square(x[i]-mu2)));
  g *= -1;                                // ADMB does miminization!
Hans



On Sun, Feb 8, 2009 at 9:45 AM, H. Skaug <hskaug at gmail.com> wrote:

> Hi,
>
> 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:
>
> DATA_SECTION
>   init_int n    // Number of observations
>   init_vector x(1,n)   // data
> PARAMETER_SECTION
>   init_number        p1  // Mixture probabilities
>   init_number        p2
>   init_number        mu1  // Mean values
>   init_number        mu2
>   objective_function_value g             // Log-likelihood
> PROCEDURE_SECTION
>   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.
>
> Hans
>
> >I am new to ADMB and find the approach it adopts very interesting. One
> thing
> >I would like to know is: does ADMB handle models in which the random
> effects
> >are not parameterized as continuous distributions (normal, gamma, etc.)
> but
> >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.
> >
> >Best,
> >Shige
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20090208/2dd84c71/attachment.html>


More information about the Users mailing list