easystats / easystats/performance
Non-sensical scaling for plots
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 1.2k
- Forks
- 109
- Avg merge
- 6h 34m
- Merged PRs (30d)
- 8
Description
I quite often come across plots from check_model() where the y-axis is scaled ludicrously (presumably because of the loess function creating a curve that is wildly curved). This code breaks reprex() but gives an example:
library(performance)
library(see)
library(ggplot2)
# remotes::install_github("profandyfield/discovr")
display_tib <- discovr::display
fb_glm <- glm(display ~ fb, family = binomial(), data = display_tib)
check_model(fb_glm, check = "outliers")
The obvious solution in these cases is to explore the residuals/influence stats more manually, or adjust the scales manually with sopmething like
fb_resid <- check_model(fb_glm, check = "outliers")
fb_gg <- plot(fb_resid)
fb_gg[[1]] + coord_cartesian(ylim = c(-4, 4))
but from a teaching perspective it's a bit of a nightmare - you just want students to see plots they can say something sensible about.
Is there a way to limit to the scaling to sensible maximum/minimum values? I've seen this behaviour with the homoscedasticity plots too.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the supplied check_model(fb_glm, check = "outliers") example and inspect the resulting plots, including the homoscedasticity plots. Read the check_model() and plotting entry points, then verify that the y-axis remains sensible without breaking reprex(); compare the result with the manual coord_cartesian(ylim = c(-4, 4)) example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100