DHARMa icon indicating copy to clipboard operation
DHARMa copied to clipboard

securityAssertion("nKcase - wrong dimensions of response") for a simple lme4:lmer linear mixed model

Open florianhartig opened this issue 3 years ago • 1 comments

Question from a user:

Ich nutze gerade DHARMa (version DHARMa_0.4.1) um ein LMM zu evaluieren (siehe Anhang). load("Model_nKcase.Rdata") simOutput.7 <- simulateResiduals(fittedModel = m7.int, n=250) # warning nKcase wrong family, wrong dimensions of response plot(simOutput.7)

florianhartig avatar May 11 '21 11:05 florianhartig

Hi,

I have looked at this, the issue arises because the response variable in the data frame is matrix, not a vector.

image

Possibly this is caused by previously scaling the variable. Maybe DHARMa shouldn't throw an error here, I will have a look at the code to see if this can be avoided, but in any case, transforming the response with as.vector() before fitting the model should avoid the problem.

Best, F

florianhartig avatar May 11 '21 11:05 florianhartig