Announcement

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

  • Margins not estimable for three way interaction (continuous) after mixed (growth curve model)

    Dear Statalist,

    I ran a growth curve model with mixed command in Stata, it contains three key independent variables (age("cage"), cohort, and years of education ("z_pgs_edu1")), and my outcome is mental status("lgrmstot"). When I try to use the margin command it is not estimable. I have attached my code and my results here (code and results on covariates are not shown). Could you please advise me on this?

    Code:
    Code:
    mixed lgrmstot c.cage##c.cage##c.cage##c.edu ///
    i.cohort c.cage#i.cohort c.cage#c.cage#i.cohort c.cage#c.cage#c.cage#i.cohort ///
    i.cohort#c.edu c.cage#i.cohort#c.edu c.cage#c.cage#i.cohort#c.edu ///
    c.cage#c.cage#c.cage#i.cohort#c.edu ///
    || hhidpn: cage, cov(ind) mle nolog
    Results:
    Code:
    Mixed-effects ML regression                     Number of obs     =     27,881
    Group variable: hhidpn                          Number of groups  =      4,802
    
                                                    Obs per group:
                                                                  min =          1
                                                                  avg =        5.8
                                                                  max =          8
    
                                                    Wald chi2(77)     =   22612.79
    Log likelihood =  -21080.55                     Prob > chi2       =     0.0000
    
    ----------------------------------------------------------------------------------------------------------
                                    lgrmstot |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -----------------------------------------+----------------------------------------------------------------
                                        cage |  -.2473601   .3037283    -0.81   0.415    -.8426566    .3479365
                                             |
                               c.cage#c.cage |   .0132115   .0095055     1.39   0.165     -.005419     .031842
                                             |
                        c.cage#c.cage#c.cage |   -.000212   .0001007    -2.11   0.035    -.0004093   -.0000147
                                             |
                                          edu|    8.94467   3.492012     2.56   0.010     2.100452    15.78889
                                             |
                                 c.cage#c.edu|  -.8436244   .3206582    -2.63   0.009    -1.472103    -.215146
                                             |
                         c.cage#c.cage#c.edu1|   .0262647   .0097161     2.70   0.007     .0072215    .0453078
                                             |
                   c.cage#c.cage#c.cage#c.edu|  -.0002695   .0000972    -2.77   0.006      -.00046   -.0000791
                                             |
                                      cohort |
                                          2  |   .0801404   3.242196     0.02   0.980    -6.274448    6.434728
                                          3  |  -1.809628   3.231423    -0.56   0.575      -8.1431    4.523845
                                          4  |   .8527643   3.374374     0.25   0.800    -5.760887    7.466416
                                             |
                               cohort#c.cage |
                                          2  |  -.0259877   .2997897    -0.09   0.931    -.6135647    .5615892
                                          3  |   .2350067   .2998016     0.78   0.433    -.3525936     .822607
                                          4  |  -1.008803   .3956974    -2.55   0.011    -1.784356   -.2332502
                                             |
                        cohort#c.cage#c.cage |
                                          2  |   .0044933      .0092     0.49   0.625    -.0135383    .0225249
                                          3  |  -.0047092   .0094165    -0.50   0.617    -.0231651    .0137468
                                          4  |   .1561045   .0247699     6.30   0.000     .1075565    .2046526
                                             |
                 cohort#c.cage#c.cage#c.cage |
                                          2  |  -.0001567   .0000941    -1.66   0.096    -.0003411    .0000278
                                          3  |  -.0001994   .0001051    -1.90   0.058    -.0004054    6.59e-06
                                          4  |  -.0065248   .0006746    -9.67   0.000    -.0078469   -.0052027
                                             |
                         cohort#c.edu |
                                          2  |  -8.307819   3.515025    -2.36   0.018    -15.19714   -1.418496
                                          3  |  -8.737698   3.501282    -2.50   0.013    -15.60008   -1.875311
                                          4  |  -9.128632   3.626381    -2.52   0.012    -16.23621   -2.021056
                                             |
                  cohort#c.cage#c.edu |
                                          2  |   .7628446    .324849     2.35   0.019     .1261524    1.399537
                                          3  |   .8086933   .3240678     2.50   0.013     .1735322    1.443854
                                          4  |   .8636496    .414882     2.08   0.037     .0504957    1.676803
                                             |
           cohort#c.cage#c.cage#c.edu |
                                          2  |  -.0228991   .0099601    -2.30   0.021    -.0424206   -.0033777
                                          3  |  -.0243141   .0101058    -2.41   0.016    -.0441212   -.0045071
                                          4  |  -.0256847   .0254539    -1.01   0.313    -.0755733    .0242039
                                             |
    cohort#c.cage#c.cage#c.cage#c.edu |
                                          2  |   .0002257   .0001017     2.22   0.026     .0000263    .0004251
                                          3  |   .0002382   .0001108     2.15   0.032     .0000211    .0004553
                                          4  |   .0001982   .0006938     0.29   0.775    -.0011617     .001558
                                             |
                                  
                                       _cons |   5.805866   3.254935     1.78   0.074    -.5736896    12.18542
    ----------------------------------------------------------------------------------------------------------
    
    ------------------------------------------------------------------------------
      Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
    -----------------------------+------------------------------------------------
    hhidpn: Independent          |
                       var(cage) |   .0001591   6.80e-06      .0001463     .000173
                      var(_cons) |   2.66e-14   2.08e-14      5.71e-15    1.24e-13
    -----------------------------+------------------------------------------------
                   var(Residual) |   .2248527   .0023499      .2202938     .229506
    ------------------------------------------------------------------------------
    LR test vs. linear model: chi2(2) = 1496.39               Prob > chi2 = 0.0000
    
    Note: LR test is conservative and provided only for reference.
    Codes I have tried:
    Code:
    margins,dydx(i.cohort) at(z_pgs_edu1=(-1.5 1.5) cage=(0(5)40)) atmeans vsquish
    margins, at(z_pgs_edu1=(-1.5 1.5) cage=(0(5)40) cohort = (1 2 3 4))  vsquish
    margins cohort, at(z_pgs_edu1=(-1.5 1.5) cage=(0(5)40))  vsquish
    these all leads to not estimable margins:
    Code:
    . margins cohort, at(z_pgs_edu1=(-1.5 1.5) cage=(0(5)40))  vsquish
    
    Predictive margins                              Number of obs     =     27,881
    
    Expression   : Linear prediction, fixed portion, predict()
    1._at        : cage            =           0
                   z_pgs_edu1      =        -1.5
    2._at        : cage            =           0
                   z_pgs_edu1      =         1.5
    3._at        : cage            =           5
                   z_pgs_edu1      =        -1.5
    4._at        : cage            =           5
                   z_pgs_edu1      =         1.5
    5._at        : cage            =          10
                   z_pgs_edu1      =        -1.5
    6._at        : cage            =          10
                   z_pgs_edu1      =         1.5
    7._at        : cage            =          15
                   z_pgs_edu1      =        -1.5
    8._at        : cage            =          15
                   z_pgs_edu1      =         1.5
    9._at        : cage            =          20
                   z_pgs_edu1      =        -1.5
    10._at       : cage            =          20
                   z_pgs_edu1      =         1.5
    11._at       : cage            =          25
                   z_pgs_edu1      =        -1.5
    12._at       : cage            =          25
                   z_pgs_edu1      =         1.5
    13._at       : cage            =          30
                   z_pgs_edu1      =        -1.5
    14._at       : cage            =          30
                   z_pgs_edu1      =         1.5
    15._at       : cage            =          35
                   z_pgs_edu1      =        -1.5
    16._at       : cage            =          35
                   z_pgs_edu1      =         1.5
    17._at       : cage            =          40
                   z_pgs_edu1      =        -1.5
    18._at       : cage            =          40
                   z_pgs_edu1      =         1.5
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
      _at#cohort |
            1 1  |          .  (not estimable)
            1 2  |          .  (not estimable)
            1 3  |          .  (not estimable)
            1 4  |          .  (not estimable)
            2 1  |          .  (not estimable)
            2 2  |          .  (not estimable)
            2 3  |          .  (not estimable)
            2 4  |          .  (not estimable)
            3 1  |          .  (not estimable)
            3 2  |          .  (not estimable)
            3 3  |          .  (not estimable)
            3 4  |          .  (not estimable)
            4 1  |          .  (not estimable)
            4 2  |          .  (not estimable)
            4 3  |          .  (not estimable)
            4 4  |          .  (not estimable)
            5 1  |          .  (not estimable)
            5 2  |          .  (not estimable)
            5 3  |          .  (not estimable)
            5 4  |          .  (not estimable)
            6 1  |          .  (not estimable)
            6 2  |          .  (not estimable)
            6 3  |          .  (not estimable)
            6 4  |          .  (not estimable)
            7 1  |          .  (not estimable)
            7 2  |          .  (not estimable)
            7 3  |          .  (not estimable)
            7 4  |          .  (not estimable)
            8 1  |          .  (not estimable)
            8 2  |          .  (not estimable)
            8 3  |          .  (not estimable)
            8 4  |          .  (not estimable)
            9 1  |          .  (not estimable)
            9 2  |          .  (not estimable)
            9 3  |          .  (not estimable)
            9 4  |          .  (not estimable)
           10 1  |          .  (not estimable)
           10 2  |          .  (not estimable)
           10 3  |          .  (not estimable)
           10 4  |          .  (not estimable)
           11 1  |          .  (not estimable)
           11 2  |          .  (not estimable)
           11 3  |          .  (not estimable)
           11 4  |          .  (not estimable)
           12 1  |          .  (not estimable)
           12 2  |          .  (not estimable)
           12 3  |          .  (not estimable)
           12 4  |          .  (not estimable)
           13 1  |          .  (not estimable)
           13 2  |          .  (not estimable)
           13 3  |          .  (not estimable)
           13 4  |          .  (not estimable)
           14 1  |          .  (not estimable)
           14 2  |          .  (not estimable)
           14 3  |          .  (not estimable)
           14 4  |          .  (not estimable)
           15 1  |          .  (not estimable)
           15 2  |          .  (not estimable)
           15 3  |          .  (not estimable)
           15 4  |          .  (not estimable)
           16 1  |          .  (not estimable)
           16 2  |          .  (not estimable)
           16 3  |          .  (not estimable)
           16 4  |          .  (not estimable)
           17 1  |          .  (not estimable)
           17 2  |          .  (not estimable)
           17 3  |          .  (not estimable)
           17 4  |          .  (not estimable)
           18 1  |          .  (not estimable)
           18 2  |          .  (not estimable)
           18 3  |          .  (not estimable)
           18 4  |          .  (not estimable)
    ------------------------------------------------------------------------------
    Many thanks!

  • #2
    correction: I manually changed some z_pgs_edu1 to edu, they are the same thing. I wanted to shorter the length of my variable but I see it may confuse people.

    Comment


    • #3
      You did not get a quick answer. You'll increase the chances of a useful answer by following the FAQ on asking questions. I appreciate your providing Stata code and results. Data that let us replicate your problem is often helpful. It is also often a good idea to cut down the model to the minimum needed to demonstrate the problem - the additional stuff (piles of variables and interactions etc.) makes it harder for us to get a handle on your problem.

      I don't used mixed, but I wonder if the problem isn't the random coefficient on cage. Alternatively z_pgs_edu1 doesn't appear in the model - I assume this is what you meant by "I manually changed...". I can't tell if this works or not since I don't see exactly what you ran.

      The way to diagnose your problem is to start with a simple model and work up. I mean start very simple - just the main effects for the rhs variables. You have so much going on in your model that it is hard to understand. Also, it is extremely hard to work with three way interactions let alone four way interactions. You are generating a lot of parameters on a very small number of underlying variables.

      Comment


      • #4
        Hi Phil, thank you very much for your reply. first, "edu/edu1 = z_pgs_edu1", and apologise for the confusion. Second, I listened to your advice and simplified my model. Age with lower order (e.g. cage, and cage#cage) does not deliver significant results anymore. I understand that models should not be driven by significance, but I wonder if my results from the four way interaction are reliable?

        Comment

        Working...
        X