Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected fittedPredictedResponse #443

Open
kduskin opened this issue Oct 6, 2024 · 1 comment
Open

Unexpected fittedPredictedResponse #443

kduskin opened this issue Oct 6, 2024 · 1 comment

Comments

@kduskin
Copy link

kduskin commented Oct 6, 2024

Hello,
I am using a GLMM with a binomial link function to model data. The response variable ('propExternal') is a proportion, with the number of observations accounted for through setting the weights parameter. Party and feed are each factors with two levels and account and scrape number signify the account (equivalent to subject) and the day of the observation.

DHARMa is giving unexpected behavior when I plot it. The predicted values from the model are only four different values, repeated over and over.

m2 = glmer(propExternal ~ party*feed + (1|account/scrape_number), weights=tweet, data=df, family=binomial)

simulationOutput <- simulateResiduals(fittedModel = m2, plot = F)
plot(simulationOutput, asFactor=F)
simulationOutput$scaledResiduals

Screenshot 2024-10-05 at 5 19 26 PM
Screenshot 2024-10-05 at 5 20 07 PM

When I plot it using the normal plot function, the fitted/predicted values look like they are more appropriate, but the plot is not interpretable which is why I wanted to use DHARMa.

plot(m2)

Screenshot 2024-10-05 at 5 17 02 PM

Is there any explanation for this? I am fairly new to using GLMMs and this is my first time using DHARMa.

Thank you!

@florianhartig
Copy link
Owner

Hi @ kduskin,

I suspect you have only 2 factor levels each for party*feed - DHARMa is per default plotting residuals against the fixed effect (marginal) predictions only. See #43 for an explanation.

If you want you can overrule this by plotting DHARMa residuals against the full model predictions by hand, but as discussed in the issue, there is a reason why we chose this default!

Best
Florian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants