4747# ' time-consuming. By default, `show_dots = NULL`. In this case `check_model()`
4848# ' tries to guess whether performance will be poor due to a very large model
4949# ' and thus automatically shows or hides dots.
50+ # ' @param show_ci Logical, if `TRUE`, confidence intervals in plots are shown.
51+ # ' For models with only categorical predictors, confidence intervals are not shown
52+ # ' by default, because in this case, these are usually on very large scales.
5053# ' @param maximum_dots Limits the number of data points for models with many
5154# ' observations, to reduce the time for rendering the plot. Defaults to a
5255# ' maximum of 2000 data points to render
@@ -206,6 +209,7 @@ check_model.default <- function(
206209 type = " density" ,
207210 residual_type = NULL ,
208211 show_dots = NULL ,
212+ show_ci = NULL ,
209213 maximum_dots = 2000 ,
210214 size_dot = 2 ,
211215 size_line = 0.8 ,
@@ -317,6 +321,16 @@ check_model.default <- function(
317321 )
318322 }
319323
324+ # if we have only categorical predictors, we don't show CI by default
325+ parameter_types <- .safe(parameters :: parameters_type(x ))
326+ if (
327+ ! is.null(parameter_types ) && all(parameter_types $ Type %in% c(" intercept" , " factor" ))
328+ ) {
329+ show_ci = FALSE
330+ } else {
331+ show_ci = TRUE
332+ }
333+
320334 attr(assumptions_data , " panel" ) <- panel
321335 attr(assumptions_data , " dot_size" ) <- size_dot
322336 attr(assumptions_data , " line_size" ) <- size_line
@@ -327,6 +341,7 @@ check_model.default <- function(
327341 attr(assumptions_data , " alpha" ) <- alpha
328342 attr(assumptions_data , " dot_alpha" ) <- alpha_dot
329343 attr(assumptions_data , " show_dots" ) <- isTRUE(show_dots )
344+ attr(assumptions_data , " show_ci" ) <- isTRUE(show_ci )
330345 attr(assumptions_data , " detrend" ) <- detrend
331346 attr(assumptions_data , " colors" ) <- colors
332347 attr(assumptions_data , " theme" ) <- theme
@@ -370,6 +385,7 @@ check_model.stanreg <- function(
370385 type = " density" ,
371386 residual_type = NULL ,
372387 show_dots = NULL ,
388+ show_ci = NULL ,
373389 maximum_dots = 2000 ,
374390 size_dot = 2 ,
375391 size_line = 0.8 ,
@@ -397,6 +413,7 @@ check_model.stanreg <- function(
397413 size_axis_title = size_axis_title ,
398414 detrend = detrend ,
399415 show_dots = show_dots ,
416+ show_ci = show_ci ,
400417 bandwidth = bandwidth ,
401418 type = type ,
402419 residual_type = residual_type ,
@@ -421,6 +438,7 @@ check_model.model_fit <- function(
421438 type = " density" ,
422439 residual_type = NULL ,
423440 show_dots = NULL ,
441+ show_ci = NULL ,
424442 maximum_dots = 2000 ,
425443 size_dot = 2 ,
426444 size_line = 0.8 ,
@@ -448,6 +466,7 @@ check_model.model_fit <- function(
448466 base_size = base_size ,
449467 detrend = detrend ,
450468 show_dots = show_dots ,
469+ show_ci = show_ci ,
451470 maximum_dots = maximum_dots ,
452471 bandwidth = bandwidth ,
453472 type = type ,
@@ -468,6 +487,7 @@ check_model.performance_simres <- function(
468487 type = " density" ,
469488 residual_type = NULL ,
470489 show_dots = NULL ,
490+ show_ci = NULL ,
471491 maximum_dots = 2000 ,
472492 size_dot = 2 ,
473493 size_line = 0.8 ,
@@ -495,6 +515,7 @@ check_model.performance_simres <- function(
495515 base_size = base_size ,
496516 detrend = detrend ,
497517 show_dots = show_dots ,
518+ show_ci = show_ci ,
498519 maximum_dots = maximum_dots ,
499520 bandwidth = bandwidth ,
500521 type = type ,
0 commit comments