easystats / easystats/performance

How to turn off CIs for check_model?

Open
#642 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I am using check_model() for a course, and it's a wonderful teaching tool. However, sometimes the confidence interval bands generated from the LOESS fit from geom_smooth() are ridiculously large, thereby expanding axes and making any potential pattern in the residuals unnoticeable. Is there a quick and easy way to turn off CIs so the y-axis behaves? I wasn't able to a discover a quick fix to this besides extracting components from check_model() and replotting with geom_smooth(se=F) or forcing it linear with geom_smooth(method="lm").

reprex:

library(tidyverse)
#> Warning: package 'tidyverse' was built under R version 4.2.3
#> Warning: package 'ggplot2' was built under R version 4.2.3
#> Warning: package 'tibble' was built under R version 4.2.3
#> Warning: package 'readr' was built under R version 4.2.3
#> Warning: package 'purrr' was built under R version 4.2.3
#> Warning: package 'dplyr' was built under R version 4.2.3
#> Warning: package 'lubridate' was built under R version 4.2.3
library(easystats)
#> Warning: package 'easystats' was built under R version 4.2.3
#> # Attaching packages: easystats 0.6.0 (red = needs update)
#> ✔ bayestestR  0.13.1   ✔ correlation 0.8.4 
#> ✔ datawizard  0.9.0    ✔ effectsize  0.8.6 
#> ✖ insight     0.19.5   ✔ modelbased  0.8.6 
#> ✔ performance 0.10.5   ✔ parameters  0.21.2
#> ✔ report      0.5.7    ✔ see         0.8.0 
#> 
#> Restart the R-Session and update packages in red with `easystats::easystats_update()`.
df<-read_csv("https://raw.githubusercontent.com/jbohenek/biol_5130/main/viagra_data.csv") |> mutate(dose=factor(dose))
#> Rows: 30 Columns: 3
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (3): dose, libido, partnerLibido
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

lm(libido ~ dose, data=df) |> 
  check_model()

Created on 2023-10-25 with reprex v2.0.2

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 at the check_model() entry point and trace how its geom_smooth() LOESS plot is assembled. The requested result is a way to disable confidence-interval bands without extracting components and replotting; verify the behavior with the provided lm(libido ~ dose, data=df) reprex.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 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.