florianhartig / DHARMa

Diagnostics for HierArchical Regession Models
http://florianhartig.github.io/DHARMa/
208 stars 22 forks source link

plotResiduals() falls back to predict and doesn't create a warning if variable doesn't exist #407

Open florianhartig opened 5 months ago

florianhartig commented 5 months ago

Reported via email

There was no typo in that script I first sent you, because I had rewritten the variable names to make it easier to follow (because I had long variable names).

Here is an example that would reproduce what I was wondering:

mod <- glmer(cbind(shared_richness, non_shared_richness) ~ built + outdoor + timepoint + (1|recoded_person_ID), family=binomial, data=dat) simulationOutput <- simulateResiduals(fittedModel = mod, plot = T) plotResiduals(simulationOutput, form = dat$BUILT)

So in this case, if I don’t have variable BUILT in my data, I don’t get any warning message. Instead, I get predicted() on x plot.

Have to check if this is indeed the case and probably best to throw an error instead!