Announcement

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

  • Multilevel model error with covariance (unstructured) - Hessian is not negative semidefinite conformability error

    I'm testing a multilevel model with random slopes and a covariance structure for the error and reml terms, but I've been getting the following feedback:


    . xtmixed btda yearA avgroa avgtam avgliq avgend i.setor avgpib avghdi avgpad_cpi avgpad_cpixyear if ifrs == 2|| sl: yearA, covariance(unstructured) || countrycod: yearA, covariance(unstructured) || id: yearA, covariance(unstructured) reml

    Performing EM optimization:

    Performing gradient-based optimization:

    Iteration 0: log restricted-likelihood = 15332.862
    Iteration 1: log restricted-likelihood = 15582.751 (not concave)
    Iteration 2: log restricted-likelihood = 15593.999
    Iteration 3: log restricted-likelihood = 15594.678
    Iteration 4: log restricted-likelihood = 15597.363
    Hessian is not negative semidefinite
    conformability error
    r(503);



    Help me, please!!

  • #2
    Solved: It was a problem in the convergence of REML. I managed to solve by inserting "interate (3)" at the end of the command.
    xtmixed btda yearA avgroa avgtam avgliq avgend i.setor avgpib avghdi avgpad_cpi avgpad_cpixyear if ifrs == 2|| sl: yearA, covariance(unstructured)|| countrycod: yearA, covariance(unstructured) || id: yearA, covariance(unstructured) reml iterate (3)

    Comment


    • #3
      I managed to solve by inserting "interate (3)" at the end of the command.
      I am pretty sure that this does not solve your problem, even though I cannot advise on the problem you encounter in #1 beyond the general advice of starting with a relatively simple model and then gradually adding variables to see what variable or combination of variables are problematic. By restricting the number of iterations, you are just abruptly halting the maximization algorithm if it is still in progress, as in your example. Therefore, your estimates cannot be trusted and are not those that would be obtained at the maximized log-likelihood. Here is an example that illustrates the point. Note that xtmixed was superseded by mixed as of Stata 13.

      Code:
      webuse ovary
      mixed follicles sin1 cos1 || mare: sin1, residuals(ma 2, t(time)) iter(1)
      mixed follicles sin1 cos1 || mare: sin1, residuals(ma 2, t(time))
      Res.:

      Code:
      . webuse ovary
      (Ovarian follicles in mares)
      
      . mixed follicles sin1 cos1 || mare: sin1, residuals(ma 2, t(time)) iter(1)
      
      Obtaining starting values by EM: 
      
      Performing gradient-based optimization: 
      
      Iteration 0:   log likelihood = -813.90732  
      Iteration 1:   log likelihood = -781.01901  
      convergence not achieved
      
      Computing standard errors:
      
      Mixed-effects ML regression                     Number of obs     =        308
      Group variable: mare                            Number of groups  =         11
      
                                                      Obs per group:
                                                                    min =         25
                                                                    avg =       28.0
                                                                    max =         31
      
                                                      Wald chi2(2)      =      24.92
      Log likelihood = -781.01901                     Prob > chi2       =     0.0000
      
      ------------------------------------------------------------------------------
         follicles |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
              sin1 |   -3.13315   .7166137    -4.37   0.000    -4.537687   -1.728613
              cos1 |  -.8652492   .3589946    -2.41   0.016    -1.568866   -.1616326
             _cons |   12.19618   1.073828    11.36   0.000     10.09152    14.30084
      ------------------------------------------------------------------------------
      
      ------------------------------------------------------------------------------
        Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
      -----------------------------+------------------------------------------------
      mare: Independent            |
                         var(sin1) |   4.127377   2.631002      1.183245    14.39706
                        var(_cons) |   11.88597   6.357867      4.166033    33.91148
      -----------------------------+------------------------------------------------
      Residual: MA(2)              |
                            theta1 |   .4650888   .0565956      .3541635    .5760141
                            theta2 |   .1607086   .0572696      .0484622    .2729549
                            var(e) |   9.911742   .9688122       8.18371    12.00466
      ------------------------------------------------------------------------------
      LR test vs. linear model: chi2(4) = 233.62                Prob > chi2 = 0.0000
      
      Note: LR test is conservative and provided only for reference.
      Warning: convergence not achieved
      
      . mixed follicles sin1 cos1 || mare: sin1, residuals(ma 2, t(time))
      
      Obtaining starting values by EM: 
      
      Performing gradient-based optimization: 
      
      Iteration 0:   log likelihood = -813.90732  
      Iteration 1:   log likelihood = -781.01901  
      Iteration 2:   log likelihood = -779.13091  
      Iteration 3:   log likelihood = -778.86316  
      Iteration 4:   log likelihood = -778.85937  
      Iteration 5:   log likelihood = -778.85936  
      
      Computing standard errors:
      
      Mixed-effects ML regression                     Number of obs     =        308
      Group variable: mare                            Number of groups  =         11
      
                                                      Obs per group:
                                                                    min =         25
                                                                    avg =       28.0
                                                                    max =         31
      
                                                      Wald chi2(2)      =      31.07
      Log likelihood = -778.85936                     Prob > chi2       =     0.0000
      
      ------------------------------------------------------------------------------
         follicles |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
              sin1 |  -3.116854   .6122147    -5.09   0.000    -4.316773   -1.916935
              cos1 |  -.8691368    .382928    -2.27   0.023    -1.619662   -.1186117
             _cons |    12.1942   .8987532    13.57   0.000     10.43267    13.95572
      ------------------------------------------------------------------------------
      
      ------------------------------------------------------------------------------
        Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
      -----------------------------+------------------------------------------------
      mare: Independent            |
                         var(sin1) |   2.410738   1.763315      .5748383    10.11008
                        var(_cons) |   7.973721   3.754108      3.168888    20.06389
      -----------------------------+------------------------------------------------
      Residual: MA(2)              |
                            theta1 |   .4723033   .0614676       .351829    .5927776
                            theta2 |   .2547905   .0544484      .1480736    .3615075
                            var(e) |   10.45238   1.085618      8.527206     12.8122
      ------------------------------------------------------------------------------
      LR test vs. linear model: chi2(4) = 237.94                Prob > chi2 = 0.0000
      
      Note: LR test is conservative and provided only for reference.

      Comment


      • #4
        Thank you Andrew Musau! I will find new variables!

        Comment

        Working...
        X