From 9b8fe3462d85389d26fdaac83433e6de13cdee19 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 2 Jul 2023 22:18:40 +0200 Subject: [PATCH] try emmeans dev --- DESCRIPTION | 1 + R/bayesfactor_parameters.R | 4 +--- R/bayesfactor_restricted.R | 4 +--- R/ci.R | 2 +- R/rope.R | 4 +++- man/bayesfactor_parameters.Rd | 4 +--- man/bayesfactor_restricted.Rd | 4 +--- man/ci.Rd | 2 +- man/rope.Rd | 4 +++- 9 files changed, 13 insertions(+), 16 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e0d072773..650acd770 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -125,3 +125,4 @@ Config/Needs/website: rstudio/bslib, r-lib/pkgdown, easystats/easystatstemplate +Remotes: rvlenth/emmeans diff --git a/R/bayesfactor_parameters.R b/R/bayesfactor_parameters.R index c8889ef1c..1251c83d5 100644 --- a/R/bayesfactor_parameters.R +++ b/R/bayesfactor_parameters.R @@ -132,9 +132,7 @@ #' #' # emmGrid objects #' # --------------- -#' group_diff <- suppressWarnings( -#' pairs(emmeans(stan_model, ~group, data = sleep)) -#' ) +#' group_diff <- pairs(emmeans(stan_model, ~group, data = sleep)) #' bayesfactor_parameters(group_diff, prior = stan_model, verbose = FALSE) #' #' # Or diff --git a/R/bayesfactor_restricted.R b/R/bayesfactor_restricted.R index 37108f70c..77ae4fc7e 100644 --- a/R/bayesfactor_restricted.R +++ b/R/bayesfactor_restricted.R @@ -94,9 +94,7 @@ #' contrasts(disgust$condition) <- contr.equalprior_pairs # see vignette #' fit_model <- rstanarm::stan_glm(score ~ condition, data = disgust, family = gaussian()) #' -#' em_condition <- suppressWarnings( -#' emmeans::emmeans(fit_model, ~condition, data = disgust) -#' ) +#' em_condition <- emmeans::emmeans(fit_model, ~condition, data = disgust) #' hyps <- c("lemon < control & control < sulfur") #' #' bayesfactor_restricted(em_condition, prior = fit_model, hypothesis = hyps) diff --git a/R/ci.R b/R/ci.R index ca5941da9..e838dc215 100644 --- a/R/ci.R +++ b/R/ci.R @@ -58,7 +58,7 @@ #' ci(bf, method = "HDI") #' #' @examplesIf require("emmeans", quietly = TRUE) && require("rstanarm", quietly = TRUE) -#' model <- suppressWarnings(emtrends(model, ~1, "wt", data = mtcars)) +#' model <- emtrends(model, ~1, "wt", data = mtcars) #' ci(model, method = "ETI") #' ci(model, method = "HDI") #' @export diff --git a/R/rope.R b/R/rope.R index 6072febd5..925caba3a 100644 --- a/R/rope.R +++ b/R/rope.R @@ -92,7 +92,9 @@ #' rope(x = rnorm(1000, 1, 1), ci = c(.90, .95)) #' \dontrun{ #' library(rstanarm) -#' model <- stan_glm(mpg ~ wt + gear, data = mtcars, chains = 2, iter = 200, refresh = 0) +#' model <- suppressWarnings( +#' stan_glm(mpg ~ wt + gear, data = mtcars, chains = 2, iter = 200, refresh = 0) +#' ) #' rope(model) #' rope(model, ci = c(.90, .95)) #' diff --git a/man/bayesfactor_parameters.Rd b/man/bayesfactor_parameters.Rd index b30815d5f..b5726ecbf 100644 --- a/man/bayesfactor_parameters.Rd +++ b/man/bayesfactor_parameters.Rd @@ -278,9 +278,7 @@ if (require("rstanarm") && require("emmeans") && require("logspline")) { # emmGrid objects # --------------- - group_diff <- suppressWarnings( - pairs(emmeans(stan_model, ~group, data = sleep)) - ) + group_diff <- pairs(emmeans(stan_model, ~group, data = sleep)) bayesfactor_parameters(group_diff, prior = stan_model, verbose = FALSE) # Or diff --git a/man/bayesfactor_restricted.Rd b/man/bayesfactor_restricted.Rd index 3bb3c87d0..1fe715e68 100644 --- a/man/bayesfactor_restricted.Rd +++ b/man/bayesfactor_restricted.Rd @@ -208,9 +208,7 @@ data("disgust") contrasts(disgust$condition) <- contr.equalprior_pairs # see vignette fit_model <- rstanarm::stan_glm(score ~ condition, data = disgust, family = gaussian()) -em_condition <- suppressWarnings( - emmeans::emmeans(fit_model, ~condition, data = disgust) -) +em_condition <- emmeans::emmeans(fit_model, ~condition, data = disgust) hyps <- c("lemon < control & control < sulfur") bayesfactor_restricted(em_condition, prior = fit_model, hypothesis = hyps) diff --git a/man/ci.Rd b/man/ci.Rd index 6934cbff9..2cc9e1b80 100644 --- a/man/ci.Rd +++ b/man/ci.Rd @@ -137,7 +137,7 @@ ci(bf, method = "ETI") ci(bf, method = "HDI") \dontshow{\}) # examplesIf} \dontshow{if (require("emmeans", quietly = TRUE) && require("rstanarm", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} -model <- suppressWarnings(emtrends(model, ~1, "wt", data = mtcars)) +model <- emtrends(model, ~1, "wt", data = mtcars) ci(model, method = "ETI") ci(model, method = "HDI") \dontshow{\}) # examplesIf} diff --git a/man/rope.Rd b/man/rope.Rd index 537e00510..86bfe31bc 100644 --- a/man/rope.Rd +++ b/man/rope.Rd @@ -138,7 +138,9 @@ rope(x = rnorm(1000, 1, 0.01), range = c(-0.1, 0.1)) rope(x = rnorm(1000, 1, 1), ci = c(.90, .95)) \dontrun{ library(rstanarm) -model <- stan_glm(mpg ~ wt + gear, data = mtcars, chains = 2, iter = 200, refresh = 0) +model <- suppressWarnings( + stan_glm(mpg ~ wt + gear, data = mtcars, chains = 2, iter = 200, refresh = 0) +) rope(model) rope(model, ci = c(.90, .95))