diff --git a/DESCRIPTION b/DESCRIPTION index b910d732..92b90466 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -29,6 +29,7 @@ Imports: loo (>= 2.3.1), rstantools (>= 2.1.1), bayesplot (>= 1.5.0), + ggplot2 (>= 2.0.0), matrixStats, parallel, pbapply, @@ -50,7 +51,6 @@ Roxygen: list(markdown = TRUE) RoxygenNote: 7.2.3 Suggests: cmdstanr (>= 0.4.0), - ggplot2 (>= 2.0.0), knitr, collapse, rmarkdown, diff --git a/R/conditional_effects.R b/R/conditional_effects.R index 4888ae44..b0b759ec 100644 --- a/R/conditional_effects.R +++ b/R/conditional_effects.R @@ -55,6 +55,16 @@ #' #' # Plot all main effects on the link scale #' plot(conditional_effects(mod, type = 'link'), ask = FALSE) +#' +#' # Works the same for smooth terms +#' set.seed(0) +#' dat <- mgcv::gamSim(1, n = 200, scale = 2) +#' dat$time <- 1:NROW(dat) +#' mod <- mvgam(y ~ s(x0) + s(x1) + s(x2) + s(x3), +#' data = dat, +#' family = gaussian()) +#' conditional_effects(mod) +#' conditional_effects(mod, conf_level = 0.5, type = 'link') #' } #' @export conditional_effects.mvgam = function(x, diff --git a/man/conditional_effects.mvgam.Rd b/man/conditional_effects.mvgam.Rd index dc286bca..9b491b48 100644 --- a/man/conditional_effects.mvgam.Rd +++ b/man/conditional_effects.mvgam.Rd @@ -89,6 +89,16 @@ plot(conditional_effects(mod, conf_level = 0.7), ask = FALSE) # Plot all main effects on the link scale plot(conditional_effects(mod, type = 'link'), ask = FALSE) + +# Works the same for smooth terms +set.seed(0) +dat <- mgcv::gamSim(1, n = 200, scale = 2) +dat$time <- 1:NROW(dat) +mod <- mvgam(y ~ s(x0) + s(x1) + s(x2) + s(x3), + data = dat, + family = gaussian()) +conditional_effects(mod) +conditional_effects(mod, conf_level = 0.5, type = 'link') } } \author{