Skip to content

Commit

Permalink
fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Oct 1, 2023
1 parent 5161a83 commit ac34535
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 42 deletions.
35 changes: 15 additions & 20 deletions R/bayesfactor.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,30 @@
#'
#' @note There is also a [`plot()`-method](https://easystats.github.io/see/articles/bayestestR.html) implemented in the \href{https://easystats.github.io/see/}{\pkg{see}-package}.
#'
#' @examples
#' @examplesIf require("rstanarm") && require("logspline")
#' library(bayestestR)
#'
#' if (require("logspline")) {
#' prior <- distribution_normal(1000, mean = 0, sd = 1)
#' posterior <- distribution_normal(1000, mean = .5, sd = .3)
#' prior <- distribution_normal(1000, mean = 0, sd = 1)
#' posterior <- distribution_normal(1000, mean = .5, sd = .3)
#'
#' bayesfactor(posterior, prior = prior, verbose = FALSE)
#'
#' bayesfactor(posterior, prior = prior, verbose = FALSE)
#' }
#' \donttest{
#' # rstanarm models
#' # ---------------
#' if (require("rstanarm")) {
#' model <- stan_lmer(extra ~ group + (1 | ID), data = sleep)
#' bayesfactor(model, verbose = FALSE)
#' }
#' }
#' model <- suppressWarnings(rstanarm::stan_lmer(extra ~ group + (1 | ID), data = sleep))
#' bayesfactor(model, verbose = FALSE)
#'
#' if (require("logspline")) {
#' # Frequentist models
#' # ---------------
#' m0 <- lm(extra ~ 1, data = sleep)
#' m1 <- lm(extra ~ group, data = sleep)
#' m2 <- lm(extra ~ group + ID, data = sleep)
#' # Frequentist models
#' # ---------------
#' m0 <- lm(extra ~ 1, data = sleep)
#' m1 <- lm(extra ~ group, data = sleep)
#' m2 <- lm(extra ~ group + ID, data = sleep)
#'
#' comparison <- bayesfactor(m0, m1, m2)
#' comparison
#' comparison <- bayesfactor(m0, m1, m2)
#' comparison
#'
#' bayesfactor(comparison)
#' bayesfactor(comparison)
#' }
#' @export
bayesfactor <- function(...,
Expand Down
2 changes: 1 addition & 1 deletion R/estimate_density.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#'
#' @note There is also a [`plot()`-method](https://easystats.github.io/see/articles/bayestestR.html) implemented in the \href{https://easystats.github.io/see/}{\pkg{see}-package}.
#'
#' @examplesIf requireNamespace("logspline", quietly = TRUE) && requireNamespace("KernSmooth", quietly = TRUE) && requireNamespace("mclust", quietly = TRUE)
#' @examplesIf require("logspline") && require("KernSmooth") && require("mclust") && require("emmeans") && require("rstanarm") && require("brms")
#' library(bayestestR)
#'
#' set.seed(1)
Expand Down
2 changes: 1 addition & 1 deletion R/mediation.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
#' @seealso The \pkg{mediation} package for a causal mediation analysis in
#' the frequentist framework.
#'
#' @examples
#' @examplesIf require("mediation") && require("brms") && require("rstanarm")
#' \donttest{
#' library(mediation)
#' library(brms)
Expand Down
35 changes: 16 additions & 19 deletions man/bayesfactor.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/estimate_density.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/mediation.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ac34535

Please sign in to comment.