Skip to content

Commit

Permalink
examplesIf
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Sep 14, 2023
1 parent 9805166 commit 12bd32c
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 45 deletions.
8 changes: 3 additions & 5 deletions R/model_performance.mixed.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@
#' on returned indices.
#' }
#'
#' @examples
#' if (require("lme4")) {
#' model <- lmer(Petal.Length ~ Sepal.Length + (1 | Species), data = iris)
#' model_performance(model)
#' }
#' @examplesIf require("lme4")
#' model <- lme4::lmer(Petal.Length ~ Sepal.Length + (1 | Species), data = iris)
#' model_performance(model)
#' @export
model_performance.merMod <- function(model,
metrics = "all",
Expand Down
15 changes: 7 additions & 8 deletions R/performance_rmse.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@
#'
#' @return Numeric, the root mean squared error.
#'
#' @examples
#' if (require("nlme")) {
#' m <- lme(distance ~ age, data = Orthodont)
#' @examplesIf require("nlme")
#' data(Orthodont, package = "nlme")
#' m <- nlme::lme(distance ~ age, data = Orthodont)
#'
#' # RMSE
#' performance_rmse(m, normalized = FALSE)
#' # RMSE
#' performance_rmse(m, normalized = FALSE)
#'
#' # normalized RMSE
#' performance_rmse(m, normalized = TRUE)
#' }
#' # normalized RMSE
#' performance_rmse(m, normalized = TRUE)
#' @export
performance_rmse <- function(model, normalized = FALSE, verbose = TRUE) {
tryCatch(
Expand Down
20 changes: 9 additions & 11 deletions R/performance_score.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#'
#' @seealso [`performance_logloss()`]
#'
#' @examples
#' @examplesIf require("glmmTMB")
#' ## Dobson (1990) Page 93: Randomized Controlled Trial :
#' counts <- c(18, 17, 15, 20, 10, 20, 25, 13, 12)
#' outcome <- gl(3, 1, 9)
Expand All @@ -41,17 +41,15 @@
#'
#' performance_score(model)
#' \dontrun{
#' if (require("glmmTMB")) {
#' data(Salamanders)
#' model <- glmmTMB(
#' count ~ spp + mined + (1 | site),
#' zi = ~ spp + mined,
#' family = nbinom2(),
#' data = Salamanders
#' )
#' data(Salamanders, package = "glmmTMB")
#' model <- glmmTMB::glmmTMB(
#' count ~ spp + mined + (1 | site),
#' zi = ~ spp + mined,
#' family = nbinom2(),
#' data = Salamanders
#' )
#'
#' performance_score(model)
#' }
#' performance_score(model)
#' }
#' @export
performance_score <- function(model, verbose = TRUE, ...) {
Expand Down
8 changes: 4 additions & 4 deletions man/model_performance.merMod.Rd

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

15 changes: 8 additions & 7 deletions man/performance_rmse.Rd

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

20 changes: 10 additions & 10 deletions man/performance_score.Rd

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

0 comments on commit 12bd32c

Please sign in to comment.