From 23608e623981f38988e96eb538021274c0d074ea Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 23 Mar 2024 21:43:30 +0100 Subject: [PATCH] fix remaining examples --- R/data_plot.R | 2 +- R/plot.check_heteroscedasticity.R | 2 +- R/plot.compare_parameters.R | 2 +- R/plot.estimate_contrasts.R | 2 ++ R/plot.n_factors.R | 2 +- R/plot.parameters_brms_meta.R | 2 +- man/add_plot_attributes.Rd | 2 +- man/plot.see_check_heteroscedasticity.Rd | 2 +- man/plot.see_compare_parameters.Rd | 2 +- man/plot.see_estimate_contrasts.Rd | 2 ++ man/plot.see_n_factors.Rd | 2 +- man/plot.see_parameters_brms_meta.Rd | 2 +- 12 files changed, 14 insertions(+), 10 deletions(-) diff --git a/R/data_plot.R b/R/data_plot.R index 61c3e56fb..ac0f37786 100644 --- a/R/data_plot.R +++ b/R/data_plot.R @@ -106,7 +106,7 @@ data_plot <- function(x, ...) { #' chains = 2, iter = 200, refresh = 0 #' )) #' -#' result <- hdi(model, ci = c(0.5, 0.75, 0.9, 0.95)) +#' result <- bayestestR::hdi(model, ci = c(0.5, 0.75, 0.9, 0.95)) #' data <- data_plot(result, data = model) #' #' p <- ggplot( diff --git a/R/plot.check_heteroscedasticity.R b/R/plot.check_heteroscedasticity.R index 9865e0784..3a28fa9bf 100644 --- a/R/plot.check_heteroscedasticity.R +++ b/R/plot.check_heteroscedasticity.R @@ -11,7 +11,7 @@ #' #' @examples #' m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) -#' result <- check_heteroscedasticity(m) +#' result <- performance::check_heteroscedasticity(m) #' result #' plot(result, data = m) # data required for pkgdown #' @export diff --git a/R/plot.compare_parameters.R b/R/plot.compare_parameters.R index 3f9a7159e..fdc9205e6 100644 --- a/R/plot.compare_parameters.R +++ b/R/plot.compare_parameters.R @@ -19,7 +19,7 @@ #' lm1 <- lm(Sepal.Length ~ Species, data = iris) #' lm2 <- lm(Sepal.Length ~ Species + Petal.Length, data = iris) #' lm3 <- lm(Sepal.Length ~ Species * Petal.Length, data = iris) -#' result <- compare_parameters(lm1, lm2, lm3) +#' result <- parameters::compare_parameters(lm1, lm2, lm3) #' plot(result) #' @export plot.see_compare_parameters <- function(x, diff --git a/R/plot.estimate_contrasts.R b/R/plot.estimate_contrasts.R index 9670f088b..fdde59c62 100644 --- a/R/plot.estimate_contrasts.R +++ b/R/plot.estimate_contrasts.R @@ -71,6 +71,8 @@ data_plot.estimate_contrasts <- function(x, data = NULL, ...) { #' #' @examplesIf require("emmeans") #' \donttest{ +#' library(modelbased) +#' #' model <- lm(Sepal.Width ~ Species, data = iris) #' contrasts <- estimate_contrasts(model) #' means <- estimate_means(model) diff --git a/R/plot.n_factors.R b/R/plot.n_factors.R index 0aea3b013..31a265d05 100644 --- a/R/plot.n_factors.R +++ b/R/plot.n_factors.R @@ -108,7 +108,7 @@ data_plot.n_clusters <- data_plot.n_factors #' #' @examplesIf require("nFactors") #' data(mtcars) -#' result <- n_factors(mtcars, type = "PCA") +#' result <- parameters::n_factors(mtcars, type = "PCA") #' result #' #' plot(result) # type = "bar" by default diff --git a/R/plot.parameters_brms_meta.R b/R/plot.parameters_brms_meta.R index 34504d80e..00d38de4f 100644 --- a/R/plot.parameters_brms_meta.R +++ b/R/plot.parameters_brms_meta.R @@ -130,7 +130,7 @@ data_plot.parameters_brms_meta <- function(x, data = NULL, normalize_height = TR #' prior(cauchy(0, 0.5), class = sd) #' ) #' model <- suppressWarnings( -#' brm(yi | se(vi) ~ 1 + (1 | author), data = dat) +#' brm(yi | se(vi) ~ 1 + (1 | author), data = dat, refresh = 0, silent = 2) #' ) #' #' # result diff --git a/man/add_plot_attributes.Rd b/man/add_plot_attributes.Rd index 148c7ee85..77b4975cf 100644 --- a/man/add_plot_attributes.Rd +++ b/man/add_plot_attributes.Rd @@ -28,7 +28,7 @@ model <- suppressWarnings(stan_glm( chains = 2, iter = 200, refresh = 0 )) -result <- hdi(model, ci = c(0.5, 0.75, 0.9, 0.95)) +result <- bayestestR::hdi(model, ci = c(0.5, 0.75, 0.9, 0.95)) data <- data_plot(result, data = model) p <- ggplot( diff --git a/man/plot.see_check_heteroscedasticity.Rd b/man/plot.see_check_heteroscedasticity.Rd index 2b7e600b0..2bef7ecaf 100644 --- a/man/plot.see_check_heteroscedasticity.Rd +++ b/man/plot.see_check_heteroscedasticity.Rd @@ -23,7 +23,7 @@ The \code{plot()} method for the } \examples{ m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) -result <- check_heteroscedasticity(m) +result <- performance::check_heteroscedasticity(m) result plot(result, data = m) # data required for pkgdown } diff --git a/man/plot.see_compare_parameters.Rd b/man/plot.see_compare_parameters.Rd index 900e68406..c067323d5 100644 --- a/man/plot.see_compare_parameters.Rd +++ b/man/plot.see_compare_parameters.Rd @@ -63,6 +63,6 @@ data(iris) lm1 <- lm(Sepal.Length ~ Species, data = iris) lm2 <- lm(Sepal.Length ~ Species + Petal.Length, data = iris) lm3 <- lm(Sepal.Length ~ Species * Petal.Length, data = iris) -result <- compare_parameters(lm1, lm2, lm3) +result <- parameters::compare_parameters(lm1, lm2, lm3) plot(result) } diff --git a/man/plot.see_estimate_contrasts.Rd b/man/plot.see_estimate_contrasts.Rd index 05f9de8d7..0b3f295e7 100644 --- a/man/plot.see_estimate_contrasts.Rd +++ b/man/plot.see_estimate_contrasts.Rd @@ -24,6 +24,8 @@ function. \examples{ \dontshow{if (require("emmeans")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \donttest{ +library(modelbased) + model <- lm(Sepal.Width ~ Species, data = iris) contrasts <- estimate_contrasts(model) means <- estimate_means(model) diff --git a/man/plot.see_n_factors.Rd b/man/plot.see_n_factors.Rd index 37a8a6c8d..c3ef4ac29 100644 --- a/man/plot.see_n_factors.Rd +++ b/man/plot.see_n_factors.Rd @@ -33,7 +33,7 @@ The \code{plot()} method for the \code{parameters::n_factors()} and \code{parame \examples{ \dontshow{if (require("nFactors")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(mtcars) -result <- n_factors(mtcars, type = "PCA") +result <- parameters::n_factors(mtcars, type = "PCA") result plot(result) # type = "bar" by default diff --git a/man/plot.see_parameters_brms_meta.Rd b/man/plot.see_parameters_brms_meta.Rd index 502f8c255..8260aa9f2 100644 --- a/man/plot.see_parameters_brms_meta.Rd +++ b/man/plot.see_parameters_brms_meta.Rd @@ -85,7 +85,7 @@ priors <- c( prior(cauchy(0, 0.5), class = sd) ) model <- suppressWarnings( - brm(yi | se(vi) ~ 1 + (1 | author), data = dat) + brm(yi | se(vi) ~ 1 + (1 | author), data = dat, refresh = 0, silent = 2) ) # result