2

How do I fit a ordinal (3 levels), logistic mixed effect model, in R? I guess it would be like a glmer except with three outcome levels.

data structure

patientid    Viral_load     Adherence     audit_score     visit
1520         0              optimal       nonhazardous       1
1520         0              optimal       nonhazardous       2
1520         0              optimal       hazardous          3
1526         1              suboptimal    hazardous          1
1526         0              optimal       hazardous          2
1526         0              optimal       hazardous          3
1568         2              suboptimal    hazardous          1
1568         2              suboptimal    nonhazardous       2
1568         2              suboptimal    nonhazardous       3

Where viral load (outcome of interest) consists of three levels (0,1,2), adherence - optimal/suboptimal , audit score nonhazardous/hazardous, and 3 visits.

So an example of how the model should look using a generalized mixed effect model code.

library (lme4)
test <- glmer(viral_load ~ audit_score + adherence + (1|patientid) + (1|visit), data = df,family = binomial)
summary (test)

The results from this code is incorrect because it takes viral_load a binomial outcome.

I hope my question is clear.

Thandi
  • 225
  • 1
  • 2
  • 9
  • 1
    search here and elsewhere for `multinomial (logit/logistic) model` – Ben Bolker May 19 '21 at 17:17
  • You pretty clearly have an ordinal response. There are ordinal/logistic models, so you might incorporate that into the searching efforts. – IRTFM May 19 '21 at 17:25

1 Answers1

3

You might try the ordinal packages clmm function:

 fmm1 <- clmm(rating ~ temp + contact + (1|judge), data = wine) 

summary(fmm1)   
Cumulative Link Mixed Model fitted with the Laplace approximation

formula: rating ~ temp + contact + (1 | judge)
data:    wine

 link  threshold nobs logLik AIC    niter    max.grad cond.H 
 logit flexible  72   -81.57 177.13 332(999) 1.02e-05 2.8e+01

Random effects:
 Groups Name        Variance Std.Dev.
 judge  (Intercept) 1.279    1.131   
Number of groups:  judge 9 

Coefficients:
           Estimate Std. Error z value Pr(>|z|)    
tempwarm     3.0630     0.5954   5.145 2.68e-07 ***
contactyes   1.8349     0.5125   3.580 0.000344 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Threshold coefficients:
    Estimate Std. Error z value
1|2  -1.6237     0.6824  -2.379
2|3   1.5134     0.6038   2.507
3|4   4.2285     0.8090   5.227
4|5   6.0888     0.9725   6.261

I'm pretty sure that the link is logistic, since running the same model with the more flexible clmm2 function, where the default link is documented to be logistic, I get the same results.

IRTFM
  • 258,963
  • 21
  • 364
  • 487