easystats / performance

:muscle: Models' quality and performance metrics (R2, ICC, LOO, AIC, BF, ...)
https://easystats.github.io/performance/
GNU General Public License v3.0
965 stars 87 forks source link

check_model() bugged for lmer models *only* when run as part of an RMD chunk #720

Closed dpmoriarity closed 1 month ago

dpmoriarity commented 1 month ago

Running check_model for a project and it works fine for lm() models in rRunning check_model for a project and it works fine for lm() models in RMD chunks but, when I transition to lmer, the figure seems bugged when I run it in an RMD chunk but works fine when it is run outside of a chunk

check_model broken code chunk check_model working fine_not as part of chunk

strengejacke commented 1 month ago

I#m not sure what the two plots mean or where they come from. What is exactly the bug you get? Do you have a reprex, e.g. the raw RMD script?

dpmoriarity commented 1 month ago

The top image shows the bugged output when the check_model() is ran as part of a chunk, the one below shows the non-bugged output when the exact same code is run outside of a chunk.

I've attached some data and reproducible code. oddly, this inconsistency does not come up when using data that is part of the lmer package, but it does with the project data.

I've included a) the project data and b) a knitted file with both the public data + the project data. Lmk if I can do anything else to help!

Check_model_troubleShoot.csv check_model_chunkedcodebug-reprex.docx

dpmoriarity commented 1 month ago

I was able to fix the issue by changing the beginning of the chunk to