Announcement

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

  • Non-Linear Mixed Effects Model

    Hello all,

    I am attempting to fit a mixed effects model to some longitudinal secondary data. The variables in question are an ordinal variable with 6 levels and participant test scores. The relationship between the variables is nowhere near linear, and the test scores also violate the assumption of normally distributed residuals.

    I know that I could conduct a poisson regression to account for the non-normal distribution, but my data still violates the assumption of linearity, which poisson also requires. I had thought about using the new menl command, which allows us to fit non-linear mixed effects models, but I've run into two issues: firstly, I'm not sure that this would be appropriate with non-normally distributed residuals, and secondly, I've been unable to find clear guidance on how to use menl.

    I would very much appreciate any guidance that the stata experts here can offer! Please, do let me know if I need to provide any further information.

    Aimee

  • #2
    Aimee:
    welcome to this forum.
    If you actually have an ordinal regressand, can't you follow the (absolutely) toy-example reported below?
    Code:
    . use https://www.stata-press.com/data/r16/bangladesh
    (Bangladesh Fertility Survey, 1989)
    
    . meglm c_use i.urban age i.children|| district: i.urban, family(ordinal) link(logit) nofvlabel
    
    Fitting fixed-effects model:
    
    Iteration 0:   log likelihood = -1295.4547 
    Iteration 1:   log likelihood = -1229.0394 
    Iteration 2:   log likelihood = -1228.5266 
    Iteration 3:   log likelihood = -1228.5263 
    Iteration 4:   log likelihood = -1228.5263 
    
    Refining starting values:
    
    Grid node 0:   log likelihood = -1215.8592
    
    Fitting full model:
    
    Iteration 0:   log likelihood = -1215.8592  (not concave)
    Iteration 1:   log likelihood = -1209.6285 
    Iteration 2:   log likelihood = -1205.7903 
    Iteration 3:   log likelihood = -1205.1337 
    Iteration 4:   log likelihood = -1205.0034 
    Iteration 5:   log likelihood = -1205.0025 
    Iteration 6:   log likelihood = -1205.0025 
    
    Mixed-effects GLM                               Number of obs     =      1,934
    Family:                 ordinal
    Link:                     logit
    Group variable:        district                 Number of groups  =         60
    
                                                    Obs per group:
                                                                  min =          2
                                                                  avg =       32.2
                                                                  max =        118
    
    Integration method: mvaghermite                 Integration pts.  =          7
    
                                                    Wald chi2(5)      =      97.30
    Log likelihood = -1205.0025                     Prob > chi2       =     0.0000
    ------------------------------------------------------------------------------
           c_use |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         1.urban |   .7143927   .1513595     4.72   0.000     .4177335    1.011052
             age |  -.0262261   .0079656    -3.29   0.001    -.0418384   -.0106138
                 |
        children |
              1  |   1.128973   .1599347     7.06   0.000      .815507    1.442439
              2  |   1.363165   .1761804     7.74   0.000     1.017857    1.708472
              3  |   1.352238   .1815608     7.45   0.000     .9963853    1.708091
    -------------+----------------------------------------------------------------
           /cut1 |   1.698137   .1505019                      1.403159    1.993115
    -------------+----------------------------------------------------------------
    district     |
     var(1.urban)|   .2741013   .2131525                       .059701    1.258463
       var(_cons)|   .2390807   .0857012                      .1184191    .4826891
    ------------------------------------------------------------------------------
    LR test vs. ologit model: chi2(2) = 47.05                 Prob > chi2 = 0.0000
    
    Note: LR test is conservative and provided only for reference.
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      your original message is unclear - my guess is that you mean that the relationship between one or more predictor variables and the outcome variable is non-linear - if that is the case then you need to model that non-linearity either with polynomials or a step function or some kind of spline; for functions that will handle virtually any kind of non-linear relationship, see
      Code:
      help mkspline (and read about restricted cubic spline)
      help fp

      Comment


      • #4
        Originally posted by Carlo Lazzaro View Post
        Aimee:
        welcome to this forum.
        If you actually have an ordinal regressand, can't you follow the (absolutely) toy-example reported below?
        Code:
        . use https://www.stata-press.com/data/r16/bangladesh
        (Bangladesh Fertility Survey, 1989)
        
        . meglm c_use i.urban age i.children|| district: i.urban, family(ordinal) link(logit) nofvlabel
        .
        Thanks Carlo - your response was really helpful!

        Comment

        Working...
        X