Skip to content

check_model: Enhance point identification #849

@friendly

Description

@friendly

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    3 investigators ❔❓Need to look further into this issueEnhancement 💥Implemented features can be improved or revised

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions