Skip to content

How to turn off CIs for check_model? #642

Open
@jbohenek

Description

@jbohenek

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions