diff --git a/R/looic.R b/R/looic.R index d1c7fc49a..8f0a0c66e 100644 --- a/R/looic.R +++ b/R/looic.R @@ -12,13 +12,13 @@ #' @return A list with four elements, the ELPD, LOOIC and their standard errors. #' #' @examplesIf require("rstanarm") -#' model <- rstanarm::stan_glm( +#' model <- suppressWarnings(rstanarm::stan_glm( #' mpg ~ wt + cyl, #' data = mtcars, #' chains = 1, #' iter = 500, #' refresh = 0 -#' ) +#' )) #' looic(model) #' @export looic <- function(model, verbose = TRUE) { diff --git a/R/model_performance.bayesian.R b/R/model_performance.bayesian.R index 576c8abcd..6421206b2 100644 --- a/R/model_performance.bayesian.R +++ b/R/model_performance.bayesian.R @@ -42,25 +42,25 @@ #' #' @examplesIf require("rstanarm") && require("rstantools") && require("BayesFactor") #' \dontrun{ -#' model <- rstanarm::stan_glm( +#' model <- suppressWarnings(rstanarm::stan_glm( #' mpg ~ wt + cyl, #' data = mtcars, #' chains = 1, #' iter = 500, #' refresh = 0 -#' ) +#' )) #' model_performance(model) #' -#' model <- stan_glmer( +#' model <- suppressWarnings(rstanarm::stan_glmer( #' mpg ~ wt + cyl + (1 | gear), #' data = mtcars, #' chains = 1, #' iter = 500, #' refresh = 0 -#' ) +#' )) #' model_performance(model) #' -#' model <- generalTestBF(carb ~ am + mpg, mtcars) +#' model <- BayesFactor::generalTestBF(carb ~ am + mpg, mtcars) #' #' model_performance(model) #' model_performance(model[3]) diff --git a/R/model_performance.rma.R b/R/model_performance.rma.R index 167eb75bb..6a3fb2e93 100644 --- a/R/model_performance.rma.R +++ b/R/model_performance.rma.R @@ -47,8 +47,8 @@ #' See the documentation for `?metafor::fitstats`. #' } #' -#' @examplesIf require("metafor") -#' data(dat.bcg, package = "metafor") +#' @examplesIf require("metafor") && require("metadat") +#' data(dat.bcg, package = "metadat") #' dat <- metafor::escalc( #' measure = "RR", #' ai = tpos, diff --git a/R/r2_bayes.R b/R/r2_bayes.R index 506c4dde6..1c8b5c4fa 100644 --- a/R/r2_bayes.R +++ b/R/r2_bayes.R @@ -43,13 +43,13 @@ #' )) #' r2_bayes(model) #' -#' model <- stan_lmer( +#' model <- suppressWarnings(stan_lmer( #' Petal.Length ~ Petal.Width + (1 | Species), #' data = iris, #' chains = 1, #' iter = 500, #' refresh = 0 -#' ) +#' )) #' r2_bayes(model) #' } #' @@ -75,10 +75,20 @@ #' #' \dontrun{ #' if (require("brms")) { -#' model <- brms::brm(mpg ~ wt + cyl, data = mtcars) +#' model <- suppressWarnings(brms::brm( +#' mpg ~ wt + cyl, +#' data = mtcars, +#' silent = 2, +#' refresh = 0 +#' )) #' r2_bayes(model) #' -#' model <- brms::brm(Petal.Length ~ Petal.Width + (1 | Species), data = iris) +#' model <- suppressWarnings(brms::brm( +#' Petal.Length ~ Petal.Width + (1 | Species), +#' data = iris, +#' silent = 2, +#' refresh = 0 +#' )) #' r2_bayes(model) #' } #' } diff --git a/man/looic.Rd b/man/looic.Rd index 3285be1fc..742ac3482 100644 --- a/man/looic.Rd +++ b/man/looic.Rd @@ -22,13 +22,13 @@ indicative of a better fit. } \examples{ \dontshow{if (require("rstanarm")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} -model <- rstanarm::stan_glm( +model <- suppressWarnings(rstanarm::stan_glm( mpg ~ wt + cyl, data = mtcars, chains = 1, iter = 500, refresh = 0 -) +)) looic(model) \dontshow{\}) # examplesIf} } diff --git a/man/model_performance.rma.Rd b/man/model_performance.rma.Rd index 9f2db24b5..69d1923ba 100644 --- a/man/model_performance.rma.Rd +++ b/man/model_performance.rma.Rd @@ -65,8 +65,8 @@ See the documentation for \code{?metafor::fitstats}. } } \examples{ -\dontshow{if (require("metafor")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} -data(dat.bcg, package = "metafor") +\dontshow{if (require("metafor") && require("metadat")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +data(dat.bcg, package = "metadat") dat <- metafor::escalc( measure = "RR", ai = tpos, diff --git a/man/model_performance.stanreg.Rd b/man/model_performance.stanreg.Rd index 4c26214a5..7398b9f1c 100644 --- a/man/model_performance.stanreg.Rd +++ b/man/model_performance.stanreg.Rd @@ -62,25 +62,25 @@ values mean better fit. See \code{?loo::waic}. \examples{ \dontshow{if (require("rstanarm") && require("rstantools") && require("BayesFactor")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \dontrun{ -model <- rstanarm::stan_glm( +model <- suppressWarnings(rstanarm::stan_glm( mpg ~ wt + cyl, data = mtcars, chains = 1, iter = 500, refresh = 0 -) +)) model_performance(model) -model <- stan_glmer( +model <- suppressWarnings(rstanarm::stan_glmer( mpg ~ wt + cyl + (1 | gear), data = mtcars, chains = 1, iter = 500, refresh = 0 -) +)) model_performance(model) -model <- generalTestBF(carb ~ am + mpg, mtcars) +model <- BayesFactor::generalTestBF(carb ~ am + mpg, mtcars) model_performance(model) model_performance(model[3]) diff --git a/man/r2_bayes.Rd b/man/r2_bayes.Rd index f78f38bf6..1370bafda 100644 --- a/man/r2_bayes.Rd +++ b/man/r2_bayes.Rd @@ -74,13 +74,13 @@ if (require("rstanarm") && require("rstantools")) { )) r2_bayes(model) - model <- stan_lmer( + model <- suppressWarnings(stan_lmer( Petal.Length ~ Petal.Width + (1 | Species), data = iris, chains = 1, iter = 500, refresh = 0 - ) + )) r2_bayes(model) } @@ -106,10 +106,20 @@ if (require("BayesFactor")) { \dontrun{ if (require("brms")) { - model <- brms::brm(mpg ~ wt + cyl, data = mtcars) + model <- suppressWarnings(brms::brm( + mpg ~ wt + cyl, + data = mtcars, + silent = 2, + refresh = 0 + )) r2_bayes(model) - model <- brms::brm(Petal.Length ~ Petal.Width + (1 | Species), data = iris) + model <- suppressWarnings(brms::brm( + Petal.Length ~ Petal.Width + (1 | Species), + data = iris, + silent = 2, + refresh = 0 + )) r2_bayes(model) } }