Code Monkey home page Code Monkey logo

Comments (2)

florianhartig avatar florianhartig commented on August 16, 2024

Hello,

this doesn't look super concerning to me, but it does confirm the point in the vignette that you can have perfectly fine patterns per data point, but once you look per group you see certain patterns.

Before interpreting the pattern, I wanted to check that this is not a fluke, because RE estimates are known to be biased towards the mean, so was considering if a pattern could emerge from that. I therefore played around with variations of the following code:

testData = createData(sampleSize = 500, 
                      overdispersion = 0, 
                      family = binomial(), 
                      randomEffectVariance = 2, 
                      numGroups = 100)

library(lme4)
fit <- glmer(observedResponse ~ Environment1 + (1|group), 
             family = "binomial", data = testData)

summary(fit)


res <- simulateResiduals(fit, plot = T)
res2 <- recalculateResiduals(res, group = testData$group)
plot(res2)

I didn't really see any spurious patterns emerge. Thus, I would conclude that this is real and that you have a bit of underdispersion and a bit of heteroskedasticity in your RE-grouped residuals.

Underdispersion is often as sign of overfitting, so it could be that you have quite a lot of REs in relation to your number of observations, and thus your REs overfit a bit. As underdispersion is usually conservative (i.e. your p-values are larger than they should be), I would not be concerned about this, i.e. I would think the model is probably still acceptable, but you could consider.

Feel free to comment on this. I'll leave this issue open as a reminder to check in a bit more detail if it's a good idea to group by RE, and to add comments on this in the vignette!

from dharma.

mines-silva avatar mines-silva commented on August 16, 2024

Thank you so much for your answer!

from dharma.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.