easystats / easystats/performance

check_model: Enhance point identification

Open
#849 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3 investigators :grey_question::question: Enhancement :boom:
Dominant language
R
Stars
1.2k
Forks
109
Avg merge
6h 34m
Merged PRs (30d)
8

Description

I would like to use check_model() as a a substitute for stats::plot.lm() because it gives generally prettier and more informative plots!

However it seems to fail my requirement for sensible point labelling of noteworthy points in all the panels and for control of the graphic features (e.g., point size/color) related to this. Or, perhaps I missed something in the documentation?

Here is a minimal example. What is important here is that there is one case (number 12) which is highly influential and should be made to stand out in all the plots.

library(tidyverse)
library(performance)

data(Davis, package="carData")
# remove missings
Davis <- Davis |>
  drop_na() 
davis.mod <- lm(repwt ~ weight * sex, data=Davis)  

check_model(davis.mod, 
            check=c("linearity", "qq", 
                    "homogeneity", "outliers"))

This gives:

Image

Compare with the result of plot.lm(). Here, I used options id.n, cex.id and others to make the points I wanted to highlight stand out.

op <- par(mfrow = c(2,2), mar = c(5, 5, 3, 1) + .1)
plot(davis.mod, 
     cex.lab = 1.2, cex = 1.1, 
     id.n = 2, cex.id = 1.2, lwd = 2)
par(op)

This gives:

Image

So, can I suggest an enhancement to the plots produced to make this possible?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the check_model() entry point and compare its panels with the supplied plot.lm() example using the Davis data and davis.mod. Determine how noteworthy points are identified and whether existing documentation covers point labels and graphic controls; done means the influential case can stand out consistently across all requested panels with configurable labeling and point appearance.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.