From 0ad6c5efddea9974479aaac28c4cc2f3f917e462 Mon Sep 17 00:00:00 2001 From: Mark Colley <39366189+M-Colley@users.noreply.github.com> Date: Mon, 23 Nov 2026 13:10:09 +0000 Subject: [PATCH 1/9] Explain the derivation of the Cohen effect size cutoffs Closes easystats/effectsize#681. --- R/interpret_omega_squared.R | 14 +++++++++++--- man/interpret_omega_squared.Rd | 14 +++++++++++--- vignettes/interpret.Rmd | 3 +-- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/R/interpret_omega_squared.R b/R/interpret_omega_squared.R index 0082af54b..19e396bbd 100644 --- a/R/interpret_omega_squared.R +++ b/R/interpret_omega_squared.R @@ -11,13 +11,20 @@ #' - **0.01 <= ES < 0.06** - Small #' - **0.06 <= ES < 0.14** - Medium #' - **ES >= 0.14 ** - Large -#' - Cohen (1992) (`"cohen1992"`) applicable to one-way anova, or to *partial* -#' eta / omega / epsilon squared in multi-way anova. +#' - Cohen (1992) (`"cohen1992"`; multiple and multiple partial correlation) #' - **ES < 0.02** - Very small #' - **0.02 <= ES < 0.13** - Small #' - **0.13 <= ES < 0.26** - Medium #' - **ES >= 0.26** - Large #' +#' The `"cohen1992"` cutoffs correspond to the rounded \eqn{R^2} values +#' obtained from the \eqn{f^2} benchmarks 0.02, 0.15, and 0.35 in row 8 of +#' Cohen's Table 1 using \eqn{R^2 = f^2 / (1 + f^2)}. Row 7 gives separate +#' one-way ANOVA benchmarks of \eqn{f} = 0.10, 0.25, and 0.40. Squaring +#' these values and applying the same conversion gives rounded eta-squared +#' benchmarks of 0.01, 0.06, and 0.14. Applying either set of cutoffs to +#' rank epsilon squared from a Kruskal-Wallis test is a descriptive heuristic. +#' #' @examples #' interpret_eta_squared(.02) #' interpret_eta_squared(c(.5, .02), rules = "cohen1992") @@ -28,7 +35,8 @@ #' - Field, A (2013) Discovering statistics using IBM SPSS Statistics. Fourth #' Edition. Sage:London. #' -#' - Cohen, J. (1992). A power primer. Psychological bulletin, 112(1), 155. +#' - Cohen, J. (1992). [A power primer](https://doi.org/10.1037/0033-2909.112.1.155). +#' Psychological Bulletin, 112(1), 155-159. #' #' @keywords interpreters #' @export diff --git a/man/interpret_omega_squared.Rd b/man/interpret_omega_squared.Rd index a6e366e02..5c9368fee 100644 --- a/man/interpret_omega_squared.Rd +++ b/man/interpret_omega_squared.Rd @@ -35,8 +35,7 @@ Interpret ANOVA Effect Sizes \item \strong{0.06 <= ES < 0.14} - Medium \item **ES >= 0.14 ** - Large } -\item Cohen (1992) (\code{"cohen1992"}) applicable to one-way anova, or to \emph{partial} -eta / omega / epsilon squared in multi-way anova. +\item Cohen (1992) (\code{"cohen1992"}; multiple and multiple partial correlation) \itemize{ \item \strong{ES < 0.02} - Very small \item \strong{0.02 <= ES < 0.13} - Small @@ -44,6 +43,14 @@ eta / omega / epsilon squared in multi-way anova. \item \strong{ES >= 0.26} - Large } } + +The \code{"cohen1992"} cutoffs correspond to the rounded \eqn{R^2} values +obtained from the \eqn{f^2} benchmarks 0.02, 0.15, and 0.35 in row 8 of +Cohen's Table 1 using \eqn{R^2 = f^2 / (1 + f^2)}. Row 7 gives separate +one-way ANOVA benchmarks of \eqn{f} = 0.10, 0.25, and 0.40. Squaring +these values and applying the same conversion gives rounded eta-squared +benchmarks of 0.01, 0.06, and 0.14. Applying either set of cutoffs to +rank epsilon squared from a Kruskal-Wallis test is a descriptive heuristic. } \examples{ @@ -54,7 +61,8 @@ interpret_eta_squared(c(.5, .02), rules = "cohen1992") \itemize{ \item Field, A (2013) Discovering statistics using IBM SPSS Statistics. Fourth Edition. Sage:London. -\item Cohen, J. (1992). A power primer. Psychological bulletin, 112(1), 155. +\item Cohen, J. (1992). \href{https://doi.org/10.1037/0033-2909.112.1.155}{A power primer}. +Psychological Bulletin, 112(1), 155-159. } } \seealso{ diff --git a/vignettes/interpret.Rmd b/vignettes/interpret.Rmd index 4e5982854..2163e9e88 100644 --- a/vignettes/interpret.Rmd +++ b/vignettes/interpret.Rmd @@ -352,8 +352,7 @@ interpret_omega_squared(x, rules = "field2013") #### @cohen1992power -These are applicable to one-way ANOVAs, or to *partial* Eta / Omega / Epsilon -Squared in a multi-way ANOVA. +Row 8 of Cohen's Table 1 gives $f^2$ benchmarks of 0.02, 0.15, and 0.35 for multiple and multiple partial correlations. Applying $R^2 = f^2 / (1 + f^2)$ gives the rounded `"cohen1992"` cutoffs below. Row 7 gives separate one-way ANOVA benchmarks of $f$ = 0.10, 0.25, and 0.40. Squaring these values and applying the same conversion gives rounded eta-squared benchmarks of 0.01, 0.06, and 0.14. Applying either set of cutoffs to rank epsilon squared from a Kruskal-Wallis test is a descriptive heuristic. ```r interpret_omega_squared(x, rules = "cohen1992") From 815205b40a72fe4a878d2361ac018a9c7df2c195 Mon Sep 17 00:00:00 2001 From: "Mattan S. Ben-Shachar" Date: Tue, 24 Nov 2026 14:04:32 +0200 Subject: [PATCH 2/9] new transform.rules --- DESCRIPTION | 2 +- NAMESPACE | 23 +++++++++++++++-------- NEWS.md | 4 ++++ R/interpret.R | 23 ++++++++++++++++++++++- man/rules.Rd | 14 +++++++++++++- 5 files changed, 55 insertions(+), 11 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 81fce186f..c57d0c32f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -111,6 +111,6 @@ Config/Needs/website: rstudio/bslib, r-lib/pkgdown, easystats/easystatstemplate -Config/roxygen2/version: 8.0.0 +Config/roxygen2/version: 8.1.1 Remotes: easystats/datawizard diff --git a/NAMESPACE b/NAMESPACE index 4521cd8f3..1150da519 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -61,6 +61,7 @@ S3method(riskratio_to_nnt,default) S3method(riskratio_to_nnt,numeric) S3method(riskratio_to_oddsratio,default) S3method(riskratio_to_oddsratio,numeric) +S3method(transform,rules) export(.es_aov_simple) export(.es_aov_strata) export(.es_aov_table) @@ -240,11 +241,17 @@ export(wmw_odds) export(z_to_d) export(z_to_r) importFrom(bayestestR,equivalence_test) -importFrom(datawizard,standardise) -importFrom(datawizard,standardize) -importFrom(insight,display) -importFrom(insight,print_html) -importFrom(insight,print_md) -importFrom(parameters,standardize_info) -importFrom(parameters,standardize_parameters) -importFrom(parameters,standardize_posteriors) +importFrom(datawizard, + standardise, + standardize +) +importFrom(insight, + display, + print_html, + print_md +) +importFrom(parameters, + standardize_info, + standardize_parameters, + standardize_posteriors +) diff --git a/NEWS.md b/NEWS.md index 67185a450..b4dcd5969 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # effectsize (dev) +## New features + +- New `transform()` method for rules, allowing to applied transformed rules. + ## Bug fixes - `rank_biserial(x, y, paired = TRUE)` gives the same CIs as `rank_biserial(x - y)` (#716) diff --git a/R/interpret.R b/R/interpret.R index 517a00810..520c41ad1 100644 --- a/R/interpret.R +++ b/R/interpret.R @@ -19,9 +19,16 @@ #' @seealso [interpret()] #' #' @examples -#' rules(c(0.05), c("significant", "not significant"), right = FALSE) #' rules(c(0.2, 0.5, 0.8), c("small", "medium", "large")) #' rules(c("small" = 0.2, "medium" = 0.5), name = "Cohen's Rules") +#' +#' (sig_rules <- rules(c(0.05), c("significant", "not significant"), right = FALSE)) +#' +#' # Convert the rules for p-values to the rules for S-values +#' p_to_S <- function(p) -log2(p) +#' transform(sig_rules, p_to_S) +#' +#' #' @export rules <- function(values, labels = NULL, name = NULL, right = TRUE) { if (is.null(labels)) { @@ -77,6 +84,20 @@ rules <- function(values, labels = NULL, name = NULL, right = TRUE) { #' @export is.rules <- function(x) inherits(x, "rules") +#' @rdname rules +#' @param `_data` A set of `rules`. +#' @export +transform.rules <- function(`_data`, transform = "identity", new_name = NULL) { + if (is.null(new_name)) { + f_name <- make.names(as.character(substitute(transform))) + new_name <- sprintf("%s(%s)", f_name, attr(`_data`, "rule_name")) + } + + transform <- match.fun(transform) + `_data`$values <- transform(`_data`$values) + attr(`_data`, "rule_name") <- new_name + `_data` +} # Interpret --------------------------------------------------------------- diff --git a/man/rules.Rd b/man/rules.Rd index fcfe5c151..138e890c7 100644 --- a/man/rules.Rd +++ b/man/rules.Rd @@ -3,11 +3,14 @@ \name{rules} \alias{rules} \alias{is.rules} +\alias{transform.rules} \title{Create an Interpretation Grid} \usage{ rules(values, labels = NULL, name = NULL, right = TRUE) is.rules(x) + +\method{transform}{rules}(`_data`, transform = "identity", new_name = NULL) } \arguments{ \item{values}{Vector of reference values (edges defining categories or @@ -24,14 +27,23 @@ themselves should be included in the interval to the right (lower values) or in the interval to the left (higher values).} \item{x}{An arbitrary R object.} + +\item{_data}{A set of \code{rules}.} } \description{ Create a container for interpretation rules of thumb. Usually used in conjunction with \link{interpret}. } \examples{ -rules(c(0.05), c("significant", "not significant"), right = FALSE) rules(c(0.2, 0.5, 0.8), c("small", "medium", "large")) rules(c("small" = 0.2, "medium" = 0.5), name = "Cohen's Rules") + +(sig_rules <- rules(c(0.05), c("significant", "not significant"), right = FALSE)) + +# Convert the rules for p-values to the rules for S-values +p_to_S <- function(p) -log2(p) +transform(sig_rules, p_to_S) + + } \seealso{ \code{\link[=interpret]{interpret()}} From 5705c4ba2e2652ba0ea3604e1784b422bd7e2ad8 Mon Sep 17 00:00:00 2001 From: "Mattan S. Ben-Shachar" Date: Tue, 24 Nov 2026 14:05:01 +0200 Subject: [PATCH 3/9] new interp for Cohen's f and explanation --- NAMESPACE | 2 + R/interpret_omega_squared.R | 106 ++++++++++++++++++++++++--------- man/interpret_omega_squared.Rd | 52 ++++++++++++---- vignettes/interpret.Rmd | 14 +++-- 4 files changed, 131 insertions(+), 43 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 1150da519..603481283 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -128,6 +128,8 @@ export(interpret_agfi) export(interpret_bf) export(interpret_cfi) export(interpret_cohens_d) +export(interpret_cohens_f) +export(interpret_cohens_f2) export(interpret_cohens_g) export(interpret_cramers_v) export(interpret_direction) diff --git a/R/interpret_omega_squared.R b/R/interpret_omega_squared.R index 19e396bbd..6e616404c 100644 --- a/R/interpret_omega_squared.R +++ b/R/interpret_omega_squared.R @@ -1,7 +1,9 @@ #' Interpret ANOVA Effect Sizes #' -#' @param es Value or vector of (partial) eta / omega / epsilon squared or semipartial r squared values. -#' @param rules Can be `"field2013"` (default), `"cohen1992"` or custom set of [rules()]. +#' @param es Value or vector of (partial) eta / omega / epsilon squared or +#' semipartial r squared values, or Cohen's f or f squared. +#' @param rules Can be `"field2013"` (default for eta squared), `"cohen1992"` +#' (default for f squared) or custom set of [rules()]. #' @param ... Not used for now. #' #' @section Rules: @@ -11,23 +13,39 @@ #' - **0.01 <= ES < 0.06** - Small #' - **0.06 <= ES < 0.14** - Medium #' - **ES >= 0.14 ** - Large -#' - Cohen (1992) (`"cohen1992"`; multiple and multiple partial correlation) +#' - Cohen (1992) table 1 row 8 (`"cohen1992r8"` or `"cohen1992"`; multiple and multiple partial correlation) #' - **ES < 0.02** - Very small #' - **0.02 <= ES < 0.13** - Small #' - **0.13 <= ES < 0.26** - Medium #' - **ES >= 0.26** - Large +#' - Cohen (1992) row 7 (`"cohen1992r7"`; one-way ANOVA) +#' - **ES < 0.01** - Very small +#' - **0.01 <= ES < 0.06** - Small +#' - **0.06 <= ES < 0.14** - Medium +#' - **ES >= 0.14** - Large +#' +#' The same rules can be applied to Cohen's \eqn{f^2} (and \eqn{f}) by transforming those values: +#' +#' ```{r} +#' # Field (2013) +#' eta2_to_f2(c(small = 0.01, medium = 0.06, large = 0.14)) +#' ``` #' -#' The `"cohen1992"` cutoffs correspond to the rounded \eqn{R^2} values -#' obtained from the \eqn{f^2} benchmarks 0.02, 0.15, and 0.35 in row 8 of -#' Cohen's Table 1 using \eqn{R^2 = f^2 / (1 + f^2)}. Row 7 gives separate -#' one-way ANOVA benchmarks of \eqn{f} = 0.10, 0.25, and 0.40. Squaring -#' these values and applying the same conversion gives rounded eta-squared -#' benchmarks of 0.01, 0.06, and 0.14. Applying either set of cutoffs to -#' rank epsilon squared from a Kruskal-Wallis test is a descriptive heuristic. +#' Cohen's rules are derived by applying the reverse transformation on Cohen's +#' cut-offs for \eqn{f^2} (row 8) and \enq{f} (row 7): +#' +#' ```{r} +#' # Row 8 +#' f2_to_eta2(c(small = 0.02, medium = 0.15, large = 0.35)) +#' +#' # Row 7 +#' f_to_eta2(c(small = 0.1, medium = 0.25, large = 0.4)) +#' ``` #' #' @examples #' interpret_eta_squared(.02) -#' interpret_eta_squared(c(.5, .02), rules = "cohen1992") +#' interpret_eta_squared(c(.5, .02), rules = "cohen1992r8") +#' #' @seealso https://imaging.mrc-cbu.cam.ac.uk/statswiki/FAQ/effectSize/ #' #' @@ -41,23 +59,7 @@ #' @keywords interpreters #' @export interpret_omega_squared <- function(es, rules = "field2013", ...) { - rules <- .match.rules( - rules, - list( - field2013 = rules( - c(0.01, 0.06, 0.14), - c("very small", "small", "medium", "large"), - name = "field2013", - right = FALSE - ), - cohen1992 = rules( - c(0.02, 0.13, 0.26), - c("very small", "small", "medium", "large"), - name = "cohen1992", - right = FALSE - ) - ) - ) + rules <- .match.rules(rules, .anova_rules) interpret(es, rules) } @@ -73,3 +75,51 @@ interpret_epsilon_squared <- interpret_omega_squared #' @export #' @rdname interpret_omega_squared interpret_r2_semipartial <- interpret_omega_squared + +#' @export +#' @rdname interpret_omega_squared +interpret_cohens_f2 <- function(es, rules = "field2013", ...) { + rules <- .match.rules( + rules, + lapply(.anova_rules, transform, transform = eta2_to_f2) + ) + + interpret(es, rules) +} + +#' @export +#' @rdname interpret_omega_squared +interpret_cohens_f <- function(es, rules = "field2013", ...) { + rules <- .match.rules( + rules, + lapply(.anova_rules, transform, transform = eta2_to_f) + ) + + interpret(es, rules) +} + +# Rules ------------------------------------------------------------------ + +#' @keywords internal +.anova_rules <- list( + field2013 = rules( + c(0.01, 0.06, 0.14), + c("very small", "small", "medium", "large"), + name = "field2013", + right = FALSE + ), + + cohen1992 = rules( + f2_to_eta2(c(0.02, 0.15, 0.35)), + c("very small", "small", "medium", "large"), + name = "cohen1992", + right = FALSE + ), + cohen1992r7 = rules( + f_to_eta2(c(0.1, 0.25, 0.40)), + c("very small", "small", "medium", "large"), + name = "cohen1992", + right = FALSE + ) +) +.anova_rules$cohen1992r8 <- .anova_rules$cohen1992 diff --git a/man/interpret_omega_squared.Rd b/man/interpret_omega_squared.Rd index 5c9368fee..ab5b67f56 100644 --- a/man/interpret_omega_squared.Rd +++ b/man/interpret_omega_squared.Rd @@ -5,6 +5,8 @@ \alias{interpret_eta_squared} \alias{interpret_epsilon_squared} \alias{interpret_r2_semipartial} +\alias{interpret_cohens_f2} +\alias{interpret_cohens_f} \title{Interpret ANOVA Effect Sizes} \usage{ interpret_omega_squared(es, rules = "field2013", ...) @@ -14,11 +16,17 @@ interpret_eta_squared(es, rules = "field2013", ...) interpret_epsilon_squared(es, rules = "field2013", ...) interpret_r2_semipartial(es, rules = "field2013", ...) + +interpret_cohens_f2(es, rules = "field2013", ...) + +interpret_cohens_f(es, rules = "field2013", ...) } \arguments{ -\item{es}{Value or vector of (partial) eta / omega / epsilon squared or semipartial r squared values.} +\item{es}{Value or vector of (partial) eta / omega / epsilon squared or +semipartial r squared values, or Cohen's f or f squared.} -\item{rules}{Can be \code{"field2013"} (default), \code{"cohen1992"} or custom set of \code{\link[=rules]{rules()}}.} +\item{rules}{Can be \code{"field2013"} (default for eta squared), \code{"cohen1992"} +(default for f squared) or custom set of \code{\link[=rules]{rules()}}.} \item{...}{Not used for now.} } @@ -35,27 +43,49 @@ Interpret ANOVA Effect Sizes \item \strong{0.06 <= ES < 0.14} - Medium \item **ES >= 0.14 ** - Large } -\item Cohen (1992) (\code{"cohen1992"}; multiple and multiple partial correlation) +\item Cohen (1992) table 1 row 8 (\code{"cohen1992r8"} or \code{"cohen1992"}; multiple and multiple partial correlation) \itemize{ \item \strong{ES < 0.02} - Very small \item \strong{0.02 <= ES < 0.13} - Small \item \strong{0.13 <= ES < 0.26} - Medium \item \strong{ES >= 0.26} - Large } +\item Cohen (1992) row 7 (\code{"cohen1992r7"}; one-way ANOVA) +\itemize{ +\item \strong{ES < 0.01} - Very small +\item \strong{0.01 <= ES < 0.06} - Small +\item \strong{0.06 <= ES < 0.14} - Medium +\item \strong{ES >= 0.14} - Large +} } -The \code{"cohen1992"} cutoffs correspond to the rounded \eqn{R^2} values -obtained from the \eqn{f^2} benchmarks 0.02, 0.15, and 0.35 in row 8 of -Cohen's Table 1 using \eqn{R^2 = f^2 / (1 + f^2)}. Row 7 gives separate -one-way ANOVA benchmarks of \eqn{f} = 0.10, 0.25, and 0.40. Squaring -these values and applying the same conversion gives rounded eta-squared -benchmarks of 0.01, 0.06, and 0.14. Applying either set of cutoffs to -rank epsilon squared from a Kruskal-Wallis test is a descriptive heuristic. +The same rules can be applied to Cohen's \eqn{f^2} (and \eqn{f}) by transforming those values: + +\if{html}{\out{
}}\preformatted{# Field (2013) +eta2_to_f2(c(small = 0.01, medium = 0.06, large = 0.14)) +#> small medium large +#> 0.01010101 0.06382979 0.16279070 +}\if{html}{\out{
}} + +Cohen's rules are derived by applying the reverse transformation on Cohen's +cut-offs for \eqn{f^2} (row 8) and \enq{f} (row 7): + +\if{html}{\out{
}}\preformatted{# Row 8 +f2_to_eta2(c(small = 0.02, medium = 0.15, large = 0.35)) +#> small medium large +#> 0.01960784 0.13043478 0.25925926 + +# Row 7 +f_to_eta2(c(small = 0.1, medium = 0.25, large = 0.4)) +#> small medium large +#> 0.00990099 0.05882353 0.13793103 +}\if{html}{\out{
}} } \examples{ interpret_eta_squared(.02) -interpret_eta_squared(c(.5, .02), rules = "cohen1992") +interpret_eta_squared(c(.5, .02), rules = "cohen1992r8") + } \references{ \itemize{ diff --git a/vignettes/interpret.Rmd b/vignettes/interpret.Rmd index 2163e9e88..fa09e04a6 100644 --- a/vignettes/interpret.Rmd +++ b/vignettes/interpret.Rmd @@ -1,6 +1,6 @@ --- title: "Automated Interpretation of Indices of Effect Size" -output: +output: rmarkdown::html_vignette: toc: true fig_width: 10.08 @@ -10,7 +10,7 @@ vignette: > \usepackage[utf8]{inputenc} %\VignetteIndexEntry{Automated Interpretation of Indices of Effect Size} %\VignetteEngine{knitr::rmarkdown} -editor_options: +editor_options: chunk_output_type: console bibliography: bibliography.bib --- @@ -329,7 +329,7 @@ interpret_r2(x, rules = "hair2011") - **R2 >= 0.75** - Substantial -## Omega / Eta / Epsilon Squared +## Omega / Eta / Epsilon Squared and Cohen's f Squared The Omega squared is a measure of effect size used in ANOVAs. It is an estimate of how much variance in the response variables are accounted for by the @@ -352,7 +352,7 @@ interpret_omega_squared(x, rules = "field2013") #### @cohen1992power -Row 8 of Cohen's Table 1 gives $f^2$ benchmarks of 0.02, 0.15, and 0.35 for multiple and multiple partial correlations. Applying $R^2 = f^2 / (1 + f^2)$ gives the rounded `"cohen1992"` cutoffs below. Row 7 gives separate one-way ANOVA benchmarks of $f$ = 0.10, 0.25, and 0.40. Squaring these values and applying the same conversion gives rounded eta-squared benchmarks of 0.01, 0.06, and 0.14. Applying either set of cutoffs to rank epsilon squared from a Kruskal-Wallis test is a descriptive heuristic. +Row 8 of Cohen's Table 1 gives $f^2$ benchmarks of 0.02, 0.15, and 0.35 for multiple and multiple partial correlations. Applying $R^2 = f^2 / (1 + f^2)$ (`f2_to_eta2()`) gives the rounded `"cohen1992"` cutoffs below. ```r interpret_omega_squared(x, rules = "cohen1992") @@ -367,6 +367,12 @@ interpret_omega_squared(x, rules = "cohen1992") - **ES >= 0.26** - Large +Row 7 gives separate one-way ANOVA benchmarks of $f$ = 0.10, 0.25, and 0.40. Squaring these values and applying the same conversion gives rounded eta-squared benchmarks of 0.01, 0.06, and 0.14. Applying either set of cutoffs to rank epsilon squared from a Kruskal-Wallis test is a descriptive heuristic. + +```r +interpret_cohens_f(x, rules = "cohen1992r7") +``` + ## Kendall's coefficient of concordance The interpretation of Kendall's coefficient of concordance (*w*) is a measure of From cc11c1556a807a941acaf7dd38fef73b6118861e Mon Sep 17 00:00:00 2001 From: "Mattan S. Ben-Shachar" Date: Tue, 24 Nov 2026 14:05:07 +0200 Subject: [PATCH 4/9] docs fix --- R/eta_squared_posterior.R | 4 ++-- man/eta_squared.Rd | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/eta_squared_posterior.R b/R/eta_squared_posterior.R index a8bfbb39b..0fe57b35c 100644 --- a/R/eta_squared_posterior.R +++ b/R/eta_squared_posterior.R @@ -1,6 +1,6 @@ #' @param ss_function For Bayesian models, the function used to extract -#' sum-of-squares. Uses [`anova()`] by default, but can also be `car::Anova()` -#' for simple linear models. +#' sum-of-squares. Uses [`stats::anova()`] by default, but can also be +#' `car::Anova()` for simple linear models. #' @param draws For Bayesian models, an integer indicating the number of draws #' from the posterior predictive distribution to return. Larger numbers take #' longer to run, but provide estimates that are more stable. diff --git a/man/eta_squared.Rd b/man/eta_squared.Rd index cd9310c63..10ca6cb29 100644 --- a/man/eta_squared.Rd +++ b/man/eta_squared.Rd @@ -111,8 +111,8 @@ allowed (e.g., \code{"g"}, \code{"l"}, \code{"two"}...). See \emph{One-Sided CIs returns the effect size for R-squared-change between the two models.} \item{ss_function}{For Bayesian models, the function used to extract -sum-of-squares. Uses \code{\link[=anova]{anova()}} by default, but can also be \code{car::Anova()} -for simple linear models.} +sum-of-squares. Uses \code{\link[stats:anova]{stats::anova()}} by default, but can also be +\code{car::Anova()} for simple linear models.} \item{draws}{For Bayesian models, an integer indicating the number of draws from the posterior predictive distribution to return. Larger numbers take From 7ecb5537315373975c2b9dba4b4cb0c803e453f8 Mon Sep 17 00:00:00 2001 From: "Mattan S. Ben-Shachar" Date: Tue, 24 Nov 2026 14:06:47 +0200 Subject: [PATCH 5/9] fix typo --- R/interpret_omega_squared.R | 2 +- man/interpret_omega_squared.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/interpret_omega_squared.R b/R/interpret_omega_squared.R index 6e616404c..11ef2c55f 100644 --- a/R/interpret_omega_squared.R +++ b/R/interpret_omega_squared.R @@ -32,7 +32,7 @@ #' ``` #' #' Cohen's rules are derived by applying the reverse transformation on Cohen's -#' cut-offs for \eqn{f^2} (row 8) and \enq{f} (row 7): +#' cut-offs for \eqn{f^2} (row 8) and \eqn{f} (row 7): #' #' ```{r} #' # Row 8 diff --git a/man/interpret_omega_squared.Rd b/man/interpret_omega_squared.Rd index ab5b67f56..eea7f778a 100644 --- a/man/interpret_omega_squared.Rd +++ b/man/interpret_omega_squared.Rd @@ -68,7 +68,7 @@ eta2_to_f2(c(small = 0.01, medium = 0.06, large = 0.14)) }\if{html}{\out{}} Cohen's rules are derived by applying the reverse transformation on Cohen's -cut-offs for \eqn{f^2} (row 8) and \enq{f} (row 7): +cut-offs for \eqn{f^2} (row 8) and \eqn{f} (row 7): \if{html}{\out{
}}\preformatted{# Row 8 f2_to_eta2(c(small = 0.02, medium = 0.15, large = 0.35)) From e3ad59d9ee1717cd0153a0cafc84fa31e748b506 Mon Sep 17 00:00:00 2001 From: "Mattan S. Ben-Shachar" Date: Tue, 24 Nov 2026 14:09:13 +0200 Subject: [PATCH 6/9] more docs for transform.rules --- R/interpret.R | 2 ++ man/rules.Rd | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/R/interpret.R b/R/interpret.R index 520c41ad1..0f18a18ed 100644 --- a/R/interpret.R +++ b/R/interpret.R @@ -86,6 +86,8 @@ is.rules <- function(x) inherits(x, "rules") #' @rdname rules #' @param `_data` A set of `rules`. +#' @param new_name Name to give to the new rule. Defaults to `transform(old_name)` +#' @param transform Transformation to apply to the rules' values. #' @export transform.rules <- function(`_data`, transform = "identity", new_name = NULL) { if (is.null(new_name)) { diff --git a/man/rules.Rd b/man/rules.Rd index 138e890c7..44f715214 100644 --- a/man/rules.Rd +++ b/man/rules.Rd @@ -29,6 +29,10 @@ or in the interval to the left (higher values).} \item{x}{An arbitrary R object.} \item{_data}{A set of \code{rules}.} + +\item{transform}{Transformation to apply to the rules' values.} + +\item{new_name}{Name to give to the new rule. Defaults to \code{transform(old_name)}} } \description{ Create a container for interpretation rules of thumb. Usually used in conjunction with \link{interpret}. From f47e6c54c921fd74c4483a32654e31bf78ba5a91 Mon Sep 17 00:00:00 2001 From: "Mattan S. Ben-Shachar" Date: Tue, 24 Nov 2026 21:52:02 +0200 Subject: [PATCH 7/9] add ... to transform.rules --- R/interpret.R | 7 ++++++- man/rules.Rd | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/R/interpret.R b/R/interpret.R index 0f18a18ed..040b564cf 100644 --- a/R/interpret.R +++ b/R/interpret.R @@ -89,7 +89,12 @@ is.rules <- function(x) inherits(x, "rules") #' @param new_name Name to give to the new rule. Defaults to `transform(old_name)` #' @param transform Transformation to apply to the rules' values. #' @export -transform.rules <- function(`_data`, transform = "identity", new_name = NULL) { +transform.rules <- function( + `_data`, + transform = "identity", + new_name = NULL, + ... +) { if (is.null(new_name)) { f_name <- make.names(as.character(substitute(transform))) new_name <- sprintf("%s(%s)", f_name, attr(`_data`, "rule_name")) diff --git a/man/rules.Rd b/man/rules.Rd index 44f715214..3295a2d19 100644 --- a/man/rules.Rd +++ b/man/rules.Rd @@ -10,7 +10,7 @@ rules(values, labels = NULL, name = NULL, right = TRUE) is.rules(x) -\method{transform}{rules}(`_data`, transform = "identity", new_name = NULL) +\method{transform}{rules}(`_data`, transform = "identity", new_name = NULL, ...) } \arguments{ \item{values}{Vector of reference values (edges defining categories or From e38b710a7af8126c387b122828e3e9cb03788444 Mon Sep 17 00:00:00 2001 From: "Mattan S. Ben-Shachar" Date: Tue, 24 Nov 2026 22:04:50 +0200 Subject: [PATCH 8/9] fix test related to change in lme4 --- tests/testthat/test-convert_between.R | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/testthat/test-convert_between.R b/tests/testthat/test-convert_between.R index 43f48170c..9141a0212 100644 --- a/tests/testthat/test-convert_between.R +++ b/tests/testthat/test-convert_between.R @@ -208,27 +208,27 @@ test_that("OR <=> RR | models", { expect_equal(OR$Coefficient, c(0.05, 0.5768169, 0.1884581), tolerance = 0.001) # -- GLMMs -- - skip_if_not_installed("lme4") + skip_if_not_installed("lme4", minimum_version = "2.1.0") m <<- lme4::glmer( am ~ factor(cyl) + (1 | gear), data = mtcars, - family = binomial() + family = binomial(link = "logit"), + control = lme4::glmerControl("bobyqa") ) expect_warning(RR <- oddsratio_to_riskratio(m, ci = NULL), "p0") # nolint expect_false("(Intercept)" %in% RR$Parameter) expect_true("(p0)" %in% RR$Parameter) - expect_warning( - RR <- oddsratio_to_riskratio(m, ci_method = "wald", p0 = 0.7047536), - NA + expect_no_warning( + RR <- oddsratio_to_riskratio(m, ci_method = "wald", p0 = 0.7047536) ) # nolint expect_false("(Intercept)" %in% RR$Parameter) expect_true("(p0)" %in% RR$Parameter) # these values confirmed from emmeans - expect_equal(RR$Coefficient, c(0.7048, 0.6042, 0.4475), tolerance = 0.001) - expect_equal(RR$CI_low, c(NA, 0.08556, 0.0102), tolerance = 0.001) - expect_equal(RR$CI_high, c(NA, 1.2706, 1.3718), tolerance = 0.001) + expect_equal(RR$Coefficient, c(0.7048, 0.6013, 0.4361), tolerance = 0.001) + expect_equal(RR$CI_low, c(NA, 0.0761, 0.0018), tolerance = 0.001) + expect_equal(RR$CI_high, c(NA, 1.284, 1.410), tolerance = 0.001) }) test_that("OR and logOR <=> ARR", { From 86d127449353d63dac5617478246382c394139af Mon Sep 17 00:00:00 2001 From: "Mattan S. Ben-Shachar" Date: Wed, 25 Nov 2026 08:24:15 +0200 Subject: [PATCH 9/9] doc ... --- R/interpret.R | 3 ++- man/rules.Rd | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/R/interpret.R b/R/interpret.R index 040b564cf..7fe116ad7 100644 --- a/R/interpret.R +++ b/R/interpret.R @@ -86,6 +86,7 @@ is.rules <- function(x) inherits(x, "rules") #' @rdname rules #' @param `_data` A set of `rules`. +#' @param ... Arguments passed to the `transform` function in `transform()`. Otherwise ignored. #' @param new_name Name to give to the new rule. Defaults to `transform(old_name)` #' @param transform Transformation to apply to the rules' values. #' @export @@ -101,7 +102,7 @@ transform.rules <- function( } transform <- match.fun(transform) - `_data`$values <- transform(`_data`$values) + `_data`$values <- transform(`_data`$values, ...) attr(`_data`, "rule_name") <- new_name `_data` } diff --git a/man/rules.Rd b/man/rules.Rd index 3295a2d19..b4370a01c 100644 --- a/man/rules.Rd +++ b/man/rules.Rd @@ -33,6 +33,8 @@ or in the interval to the left (higher values).} \item{transform}{Transformation to apply to the rules' values.} \item{new_name}{Name to give to the new rule. Defaults to \code{transform(old_name)}} + +\item{...}{Arguments passed to the \code{transform} function in \code{transform()}. Otherwise ignored.} } \description{ Create a container for interpretation rules of thumb. Usually used in conjunction with \link{interpret}.