5050# ' @param show_ci Logical, if `TRUE`, confidence intervals in plots are shown.
5151# ' For models with only categorical predictors, confidence intervals are not shown
5252# ' by default, because in this case, these are usually on very large scales.
53+ # ' @param show_smooth Logical, if `FALSE`, the Linearity and Homogeneity of
54+ # ' Variance panels draw neither the LOESS smoother nor the cell means, and the
55+ # ' Influential Observations panel draws no LOESS smoother. This needs **see**
56+ # ' newer than 0.14.2. Older versions ignore the setting.
5357# ' @param maximum_dots Limits the number of data points for models with many
5458# ' observations, to reduce the time for rendering the plot. Defaults to a
5559# ' maximum of 2000 data points to render
@@ -286,6 +290,7 @@ check_model.default <- function(
286290 theme = see :: theme_lucid(),
287291 verbose = FALSE ,
288292 x = NULL ,
293+ show_smooth = TRUE ,
289294 ...
290295) {
291296 # # TODO remove deprecation warning later
@@ -296,6 +301,8 @@ check_model.default <- function(
296301 model <- x
297302 }
298303
304+ .check_show_smooth(show_smooth )
305+
299306 # check model formula
300307 if (verbose ) {
301308 insight :: formula_ok(model )
@@ -392,6 +399,7 @@ check_model.default <- function(
392399 type_missing = missing(type ),
393400 show_dots = show_dots ,
394401 show_ci = show_ci ,
402+ show_smooth = show_smooth ,
395403 maximum_dots = maximum_dots ,
396404 size_dot = size_dot ,
397405 size_line = size_line ,
@@ -423,6 +431,7 @@ check_model.default <- function(
423431 type_missing ,
424432 show_dots ,
425433 show_ci ,
434+ show_smooth ,
426435 maximum_dots ,
427436 size_dot ,
428437 size_line ,
@@ -478,6 +487,7 @@ check_model.default <- function(
478487 attr(assumptions_data , " dot_alpha" ) <- alpha_dot
479488 attr(assumptions_data , " show_dots" ) <- isTRUE(show_dots )
480489 attr(assumptions_data , " show_ci" ) <- isTRUE(show_ci )
490+ attr(assumptions_data , " show_smooth" ) <- isTRUE(show_smooth )
481491 attr(assumptions_data , " detrend" ) <- detrend
482492 attr(assumptions_data , " colors" ) <- colors
483493 attr(assumptions_data , " theme" ) <- theme
@@ -492,6 +502,14 @@ check_model.default <- function(
492502}
493503
494504
505+ # same check and message as in see::plot.see_check_model()
506+ .check_show_smooth <- function (show_smooth ) {
507+ if (! isTRUE(show_smooth ) && ! isFALSE(show_smooth )) {
508+ insight :: format_error(" `show_smooth` must be either `TRUE` or `FALSE`." )
509+ }
510+ }
511+
512+
495513# methods ----------------------------------
496514
497515# ' @export
@@ -537,6 +555,7 @@ check_model.stanreg <- function(
537555 verbose = FALSE ,
538556 x = NULL ,
539557 response = NULL ,
558+ show_smooth = TRUE ,
540559 ...
541560) {
542561 # # TODO remove deprecation warning later
@@ -547,6 +566,8 @@ check_model.stanreg <- function(
547566 model <- x
548567 }
549568
569+ .check_show_smooth(show_smooth )
570+
550571 # multivariate brms models need one response, see https://github.com/easystats/performance/issues/908
551572 resp <- .check_multivariate_resp(
552573 model ,
@@ -589,6 +610,7 @@ check_model.stanreg <- function(
589610 type_missing = missing(type ),
590611 show_dots = show_dots ,
591612 show_ci = show_ci ,
613+ show_smooth = show_smooth ,
592614 maximum_dots = maximum_dots ,
593615 size_dot = size_dot ,
594616 size_line = size_line ,
@@ -620,6 +642,7 @@ check_model.stanreg <- function(
620642 detrend = detrend ,
621643 show_dots = show_dots ,
622644 show_ci = show_ci ,
645+ show_smooth = show_smooth ,
623646 bandwidth = bandwidth ,
624647 type = type ,
625648 residual_type = residual_type ,
@@ -650,6 +673,7 @@ check_model.brmsfit <- check_model.stanreg
650673 type_missing ,
651674 show_dots ,
652675 show_ci ,
676+ show_smooth ,
653677 maximum_dots ,
654678 size_dot ,
655679 size_line ,
@@ -740,6 +764,7 @@ check_model.brmsfit <- check_model.stanreg
740764 type_missing = type_missing ,
741765 show_dots = show_dots ,
742766 show_ci = show_ci ,
767+ show_smooth = show_smooth ,
743768 maximum_dots = maximum_dots ,
744769 size_dot = size_dot ,
745770 size_line = size_line ,
@@ -816,6 +841,7 @@ check_model.model_fit <- function(
816841 theme = see :: theme_lucid(),
817842 verbose = FALSE ,
818843 x = NULL ,
844+ show_smooth = TRUE ,
819845 ...
820846) {
821847 # # TODO remove deprecation warning later
@@ -841,6 +867,7 @@ check_model.model_fit <- function(
841867 detrend = detrend ,
842868 show_dots = show_dots ,
843869 show_ci = show_ci ,
870+ show_smooth = show_smooth ,
844871 maximum_dots = maximum_dots ,
845872 bandwidth = bandwidth ,
846873 type = type ,
@@ -876,6 +903,7 @@ check_model.performance_simres <- function(
876903 theme = see :: theme_lucid(),
877904 verbose = FALSE ,
878905 x = NULL ,
906+ show_smooth = TRUE ,
879907 ...
880908) {
881909 # # TODO remove deprecation warning later
@@ -901,6 +929,7 @@ check_model.performance_simres <- function(
901929 detrend = detrend ,
902930 show_dots = show_dots ,
903931 show_ci = show_ci ,
932+ show_smooth = show_smooth ,
904933 maximum_dots = maximum_dots ,
905934 bandwidth = bandwidth ,
906935 type = type ,
0 commit comments