Skip to content

Commit

Permalink
styler
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed May 23, 2024
1 parent 760fd22 commit 1178934
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
4 changes: 2 additions & 2 deletions R/visualisation_recipe.estimate_means.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
#' data$new_factor <- as.factor(rep(c("A", "B"), length.out = nrow(mtcars)))
#'
#' model <- lm(mpg ~ new_factor * cyl * wt, data = data)
#' x <- estimate_means(model, by =c("new_factor", "cyl"))
#' x <- estimate_means(model, by = c("new_factor", "cyl"))
#' plot(visualisation_recipe(x))
#'
#' # Modulations --------------
#' x <- estimate_means(model, by =c("new_factor", "wt"))
#' x <- estimate_means(model, by = c("new_factor", "wt"))
#' plot(visualisation_recipe(x))
#'
#' # x <- estimate_means(model, by =c("new_factor", "cyl", "wt"))
Expand Down
10 changes: 5 additions & 5 deletions R/visualisation_recipe.estimate_slopes.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
#' # ==============================================
#' if (require("ggplot2")) {
#' model <- lm(Sepal.Width ~ Species * Petal.Length, data = iris)
#' x <- estimate_slopes(model, trend = "Petal.Length", by ="Species")
#' x <- estimate_slopes(model, trend = "Petal.Length", by = "Species")
#'
#' layers <- visualisation_recipe(x)
#' layers
#' plot(layers)
#'
#' model <- lm(Petal.Length ~ poly(Sepal.Width, 4), data = iris)
#' x <- estimate_slopes(model, by ="Sepal.Width", length = 20)
#' x <- estimate_slopes(model, by = "Sepal.Width", length = 20)
#' plot(visualisation_recipe(x))
#'
#' model <- lm(Petal.Length ~ Species * poly(Sepal.Width, 3), data = iris)
#' x <- estimate_slopes(model, by =c("Sepal.Width", "Species"))
#' x <- estimate_slopes(model, by = c("Sepal.Width", "Species"))
#' plot(visualisation_recipe(x))
#' }
#' \donttest{
Expand All @@ -27,11 +27,11 @@
#' data$Petal.Length <- data$Petal.Length^2
#'
#' model <- mgcv::gam(Sepal.Width ~ t2(Petal.Width, Petal.Length), data = data)
#' x <- estimate_slopes(model, by =c("Petal.Width", "Petal.Length"), length = 20)
#' x <- estimate_slopes(model, by = c("Petal.Width", "Petal.Length"), length = 20)
#' plot(visualisation_recipe(x))
#'
#' model <- mgcv::gam(Sepal.Width ~ t2(Petal.Width, Petal.Length, by = Species), data = data)
#' x <- estimate_slopes(model, by =c("Petal.Width", "Petal.Length", "Species"), length = 10)
#' x <- estimate_slopes(model, by = c("Petal.Width", "Petal.Length", "Species"), length = 10)
#' plot(visualisation_recipe(x))
#' }
#' }
Expand Down
14 changes: 7 additions & 7 deletions man/visualisation_recipe.estimate_predicted.Rd

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

3 changes: 1 addition & 2 deletions tests/testthat/test-estimate_predicted.R
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,5 @@ test_that("estimate_response - VisMatrix", {
vm <- visualisation_matrix(m, by = c("Petal.Length", "Petal.Width = seq(-3, 3)"))
estim <- estimate_relation(vm)
expect_identical(dim(estim), c(70L, 6L))
expect_named(estim, c("Petal.Length", "Petal.Width", "Predicted", "SE", "CI_low", "CI_high")
)
expect_named(estim, c("Petal.Length", "Petal.Width", "Predicted", "SE", "CI_low", "CI_high"))
})

0 comments on commit 1178934

Please sign in to comment.