Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mixture of normals - denormix - small problem

    I tried to email [email protected] (named in the help file) but it bounced. This feature either needs fixing or documenting in the help file:

    The "bug" I found is that if there are any missing values in the data to be fitted, convergence fails and you just get r(491). I assume it is treating . as an outlier rather than omitting the case. Dropping them with "if" doesn't work either - they have to be physically removed. Here's a sequence of results based on egg weights in a mixed colony of two species:


    . use "c:\birds\ringing\portlandgulls\bothBWlong.dta "

    . denormix egg , logl(2) chi ncomp(2) desc diff

    Normal mixture decomposition by ML


    Number of components: 2

    could not find feasible values
    r(491);

    . denormix egg if egg<., logl(2) chi ncomp(2) desc diff

    Normal mixture decomposition by ML


    Number of components: 2

    could not find feasible values
    r(491);

    . drop if egg==.
    (646 observations deleted)

    . denormix egg if egg<., logl(2) chi ncomp(2) desc diff

    Normal mixture decomposition by ML


    Number of components: 2

    initial: log likelihood = -2642.0577
    rescale: log likelihood = -2642.0577
    rescale eq: log likelihood = -2642.0577
    could not calculate numerical derivatives
    flat or discontinuous region encountered

    Log likelihood = -2538.0659 Number of obs = 622
    -----------------------------------------------------------------
    Parameters | Estimate Std. Err. [95% Conf. Interval]
    -------------+---------------------------------------------------
    Component 1
    Mean | 75.3041 .5009654 74.32223 76.28598
    Sigma | 7.411109 .1951822 7.028559 7.793659
    Share | .5329217 .0230245 .4877945 .5780489
    -------------+---------------------------------------------------
    Component 2
    Mean | 104.4442 .6155414 103.2377 105.6506
    Sigma | 8.110996 .2362596 7.647935 8.574056
    Share | .4670783 .0230245 .4219511 .5122055
    -----------------------------------------------------------------
    Note: standard errors are (asymptotic appoximations) by the delta method
    and are obtained from std.errs of the auxiliary parameters.

    Chi squared Pearson goodness of fit test
    ----------------------------------------
    Chi2( 4) = 8.6493
    p-value = 0.0705


    convergence problems! restarting...

    Number of components: 2

    initial: log likelihood = -2610.1326
    rescale: log likelihood = -2610.1326
    rescale eq: log likelihood = -2610.1326
    Iteration 0: log likelihood = -2610.1326 (not concave)
    Iteration 1: log likelihood = -2582.5529 (not concave)
    Iteration 2: log likelihood = -2570.865 (not concave)
    Iteration 3: log likelihood = -2551.6467
    Iteration 4: log likelihood = -2546.036
    Iteration 5: log likelihood = -2538.2068
    Iteration 6: log likelihood = -2538.0659
    Iteration 7: log likelihood = -2538.0659

    Log likelihood = -2538.0659 Number of obs = 622
    -----------------------------------------------------------------
    Parameters | Estimate Std. Err. [95% Conf. Interval]
    -------------+---------------------------------------------------
    Component 1
    Mean | 75.3041 .5009654 74.32223 76.28598
    Sigma | 7.411109 .1951822 7.028559 7.793659
    Share | .5329217 .0230245 .4877945 .5780489
    -------------+---------------------------------------------------
    Component 2
    Mean | 104.4442 .6155413 103.2377 105.6506
    Sigma | 8.110995 .2362596 7.647935 8.574055
    Share | .4670783 .0230245 .4219511 .5122055
    -----------------------------------------------------------------
    Note: standard errors are (asymptotic appoximations) by the delta method
    and are obtained from std.errs of the auxiliary parameters.

    Chi squared Pearson goodness of fit test
    ----------------------------------------
    Chi2( 4) = 8.6493
    p-value = 0.0705


  • #2
    I'm not familiar with -denormix-, but it seems like you are trying to model your data as a mixture of two normal distributions. If you are running a recent version of Stata you can do this with the official -fmm- command. See -help fmm- for details.

    Comment


    • #3
      Ah, wonderful! Don't know why my search failed to come up with this first. Thank you. The bonus is I've got the same answers from two independent procedures.

      Comment

      Working...
      X