0

I am studying a dichotomous outcome of an intervention. The data comes from multiple clustered data-sets. All datasets have some missing data. I have imputated the data-sets using MICE.

My plan is to use a mixed model, log-binomial distribution to calculate the overall relative risk.

x <- with(glmer(Outcome ~ Intervention + (1 | Cluster), data = Data, family = binomial(link = "log"))) 

I keep getting the error: 'cannot coerce class ‘"mids"’ to a data.frame"

I do not understand why this is. How can I overcome this problem?

WielsN
  • 1
  • 1
    This issue is that `Data` is the wrong class. Would you mind posting the output of `class(Data)` and `str(Data)`. Also if you get the chance, please add a reproducible example. Here's a link on how to make one https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example. – Sean McKenzie Aug 20 '21 at 01:36
  • If `Data` is a mice object, it should be the first param with `with()`. Maybe some of this code can help: https://stackoverflow.com/questions/32939100/pooling-glmers-of-imputed-datasets or https://stackoverflow.com/questions/64735451/using-imputed-datasets-from-library-mice-to-fit-a-multi-level-model-in-r – MrFlick Aug 20 '21 at 01:45

0 Answers0