From 18978e8a7751782de08c0d9f877d44b9ba99769d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 4 Nov 2023 13:01:50 +0530 Subject: [PATCH 1/7] [create-pull-request] automated change (#614) Co-authored-by: IndrajeetPatil --- DESCRIPTION | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 95cb6cf0..54e95fb2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -67,10 +67,10 @@ Depends: R (>= 3.6) Imports: bayestestR (>= 0.13.1), - insight (>= 0.19.5), - parameters (>= 0.21.1), - performance (>= 0.10.5), - datawizard (>= 0.8.0), + insight (>= 0.19.6), + parameters (>= 0.21.2), + performance (>= 0.10.8), + datawizard (>= 0.9.0), stats, utils Suggests: From 448e39bdbb66b24fe1f83922fb1c9696951c51db Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 4 Nov 2023 08:40:26 +0100 Subject: [PATCH 2/7] fix warning about licence --- .Rbuildignore | 4 ++-- DESCRIPTION | 2 +- LICENSE | 23 ++--------------------- LICENSE.md | 21 +++++++++++++++++++++ README.md | 44 +++++++++++++++++++++++--------------------- man/effectsize.Rd | 4 ++-- 6 files changed, 51 insertions(+), 47 deletions(-) create mode 100644 LICENSE.md diff --git a/.Rbuildignore b/.Rbuildignore index 5aaffd82..f809dcf3 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -28,7 +28,6 @@ publication/* ^\.httr-oauth$ ^CRAN-RELEASE$ tests\^spelling -^LICENSE ^\.lintr$ ^\.circleci$ ^tests/manual$ @@ -52,4 +51,5 @@ hextools \.code-workspace$ # Flip these two to no build vignettes: # ^vignettes/(?!additional).* -^vignettes/additional \ No newline at end of file +^vignettes/additional +^LICENSE\.md$ diff --git a/DESCRIPTION b/DESCRIPTION index 54e95fb2..5c10ce47 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: effectsize Title: Indices of Effect Size -Version: 0.8.6.1 +Version: 0.8.6.2 Authors@R: c(person(given = "Mattan S.", family = "Ben-Shachar", diff --git a/LICENSE b/LICENSE index ea50e788..f3dcba36 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,2 @@ -# MIT License - -Copyright (c) 2023 easystats team - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +YEAR: 2023 +COPYRIGHT HOLDER: effectsize authors diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..b5aac20e --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# MIT License + +Copyright (c) 2023 effectsize authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index b4ff4a0c..d610f50c 100644 --- a/README.md +++ b/README.md @@ -54,22 +54,24 @@ Click on the buttons above to access the package [**easystats blog**](https://easystats.github.io/blog/posts/), and check-out these vignettes: -- **Effect Sizes** - - [**Standardized - Differences**](https://easystats.github.io/effectsize/articles/standardized_differences.html) - - [**For Contingency - Tables**](https://easystats.github.io/effectsize/articles/xtabs.html) - - [**ANOVA Effect - Sizes**](https://easystats.github.io/effectsize/articles/anovaES.html) -- **Effect Sizes Conversion** - - [**Between Effect - Sizes**](https://easystats.github.io/effectsize/articles/convert_r_d_OR.html) - - [**Between Probabilities and Odds and Risk - Ratios**](https://easystats.github.io/effectsize/articles/convert_p_OR_RR.html) - - [**Effect Size from Test - Statistics**](https://easystats.github.io/effectsize/articles/from_test_statistics.html) -- [**Automated Interpretation of Indices of Effect - Size**](https://easystats.github.io/effectsize/articles/interpret.html) +- **Effect Sizes** + - [**Standardized + Differences**](https://easystats.github.io/effectsize/articles/standardized_differences.html) + - [**For Contingency + Tables**](https://easystats.github.io/effectsize/articles/xtabs.html) + - [**ANOVA Effect + Sizes**](https://easystats.github.io/effectsize/articles/anovaES.html) +- **Effect Sizes Conversion** + - [**Between Effect + Sizes**](https://easystats.github.io/effectsize/articles/convert_r_d_OR.html) + - [**Between Probabilities and Odds and Risk + Ratios**](https://easystats.github.io/effectsize/articles/convert_p_OR_RR.html) + - [**Effect Size from Test + Statistics**](https://easystats.github.io/effectsize/articles/from_test_statistics.html) +- [**Plotting Functions for the ‘effectsize’ + Package**](https://easystats.github.io/see/articles/effectsize.html) +- [**Automated Interpretation of Indices of Effect + Size**](https://easystats.github.io/effectsize/articles/interpret.html) # Features @@ -122,7 +124,7 @@ language effect sizes* and more… ### Contingency Tables ``` r -# Dependence +# Dependence phi(mtcars$am, mtcars$vs) ## ϕ (adj.) | 95% CI ## ----------------------- @@ -143,7 +145,7 @@ fei(table(mtcars$cyl), p = c(0.1, 0.3, 0.6)) ## ------------------- ## 0.27 | [0.17, 1.00] ## -## - Adjusted for non-uniform expected probabilities. +## - Adjusted for uniform expected probabilities. ## - One-sided CIs: upper bound fixed at [1.00]. ``` @@ -256,9 +258,9 @@ interpret_cohens_d(d = 0.45, rules = "gignac2016") In order to cite this package, please use the following citation: -- Ben-Shachar M, Lüdecke D, Makowski D (2020). effectsize: Estimation - of Effect Size Indices and Standardized Parameters. *Journal of Open - Source Software*, *5*(56), 2815. doi: 10.21105/joss.02815 +- Ben-Shachar M, Lüdecke D, Makowski D (2020). effectsize: Estimation of + Effect Size Indices and Standardized Parameters. *Journal of Open + Source Software*, *5*(56), 2815. doi: 10.21105/joss.02815 Corresponding BibTeX entry: diff --git a/man/effectsize.Rd b/man/effectsize.Rd index 7770ab81..5d931c82 100644 --- a/man/effectsize.Rd +++ b/man/effectsize.Rd @@ -22,7 +22,7 @@ effectsize(model, ...) \item{type}{The effect size of interest. See details.} \item{ci}{Value or vector of probability of the CI (between 0 and 1) -to be estimated. Default to \code{.95} (\verb{95\%}).} +to be estimated. Default to \code{0.95} (\verb{95\%}).} \item{test}{The indices of effect existence to compute. Character (vector) or list with one or more of these options: \code{"p_direction"} (or \code{"pd"}), @@ -32,7 +32,7 @@ For each "test", the corresponding \pkg{bayestestR} function is called (e.g. \code{\link[bayestestR:rope]{rope()}} or \code{\link[bayestestR:p_direction]{p_direction()}}) and its results included in the summary output.} -\item{verbose}{Toggle warnings and messages on or off.} +\item{verbose}{Toggle off warnings.} \item{...}{Arguments passed to or from other methods. See details.} } From b0caa91f2662ce7b9d8768ab5ae537047889043b Mon Sep 17 00:00:00 2001 From: "Mattan S. Ben-Shachar" <35330040+mattansb@users.noreply.github.com> Date: Tue, 7 Nov 2023 09:20:59 +0200 Subject: [PATCH 3/7] New `repeated_measures_d()` (#618) This PR introduces the new `repeated_measures_d()` function (#372). --- NAMESPACE | 2 + NEWS.md | 5 + R/cohens_d.R | 23 +- R/common_language.R | 7 + R/datasets.R | 30 + R/effectsize.R | 8 + R/effectsize.htest.R | 9 +- R/mahalanobis_D.R | 1 - R/print.effectsize_table.R | 3 +- R/rank_diff.R | 1 + R/repeated_measures_d.R | 306 +++ R/sysdata.rda | Bin 1234 -> 1342 bytes R/utils_ci.R | 2 + R/utils_validate_input_data.R | 85 +- README.Rmd | 2 +- WIP/paired_d examples.R | 75 - WIP/paired_d2.R | 202 -- _pkgdown.yml | 2 + data-raw/df data.R | 12 + data-raw/effectSizePuzzler.txt | 2501 ++++++++++++++++++++++++ data-raw/es_info.R | 5 + data/rouder2016.rdata | Bin 0 -> 6442 bytes man/Music_preferences.Rd | 1 + man/Music_preferences2.Rd | 1 + man/RCT_table.Rd | 1 + man/Smoking_FASD.Rd | 1 + man/cohens_d.Rd | 13 +- man/effectsize.Rd | 10 + man/food_class.Rd | 1 + man/hardlyworking.Rd | 1 + man/mahalanobis_d.Rd | 3 +- man/means_ratio.Rd | 3 +- man/p_superiority.Rd | 3 +- man/rank_biserial.Rd | 3 +- man/repeated_measures_d.Rd | 241 +++ man/rouder2016.Rd | 43 + man/screening_test.Rd | 3 +- tests/testthat/test-effectsize.R | 21 +- tests/testthat/test-rm_d.R | 126 ++ vignettes/standardized_differences.Rmd | 34 +- 40 files changed, 3484 insertions(+), 306 deletions(-) create mode 100644 R/repeated_measures_d.R delete mode 100644 WIP/paired_d examples.R delete mode 100644 WIP/paired_d2.R create mode 100644 data-raw/effectSizePuzzler.txt create mode 100644 data/rouder2016.rdata create mode 100644 man/repeated_measures_d.Rd create mode 100644 man/rouder2016.Rd create mode 100644 tests/testthat/test-rm_d.R diff --git a/NAMESPACE b/NAMESPACE index 5c5977eb..233ea5b6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -211,11 +211,13 @@ export(rb_to_common_language) export(rb_to_p_superiority) export(rb_to_vda) export(rb_to_wmw_odds) +export(repeated_measures_d) export(riskratio) export(riskratio_to_arr) export(riskratio_to_logoddsratio) export(riskratio_to_nnt) export(riskratio_to_oddsratio) +export(rm_d) export(rules) export(sd_pooled) export(standardise) diff --git a/NEWS.md b/NEWS.md index 1d353256..05d6febf 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,11 @@ - This release changes the licensing model of `{effectsize}` to an MIT license. +## New features + +- `repeated_measures_d()` to compute standardized mean differences (SMD) for repeated measures data. + - Also supported in `effectsize()` + # effectsize 0.8.7 ## New features diff --git a/R/cohens_d.R b/R/cohens_d.R index 5956bf6a..f778e624 100644 --- a/R/cohens_d.R +++ b/R/cohens_d.R @@ -25,7 +25,7 @@ #' variance). Else the mean SD from both groups is used instead. #' @param paired If `TRUE`, the values of `x` and `y` are considered as paired. #' This produces an effect size that is equivalent to the one-sample effect -#' size on `x - y`. +#' size on `x - y`. See also [repeated_measures_d()] for more options. #' @param ... Arguments passed to or from other methods. When `x` is a formula, #' these can be `subset` and `na.action`. #' @inheritParams chisq_to_phi @@ -48,7 +48,7 @@ #' `Glass_delta`) and their CIs (`CI_low` and `CI_high`). #' #' @family standardized differences -#' @seealso [sd_pooled()], [t_to_d()], [r_to_d()] +#' @seealso [rm_d()], [sd_pooled()], [t_to_d()], [r_to_d()] #' #' @examples #' \donttest{ @@ -91,10 +91,12 @@ #' #' # same as: #' # cohens_d(sleep$extra[sleep$group == 1], sleep$extra[sleep$group == 2], paired = TRUE) +#' # cohens_d(sleep$extra[sleep$group == 1] - sleep$extra[sleep$group == 2]) +#' # rm_d(sleep$extra[sleep$group == 1], sleep$extra[sleep$group == 2], method = "z", adjust = FALSE) #' #' # More options: -#' cohens_d(Pair(extra[group == 1], extra[group == 2]) ~ 1, data = sleep, mu = -1) -#' hedges_g(Pair(extra[group == 1], extra[group == 2]) ~ 1, data = sleep) +#' cohens_d(Pair(extra[group == 1], extra[group == 2]) ~ 1, data = sleep, mu = -1, verbose = FALSE) +#' hedges_g(Pair(extra[group == 1], extra[group == 2]) ~ 1, data = sleep, verbose = FALSE) #' #' #' # Interpretation ----------------------- @@ -208,6 +210,12 @@ glass_delta <- function(x, y = NULL, data = NULL, y <- out[["y"]] paired <- out[["paired"]] + if (verbose && paired && !is.null(y)) { + insight::format_alert( + "For paired samples, 'repeated_measures_d()' provides more options." + ) + } + if (is.null(y)) { if (type == "delta") { insight::format_error("For Glass' Delta, please provide data from two samples.") @@ -287,7 +295,7 @@ glass_delta <- function(x, y = NULL, data = NULL, if (type == "g") { - J <- exp(lgamma(df / 2) - log(sqrt(df / 2)) - lgamma((df - 1) / 2)) # exact method + J <- .J(df) out[, colnames(out) %in% c("Hedges_g", "CI_low", "CI_high")] <- out[, colnames(out) %in% c("Hedges_g", "CI_low", "CI_high")] * J @@ -300,3 +308,8 @@ glass_delta <- function(x, y = NULL, data = NULL, ) return(out) } + +#' @keywords internal +.J <- function(df) { + exp(lgamma(df / 2) - log(sqrt(df / 2)) - lgamma((df - 1) / 2)) # exact method +} diff --git a/R/common_language.R b/R/common_language.R index 9b8ef22f..392c094a 100644 --- a/R/common_language.R +++ b/R/common_language.R @@ -7,6 +7,9 @@ #' any reported [`stats::t.test()`] or [`stats::wilcox.test()`]. #' #' @inheritParams cohens_d +#' @param paired If `TRUE`, the values of `x` and `y` are considered as paired. +#' This produces an effect size that is equivalent to the one-sample effect +#' size on `x - y`. #' @param parametric Use parametric estimation (see [cohens_d()]) or #' non-parametric estimation (see [rank_biserial()]). See details. #' @param iterations The number of bootstrap replicates for computing confidence @@ -126,6 +129,10 @@ p_superiority <- function(x, y = NULL, data = NULL, paired <- data[["paired"]] if (parametric) { + if (paired) { + x <- x - y + y <- NULL + } d <- cohens_d( x = x, y = y, diff --git a/R/datasets.R b/R/datasets.R index 68aed4ad..7a6ac62b 100644 --- a/R/datasets.R +++ b/R/datasets.R @@ -28,6 +28,36 @@ #' NULL +#' Jeff Rouder's Example Dataset for Repeated Measures +#' +#' A dataset "with 25 people each observing 50 trials in 2 conditions", +#' published as `effectSizePuzzler.txt` by Jeff Rouder on March 24, 2016 +#' (_http://jeffrouder.blogspot.com/2016/03/the-effect-size-puzzler.html_). +#' \cr\cr +#' The data is used in examples and tests of [rm_d()]. +#' +#' @docType data +#' +#' @name rouder2016 +#' +#' @keywords data +#' +#' @format A data frame with 2500 rows and 3 variables: +#' \describe{ +#' \item{id}{participant: 1...25} +#' \item{cond}{condition: 1,2} +#' \item{rt}{response time in seconds} +#' } +#' +#' ```{r} +#' data("rouder2016") +#' head(rouder2016, n = 5) +#' ``` +#' @family effect size datasets +#' +NULL + + #' Results from 2 Screening Tests #' #' A sample (simulated) dataset, used in tests and some examples. diff --git a/R/effectsize.R b/R/effectsize.R index 1ebca00b..b0377c17 100644 --- a/R/effectsize.R +++ b/R/effectsize.R @@ -14,6 +14,7 @@ #' #' - For an object of class `htest`, data is extracted via [insight::get_data()], and passed to the relevant function according to: #' - A **t-test** depending on `type`: `"cohens_d"` (default), `"hedges_g"`, or one of `"p_superiority"`, `"u1"`, `"u2"`, `"u3"`, `"overlap"`. +#' - For a **Paired t-test**: depending on `type`: `"rm"`, `"av"`, `"b"`, `"d"`, `"z"`. #' - A **Chi-squared tests of independence** or **Fisher's Exact Test**, depending on `type`: `"cramers_v"` (default), `"tschuprows_t"`, `"phi"`, `"cohens_w"`, `"pearsons_c"`, `"cohens_h"`, `"oddsratio"`, `"riskratio"`, `"arr"`, or `"nnt"`. #' - A **Chi-squared tests of goodness-of-fit**, depending on `type`: `"fei"` (default) `"cohens_w"`, `"pearsons_c"` #' - A **One-way ANOVA test**, depending on `type`: `"eta"` (default), `"omega"` or `"epsilon"` -squared, `"f"`, or `"f2"`. @@ -50,6 +51,13 @@ #' Tt <- t.test(1:10, y = c(7:20), alternative = "less") #' effectsize(Tt) #' +#' Tt <- t.test( +#' x = c(1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30), +#' y = c(0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29), +#' paired = TRUE +#' ) +#' effectsize(Tt, type = "rm_b") +#' #' Aov <- oneway.test(extra ~ group, data = sleep, var.equal = TRUE) #' effectsize(Aov) #' effectsize(Aov, type = "omega") diff --git a/R/effectsize.htest.R b/R/effectsize.htest.R index bce6e595..86d7213a 100644 --- a/R/effectsize.htest.R +++ b/R/effectsize.htest.R @@ -44,11 +44,11 @@ effectsize.htest <- function(model, type = NULL, verbose = TRUE, ...) { dots$alternative <- model$alternative dots$ci <- attr(model$conf.int, "conf.level") dots$mu <- model$null.value - dots$paired <- !grepl("Two", model$method, fixed = TRUE) + dots$paired <- grepl("Paired", model$method, fixed = TRUE) dots$verbose <- verbose if (!type %in% c("d", "g")) { - .fail_if_approx(approx, "cles") + .fail_if_approx(approx, if (startsWith(type, "rm")) "rm_d" else "cles") } if (approx) { @@ -81,6 +81,11 @@ effectsize.htest <- function(model, type = NULL, verbose = TRUE, ...) { d = cohens_d, g = hedges_g ) + } else if (dots$paired && startsWith(type, "rm")) { + args[c("x", "y")] <- split(args$x, args$y) + dots$paired <- args$pooled_sd <- NULL + args$method <- gsub("^rm\\_", "", type) + f <- rm_d } else { if (!dots$paired && !args$pooled_sd) { insight::format_error("Common language effect size only applicable to Cohen's d with pooled SD.") diff --git a/R/mahalanobis_D.R b/R/mahalanobis_D.R index c7e30eb6..c365b451 100644 --- a/R/mahalanobis_D.R +++ b/R/mahalanobis_D.R @@ -85,7 +85,6 @@ mahalanobis_d <- function(x, y = NULL, data = NULL, pooled_cov = TRUE, mu = 0, ci = 0.95, alternative = "greater", verbose = TRUE, ...) { - # TODO add one sample case DV1 + DV2 ~ 1 # TODO add paired samples case DV1 + DV2 ~ 1 | ID alternative <- .match.alt(alternative, FALSE) data <- .get_data_multivariate(x, y, data, verbose = verbose, ...) diff --git a/R/print.effectsize_table.R b/R/print.effectsize_table.R index 62e22ff7..8af3354c 100644 --- a/R/print.effectsize_table.R +++ b/R/print.effectsize_table.R @@ -161,7 +161,8 @@ print.effectsize_difference <- function(x, digits = 2, append_CLES = NULL, ...) #' @export format.effectsize_difference <- function(x, digits = 2, ...) { - caption <- subtitle <- footer <- NULL + caption <- subtitle <- NULL + footer <- attr(x, "table_footer") ## Add footer mu <- attr(x, "mu") diff --git a/R/rank_diff.R b/R/rank_diff.R index 6ecc51df..c1a58ae7 100644 --- a/R/rank_diff.R +++ b/R/rank_diff.R @@ -6,6 +6,7 @@ #' to the [Common Language Effect Sizes][cohens_u3]. Pair with any reported #' [`stats::wilcox.test()`]. #' +#' @inheritParams p_superiority #' @inheritParams cohens_d #' @param x,y A numeric or ordered vector, or a character name of one in `data`. #' Any missing values (`NA`s) are dropped from the resulting vector. `x` can diff --git a/R/repeated_measures_d.R b/R/repeated_measures_d.R new file mode 100644 index 00000000..53fcace6 --- /dev/null +++ b/R/repeated_measures_d.R @@ -0,0 +1,306 @@ +#' Standardized Mean Differences for Repeated Measures +#' +#' Compute effect size indices for standardized mean differences in repeated +#' measures data. Pair with any reported `stats::t.test(paired = TRUE)`. +#' \cr\cr +#' In a repeated-measures design, the same subjects are measured in multiple +#' conditions or time points. Unlike the case of independent groups, there are +#' multiple sources of variation that can be used to standardized the +#' differences between the means of the conditions / times. +#' +#' @param x,y Paired numeric vectors, or names of ones in `data`. `x` can also +#' be a formula: +#' - `Pair(x,y) ~ 1` for wide data. +#' - `y ~ condition | id` for long data, possibly with repetitions. +#' @param method Method of repeated measures standardized differences. See +#' details. +#' @param adjust Apply Hedges' small-sample bias correction? See [hedges_g()]. +#' @inheritParams cohens_d +#' +#' @details +#' +#' # Standardized Mean Differences for Repeated Measures +#' +#' Unlike [Cohen's d][cohens_d()] for independent groups, where standardization +#' naturally is done by the (pooled) population standard deviation (cf. Glass’s +#' \eqn{\Delta}), when measured across two conditions are dependent, there are +#' many more options for what error term to standardize by. Additionally, some +#' options allow for data to be replicated (many measurements per condition per +#' individual), others require a single observation per condition per individual +#' (aka, paired data; so replications are aggregated). +#' +#' (It should be noted that all of these have awful and confusing notations.) +#' +#' Standardize by... + +#' - **Difference Score Variance: \eqn{d_{z}}** (_Requires paired data_) - This +#' is akin to computing difference scores for each individual and then +#' computing a one-sample Cohen's _d_ (Cohen, 1988, pp. 48; see examples). +#' - **Within-Subject Variance: \eqn{d_{rm}}** (_Requires paired data_) - Cohen +#' suggested adjusting \eqn{d_{z}} to estimate the "standard" between-subjects +#' _d_ by a factor of \eqn{\sqrt{2(1-r)}}, where _r_ is the Pearson correlation +#' between the paired measures (Cohen, 1988, pp. 48). +#' - **Control Variance: \eqn{d_{b}} (aka Becker's _d_)** (_Requires paired +#' data_) - Standardized by the variance of the control condition (or in a pre- +#' post-treatment setting, the pre-treatment condition). This is akin to Glass' +#' _delta_ ([glass_delta()]) (Becker, 1988). Note that this is taken here as the +#' _second_ condition (`y`). +#' - **Average Variance: \eqn{d_{av}}** (_Requires paired data_) - Instead of +#' standardizing by the variance in the of the control (or pre) condition, +#' Cumming suggests standardizing by the average variance of the two paired +#' conditions (Cumming, 2013, pp. 291). +#' - **All Variance: \eqn{d_{d}}** - This is the same as computing a standard +#' independent-groups Cohen's _d_ (Cohen, 1988). Note that CIs _do_ account for +#' the dependence, and so are typically more narrow (see examples). +#' - **Residual Variance: \eqn{d_{r}}** (_Requires data with replications_) - +#' Divide by the pooled variance after all individual differences have been +#' partialled out (i.e., the residual/level-1 variance in an ANOVA or MLM +#' setting). In between-subjects designs where each subject contributes a single +#' response, this is equivalent to classical Cohen’s d. Priors in the +#' `BayesFactor` package are defined on this scale (Rouder et al., 2012). +#' \cr\cr +#' Note that for paired data, when the two conditions have equal variance, +#' \eqn{d_{rm}}, \eqn{d_{av}}, \eqn{d_{b}} are equal to \eqn{d}. +#' +#' # Confidence (Compatibility) Intervals (CIs) +#' Confidence intervals are estimated using the standard normal parametric +#' method (see Algina & Keselman, 2003; Becker, 1988; Cooper et al., 2009; +#' Hedges & Olkin, 1985; Pustejovsky et al., 2014). +#' +#' @inheritSection effectsize_CIs CIs and Significance Tests +#' @inheritSection print.effectsize_table Plotting with `see` +#' +#' @note +#' `rm_d()` is an alias for `repeated_measures_d()`. +#' +#' @return A data frame with the effect size and their CIs (`CI_low` and +#' `CI_high`). +#' +#' @family standardized differences +#' @seealso [cohens_d()], and `lmeInfo::g_mlm()` and `emmeans::effsize()` for +#' more flexible methods. +#' +#' @references +#' +#' - Algina, J., & Keselman, H. J. (2003). Approximate confidence intervals for +#' effect sizes. Educational and Psychological Measurement, 63(4), 537-553. +#' - Becker, B. J. (1988). Synthesizing standardized mean‐change measures. +#' British Journal of Mathematical and Statistical Psychology, 41(2), 257-278. +#' - Cohen, J. (1988). Statistical power analysis for the behavioral +#' sciences (2nd Ed.). New York: Routledge. +#' - Cooper, H., Hedges, L., & Valentine, J. (2009). Handbook of research +#' synthesis and meta-analysis. Russell Sage Foundation, New York. +#' - Cumming, G. (2013). Understanding the new statistics: Effect sizes, +#' confidence intervals, and meta-analysis. Routledge. +#' - Hedges, L. V. & Olkin, I. (1985). Statistical methods for +#' meta-analysis. Orlando, FL: Academic Press. +#' - Pustejovsky, J. E., Hedges, L. V., & Shadish, W. R. (2014). +#' Design-comparable effect sizes in multiple baseline designs: A general +#' modeling framework. Journal of Educational and Behavioral Statistics, 39(5), +#' 368-393. +#' - Rouder, J. N., Morey, R. D., Speckman, P. L., & Province, J. M. (2012). +#' Default Bayes factors for ANOVA designs. Journal of mathematical psychology, +#' 56(5), 356-374. +#' +#' @examples +#' # Paired data ------- +#' +#' data("sleep") +#' sleep2 <- reshape(sleep, +#' direction = "wide", +#' idvar = "ID", timevar = "group" +#' ) +#' +#' repeated_measures_d(Pair(extra.1, extra.2) ~ 1, data = sleep2) +#' +#' # Same as: +#' # repeated_measures_d(sleep$extra[sleep$group==1], +#' # sleep$extra[sleep$group==2]) +#' # repeated_measures_d(extra ~ group | ID, data = sleep) +#' +#' +#' # More options: +#' repeated_measures_d(Pair(extra.1, extra.2) ~ 1, data = sleep2, mu = -1) +#' repeated_measures_d(Pair(extra.1, extra.2) ~ 1, data = sleep2, alternative = "less") +#' +#' # Other methods +#' repeated_measures_d(Pair(extra.1, extra.2) ~ 1, data = sleep2, method = "av") +#' repeated_measures_d(Pair(extra.1, extra.2) ~ 1, data = sleep2, method = "b") +#' repeated_measures_d(Pair(extra.1, extra.2) ~ 1, data = sleep2, method = "d") +#' repeated_measures_d(Pair(extra.1, extra.2) ~ 1, data = sleep2, method = "z", adjust = FALSE) +#' +#' # d_z is the same as Cohen's d for one sample (of individual difference): +#' cohens_d(extra.1 - extra.2 ~ 1, data = sleep2) +#' +#' +#' +#' # Repetition data ----------- +#' +#' data("rouder2016") +#' +#' # For rm, ad, z, b, data is aggregated +#' repeated_measures_d(rt ~ cond | id, data = rouder2016) +#' +#' # same as: +#' rouder2016_wide <- tapply(rouder2016[["rt"]], rouder2016[1:2], mean) +#' repeated_measures_d(rouder2016_wide[, 1], rouder2016_wide[, 2]) +#' +#' # For r or d, data is not aggragated: +#' repeated_measures_d(rt ~ cond | id, data = rouder2016, method = "r") +#' repeated_measures_d(rt ~ cond | id, data = rouder2016, method = "d", adjust = FALSE) +#' +#' # d is the same as Cohen's d for two independent groups: +#' cohens_d(rt ~ cond, data = rouder2016, ci = NULL) +#' +#' @export +repeated_measures_d <- function(x, y, + data = NULL, + mu = 0, method = c("rm", "av", "z", "b", "d", "r"), + adjust = TRUE, + ci = 0.95, alternative = "two.sided", + verbose = TRUE, ...) { + method <- match.arg(method) + if (.is_htest_of_type(x, "t-test")) { + return(effectsize(x, type = paste0("rm_", method), verbose = verbose, adjust = adjust, ...)) + } + + alternative <- .match.alt(alternative) + data <- .get_data_paired(x, y, data = data, method = method, verbose = verbose, ...) + + if (method %in% c("d", "r")) { + values <- .replication_d(data, mu = mu, method = method) + } else { + values <- .paired_d(data, mu = mu, method = method) + } + + out <- data.frame(d = values[["d"]]) + + if (.test_ci(ci)) { + # TODO use ncp + # Add cis + out$CI <- ci + ci.level <- .adjust_ci(ci, alternative) + + alpha <- 1 - ci.level + probs <- c(alpha / 2, 1 - alpha / 2) + qs <- stats::qnorm(probs) + + confint <- out[["d"]] + qs * values[["se"]] + out$CI_low <- confint[1] + out$CI_high <- confint[2] + + ci_method <- list(method = "normal") + out <- .limit_ci(out, alternative, -Inf, Inf) + } else { + ci_method <- alternative <- NULL + } + + + if (adjust) { + J <- .J(values[["df"]]) + + out[, colnames(out) %in% c("d", "CI_low", "CI_high")] <- + out[, colnames(out) %in% c("d", "CI_low", "CI_high")] * J + + attr(out, "table_footer") <- "Adjusted for small sample bias." + } + + # rename column to method + colnames(out)[1] <- switch(method, + d = "Cohens_d", + b = "Beckers_d", + paste0("d_", method) + ) + + class(out) <- c("effectsize_difference", "effectsize_table", "see_effectsize_table", class(out)) + .someattributes(out) <- .nlist( + mu, ci, ci_method, alternative, + approximate = FALSE + ) + return(out) +} + +#' @rdname repeated_measures_d +#' @export +rm_d <- repeated_measures_d + +#' @keywords internal +.paired_d <- function(data, mu, method) { + x <- data[["x"]] + y <- data[["y"]] + + m <- mean(x - y) + n <- length(x) + df <- n - 1 + r <- stats::cor(x, y) + f <- 2 * (1 - r) + + if (method == "rm") { + s <- stats::sd(x - y) / sqrt(f) + d <- (m - mu) / s + + # Cooper et al., 2009, eq 12.21 + se <- sqrt((1 / n + (d^2) / (2 * n)) * f) + } else if (method == "av") { + s <- sqrt((stats::var(x) + stats::var(y)) / 2) + d <- (m - mu) / s + + # Algina & Keselman, 2003, eq 4 (from Bird 2002?) + se <- sqrt(stats::var(x - y) / n) / s + } else if (method == "z") { + s <- stats::sd(x - y) + d <- (m - mu) / s + + # Hedges and Olkin, 1985, page 86, eq 14 + se <- sqrt((1 / n) + (d^2) / (2 * n)) + } else if (method == "b") { + s <- stats::sd(y) + d <- (m - mu) / s + + # Becker 1988, eq. 6 + se <- sqrt(f / n + (d^2) / (2 * n)) + } + + .nlist(d, se, df) +} + +#' @keywords internal +.replication_d <- function(data, mu, method) { + if (method == "r") { + # for r - need to make sure there are replications! + cell_ns <- tapply(data[[1]], data[3:2], function(v) length(stats::na.omit(v))) + all(cell_ns > 1L) + } + + mod <- suppressWarnings( + stats::aov(y ~ condition + Error(id / condition), + data = data, + contrasts = list(condition = stats::contr.treatment) + ) + ) + m <- -unname(stats::coef(mod[["id:condition"]])) + m_V <- unname(stats::vcov(mod[["id:condition"]])[1]) + + pars <- parameters::model_parameters(mod) + + if (method == "d") { + e <- as.data.frame(pars[pars$Parameter == "Residuals", ]) + } else if (method == "r") { + e <- as.data.frame(pars[pars$Group == "Within", ]) + } + + s <- sqrt(sum(e[["Sum_Squares"]]) / sum(e[["df"]])) + v <- sum(e[["df"]]) + + d <- (m - mu) / s + + # Pustejovsky et al 2014 eq 15 + J <- .J(v) + g <- d * J + k <- sqrt(m_V) / s + se <- sqrt( + (v * k^2) / (v - 2) + g^2 * (v / (v - 2) - 1 / J^2) + ) + + .nlist(d, se, df = v) +} diff --git a/R/sysdata.rda b/R/sysdata.rda index 16b7380ab367f7c7321a36234f42977965c9c6fc..50806d5790d96ab6b2573e8cdf00627330d48495 100644 GIT binary patch literal 1342 zcmV-E1;P44T4*^jL0KkKSRKL7v#002EU2uMJlfiW;9Mn)zh012ZenE=3;03#z4BTQl(00Te(&=~*# z13&<2pa1{>13(S{0iXbA41fRupa3+`00001paV}-RA>R}00Te(007Vc0000001wp; z00E!?XbgY=0iXah&;S4c0iXd=NFWH%6!gk^6A`0B)HOXuXwo#vrY6NR5f3PB45pd@ zGyZ?7RY;XpQ6q|^wH;cuf82)t(A&)rvVm11q%=}XN{QxSX%bH5>m-z@lGP-h2UB*| z_V0-?R1|S#idsHD|7a7vQXht#*GLiJ?X>r6+53FICHQ%5_sXpBbLvP>5#c;N{nl53 zwc9s0AI)X9=ZW;W`gUXY>g2zixt8AhV{wh~CF+BIiRk5}o#%z9!kLzM-&-o?NA$~c z(0;eX($ZGeELgEzV5jmjGThkXXS<0+`o94Yv;tir}kNTGn08S#QY2=p7Cv z%pE6n$g%dRBj;IS`h`_dVvBo?>ytySQf(e`mJOXWs&_L-Z zqX(+Q#VJDN?q{s;Fh&hBYn4<|j>iL_I8nf15>3=kklQnrs)akO6s5?}Toir9jiigC zCIQt^NktTCYQrwh0|wi*X6V*yKUHJ$;;UR-rIeQ_=EA9F^oi^}RVlu7HN1&5wB{Xs zgm8wAvvtNtzHq}quGfm{=PDMneO$O14o+O*_(~Kh_y36Jc zsV_RE* zg)EU!>uz*!7sQ$INVzUjOA1VRFcH9VJSMQBM;;tY;nImLxcI?yavG0qoiS0=M>zG} zm4}i|)}ydxes$^Sv*XC+U~upZOwQAyu{y;RQMtTk9EBIM^^V0CrYN1Awa-NDx&@S2 z7Ad8M3bO>~sphGAk%ES^7`(%gihGAw9!wN2z&i=L1?|a=bcaQeU7pwXX z@`8+zhDiegLI7q4NE3Z2K_m_ygaUZy!ADP--K=s@5}hQ8H5d51k}1N3hJ(%n*r54; Ax&QzG literal 1234 zcmV;@1TFhQT4*^jL0KkKSr35HI{*f|fB*mg|5R}2I6&{~-_XDR|FF;@1^@&A5`fSF zfPhc{KuORA+tdh(0003=jx;oA&}h&!00000G5`PoGzLHchZ-6*Xf$XV0000082|tP z8Ur8z!6vAYMne-vlzN7M4Fl8wG5`#QhK7NlGy_c^svKx&(V)?wXaE2J0Av6F0B8(= z0|KOwfS5qiGEYIGji#A3Jf_oAOqh>I*)T-Y(V?cNspSA{r}I@7LMq4x21+JdDC=v2 z_Ba_BkbyywDw3p`>K2qaSXl`?7pzH2i7iq|={Q?TQ!>a&bYKiHYv7a&@AV{vJnWL) zj$4vMKK}mKhQ1HwYrQu9@~b2q6$u_w?mq9UZISh~ca3visl%6(g16c0<7jDNd`Wts z+ovT)J1p)xqwyW>! zE?laM+U{K^*>#fXdG0aK$f%`JN4c-@7LBvHG3!nRm1@zvloFy`E``84{9m)YVK~TW zq?{P6edo4tyzdJVbC2M+i|O&;PWew8=vO#NN&b=p#U;(B3%I%3V3bihik%gXx{rB* zf>MRfyY)P4(Vk5*s)|wC*yj!eY%mgTB7Fvds*MrCPqwSv80XA)YwOG-qQ6cETt^@j149< z^Uvp+Y;h!d4l>Ccvw4)@F`m)LUYQQIHaL=;qLibQau@e7FjXsXF(uA}Y{7Gc#7N=P zs(A)kx|~VGsFbOk)M7IUH=(tP5sckr;2ea!&g(fa$0yZ4Sl+YAN z;=`7{9FZlL9oZ7+6f_;SWW=MSjuYf|)*gvBS`NYSt~zV^jy2~7!JyLpu6o4k6j4Uz z@sx84I)`S97ov9cu5`}>oLNPZOBBq*1zCb~R9vK9rD97CX~tRejZCJ9Q7|qz`WmBt zCmJwW+|Id5YnZvH*58#Xq!d^&K~#vWQF3852@)8@h0u<#Mnu~^M^{cmuskT%d#x@t z%SUEJqKtXW$vx^n3X{9f4`q7ZUtONhVJ?#+C;Q?2{ePb>%GlXuD}RU0-P0Detu`2Q wHKA>`l>}f56cJWM1tzIu7L7zyt4i8nD~X|QRc13|a7<{sk}1N3fP4m#*!Mg~-~a#s diff --git a/R/utils_ci.R b/R/utils_ci.R index 2e6de1da..20950705 100644 --- a/R/utils_ci.R +++ b/R/utils_ci.R @@ -1,5 +1,7 @@ # NCP ------------------------- +# TODO: other packages like lmeInfo, MOTE and others use qt/qf for these. + #' @keywords internal .get_ncp_F <- function(f, df, df_error, conf.level = 0.9) { if (!is.finite(f) || !is.finite(df) || !is.finite(df_error)) { diff --git a/R/utils_validate_input_data.R b/R/utils_validate_input_data.R index 30c488b0..3002ece0 100644 --- a/R/utils_validate_input_data.R +++ b/R/utils_validate_input_data.R @@ -54,8 +54,8 @@ if (!is.numeric(x)) { insight::format_error("Cannot compute effect size for a non-numeric vector.") } else if (inherits(x, "Pair")) { - x <- x[, 1] - x[, 2] - y <- NULL + y <- x[, 2] + x <- x[, 1] paired <- TRUE } @@ -101,6 +101,87 @@ list(x = x, y = y, paired = paired) } +#' @keywords internal +.get_data_paired <- function(x, y = NULL, data = NULL, method, + verbose = TRUE, ...) { + if (inherits(x, "formula")) { + formula_error <- + "Formula must have one of the following forms: + y ~ condition | id + Pair(x,y) ~ 1" + + # Validate: + if (length(x) != 3L) { + insight::format_error(formula_error) + } else if (length(x[[3]]) == 3L && x[[3]][[1]] == as.name("|")) { + # is long + x[[3L]][[1L]] <- as.name("+") + mf <- .resolve_formula(x, data, ...) + mf <- stats::na.omit(mf) + + if (method %in% c("d", "r")) { + mf[[2]] <- as.factor(mf[[2]]) + mf[[3]] <- as.factor(mf[[3]]) + colnames(mf) <- c("y", "condition", "id") + return(mf) + } + + if (verbose && any(tapply(mf[[1]], mf[3:2], length) > 1L)) { + insight::format_alert( + paste0("The ", method, " standardized difference requires paired data,"), + "but data contains more than one observation per design cell.", + "Aggregating data using `mean()`." + ) + } + + mf <- tapply(mf[[1]], mf[3:2], mean, na.rm = TRUE) + x <- mf[, 1] + y <- mf[, 2] + } else if (x[[2]][[1]] == as.name("Pair")) { + # is Pair (wide) + mf <- .resolve_formula(x, data, ...) + if (ncol(mf) != 1L) { + insight::format_error(formula_error) + } + x <- mf[[1]] + } else { + insight::format_error(formula_error) + } + } else { + # Test if they are they are column names + x <- .resolve_char(x, data) + y <- .resolve_char(y, data) + } + + if (inherits(x, "Pair")) { + y <- x[, 2] + x <- x[, 1] + } + + # x should be a numeric vector or a Pair: + if (!is.numeric(x) || !is.numeric(y)) { + insight::format_error("Cannot compute effect size for a non-numeric vector.") + } + + o <- stats::complete.cases(x, y) + x <- x[o] + y <- y[o] + + if (method == "r") { + insight::format_error("d{r} requires replications.") + } else if (method == "d") { + n <- length(x) + data <- data.frame( + y = c(x, y), + condition = factor(rep(1:2, each = n)), + id = factor(rep(seq(n), times = 2)) + ) + return(data) + } + + list(x = x, y = y) +} + #' @keywords internal .get_data_xtabs <- function(x, y = NULL, p = NULL) { diff --git a/README.Rmd b/README.Rmd index 444bf16b..1e8edc64 100644 --- a/README.Rmd +++ b/README.Rmd @@ -109,7 +109,7 @@ hedges_g(mpg ~ am, data = mtcars) glass_delta(mpg ~ am, data = mtcars) ``` -`effectsize` also provides effect sizes for *rank tests*, *common language effect sizes* and more... +`effectsize` also provides effect sizes for *paired standardized differences*, *rank tests*, *common language effect sizes* and more... ### Contingency Tables diff --git a/WIP/paired_d examples.R b/WIP/paired_d examples.R deleted file mode 100644 index e62a2f1d..00000000 --- a/WIP/paired_d examples.R +++ /dev/null @@ -1,75 +0,0 @@ -library(effectsize) - -source("WIP/paired_d2.R") - -dat <- read.table("http://pcl.missouri.edu/exp/effectSizePuzzler.txt", header = TRUE) - -# From http://jakewestfall.org/blog/index.php/2016/03/25/five-different-cohens-d-statistics-for-within-subject-designs/ -# More types: -# https://doi.org/10.3389/fpsyg.2013.00863 -# https://journals.sagepub.com/doi/pdf/10.1177/0013164403256358 (CIs) - -# Are CIs correct? -# Need to simulate data with a big subject:condition interaction. - -#' Single measurement: -#' d - classic definition -#' r - standardize by the residual sd (sigma) -paired_d(rt ~ cond | id, data = dat, type = "d") # 0.2497971 -paired_d(rt ~ cond | id, data = dat, type = "r") # 0.2587388 - -#' Aggregate: -#' a - aggregate -#' z - standardized scores -#' t - (incorrect) conversion from t statistic (d_z * sqrt(2)) -#' rm - d, but accounts for correlation between repeated measures (not a good name) -#' av - d, but just use average sd (isn't this type a?) -paired_d(rt ~ cond | id, data = dat, type = "a") # 0.8357347 -paired_d(rt ~ cond | id, data = dat, type = "z") # 1.353713 -paired_d(rt ~ cond | id, data = dat, type = "t") # 1.914439 -paired_d(rt ~ cond | id, data = dat, type = "rm") -paired_d(rt ~ cond | id, data = dat, type = "av") - - - -# Test on other data: -data(stroop, package = "afex") -stroop <- subset(stroop, study == "1" & condition == "control") - -cohens_d(rt ~ congruency, data = stroop) -paired_d(rt ~ congruency | pno, data = stroop, type = "d") -paired_d(rt ~ congruency | pno, data = stroop, type = "r") - -paired_d(rt ~ congruency | pno, data = stroop, type = "a") -paired_d(rt ~ congruency | pno, data = stroop, type = "z") -paired_d(rt ~ congruency | pno, data = stroop, type = "t") -paired_d(rt ~ congruency | pno, data = stroop, type = "rm") -paired_d(rt ~ congruency | pno, data = stroop, type = "av") - - -set.seed(1) -dat <- expand.grid( - t = 1:100, - id = letters[1:10], - cond = LETTERS[1:2] -) |> - as.data.frame() |> - dplyr::select(-t) |> - dplyr::mutate( - dplyr::across(.fns = factor), - dplyr::across(.fns = `contrasts<-`, value = contr.sum), - rt = model.matrix(~ id * cond) %*% - c(0, c(scale(seq(0, 1, length = 9))), 0.9, c(scale(seq(0, 1, length = 9)))) + - rnorm(2000, sd = 0.85) - ) - - -cohens_d(rt ~ cond, data = dat) -paired_d(rt ~ cond | id, data = dat, type = "d") -paired_d(rt ~ cond | id, data = dat, type = "r") - -paired_d(rt ~ cond | id, data = dat, type = "a") -paired_d(rt ~ cond | id, data = dat, type = "z") -paired_d(rt ~ cond | id, data = dat, type = "t") -paired_d(rt ~ cond | id, data = dat, type = "rm") -paired_d(rt ~ cond | id, data = dat, type = "av") diff --git a/WIP/paired_d2.R b/WIP/paired_d2.R deleted file mode 100644 index 11ae9ff1..00000000 --- a/WIP/paired_d2.R +++ /dev/null @@ -1,202 +0,0 @@ -paired_d <- function(x, group, block, data = NULL, - mu = 0, ci = 0.95, alternative = "two.sided", - type = c("d", "a", "r", "z", "t", "av", "rm")) { - type <- match.arg(type) - alternative <- .match.alt(alternative) - - data <- effectsize:::.kendalls_w_data(x, group, block, data, wide = FALSE) - if (!is.factor(data$groups)) data$groups <- factor(data$groups) - if (!is.factor(data$blocks)) data$blocks <- factor(data$blocks) - contrasts(data$groups) <- contr.treatment - contrasts(data$blocks) <- contr.treatment - - stopifnot(nlevels(data$groups) == 2L) - - - if (type %in% c("a", "z", "t", "av", "rm")) { - data <- aggregate(data$x, data[-1], mean) - xtab <- table(data[-3]) - data <- data[data$blocks %in% colnames(xtab)[colSums(xtab) %in% 2], ] - } - - if (type %in% c("z", "t")) { - out <- .paired_d_z_t(data, type, mu = mu, ci = ci, alternative = alternative) - } else if (type %in% c("av", "rm")) { - out <- .paired_d_av_rm(data, type, mu = mu, ci = ci, alternative = alternative) - } else if (type %in% c("d", "a", "r")) { - out <- .paired_d_d_a_r(data, type, mu = mu, ci = ci, alternative = alternative) - } - - attr(out, "paired_type") <- type - out -} - -.paired_d_z_t <- function(data, type, - mu = 0, ci = 0.95, alternative = "two.sided") { - data <- data[order(data$groups), ] - data <- aggregate(data$x, data[2], diff) - - out <- cohens_d(-data$x, mu = mu, ci = ci, alternative = alternative) - colnames(out)[1] <- "d_z" - - if (type == "t") { - colnames(out)[1] <- "d_t" - out[colnames(out) %in% c("d_t", "CI_low", "CI_high")] <- - sqrt(2) * out[colnames(out) %in% c("d_t", "CI_low", "CI_high")] - } - - out -} - -.paired_d_d_a_r <- function(data, type, - mu = 0, ci = 0.95, alternative = "two.sided") { - # Use ANOVA decomp - mod <- stats::aov(x ~ groups + Error(blocks / groups), data = data) - pars <- as.data.frame(parameters::model_parameters(mod)) - - # Look in: - # d/r = groups - # a = blocks:groups - is_d <- - pars$Paramete == "groups" & - pars$df == 1 & - pars$Group == "blocks:groups" - - d <- -unname(coef(mod[["blocks:groups"]])) - - if (type %in% c("d", "a")) { - ss <- sum(pars[!is_d, "Sum_Squares"]) - df <- sum(pars[!is_d, "df"]) - s <- sqrt(ss / df) - } else if (type == "r") { - is_r <- pars$Group == "Within" & pars$Parameter == "Residuals" - ss <- pars[is_r, "Sum_Squares"] - df <- pars[is_r, "df"] - s <- sqrt(ss / df) - } - - out <- data.frame(d = (d - mu) / s) - if (type != "d") names(out) <- paste0("d_", type) - - if (.test_ci(ci)) { - out$CI <- ci - ci.level <- .adjust_ci(ci, alternative) - - is_mse <- - pars$Paramete == "Residuals" & - pars$Group == "blocks:groups" - - # Delta method to get se - beta <- c(d - mu, s) - V <- matrix(c( - vcov(mod[["blocks:groups"]]), 0, - 0, 2 / df - ), nrow = 2) - se <- .deltamethod(~ x1 / x2, beta, V, ses = TRUE) - - # Critical value - tc <- pt(0.5 + ci.level / 2, df = pars[is_mse, "df"]) - - out$CI_low <- out[[1]] - tc * se - out$CI_high <- out[[1]] + tc * se - - ci_method <- list(method = "delta") - out <- .limit_ci(out, alternative, -Inf, Inf) - } else { - ci_method <- alternative <- NULL - } - - class(out) <- c("effectsize_difference", "effectsize_table", "see_effectsize_table", class(out)) - attr(out, "mu") <- mu - attr(out, "ci") <- ci - attr(out, "ci_method") <- ci_method - attr(out, "approximate") <- FALSE - attr(out, "alternative") <- alternative - return(out) -} - -.paired_d_av_rm <- function(data, type, - mu = 0, ci = 0.95, alternative = "two.sided") { - data <- data[order(data[[1]], data[[2]]), ] - - d <- -diff(tapply(data$x, data$groups, mean)) - ss <- tapply(data$x, data$groups, sd) - - r <- cor( - data$x[data$groups == data$groups[1]], - data$x[data$groups != data$groups[1]] - ) - co <- cov( - data$x[data$groups == data$groups[1]], - data$x[data$groups != data$groups[1]] - ) - n <- nrow(data) / 2 - - Sdiff <- sqrt(sum(ss^2) - 2 * co) - - if (type == "av") { - out <- data.frame(d_av = (d - mu) / mean(ss)) - } else if (type == "rm") { - out <- data.frame(d_rm = sqrt(2 * (1 - r)) * (d - mu) / Sdiff) - } - - - if (.test_ci(ci)) { - out$CI <- ci - ci.level <- .adjust_ci(ci, alternative) - - tc <- qt(0.5 + ci.level / 2, df = n - 1, lower.tail = TRUE) - se <- sqrt((2 * Sdiff^2) / (n * sum(ss))) - - out$CI_low <- out[[1]] - tc * se - out$CI_high <- out[[1]] + tc * se - ci_method <- list(method = "normal") - out <- .limit_ci(out, alternative, -Inf, Inf) - } else { - ci_method <- alternative <- NULL - } - - class(out) <- c("effectsize_difference", "effectsize_table", "see_effectsize_table", class(out)) - attr(out, "mu") <- mu - attr(out, "ci") <- ci - attr(out, "ci_method") <- ci_method - attr(out, "approximate") <- FALSE - attr(out, "alternative") <- alternative - return(out) -} - -# .sample_within <- function(.data) { -# .data |> -# tidyr::nest(data = -id) |> -# dplyr::slice_sample(prop = 1, replace = TRUE) |> -# dplyr::mutate(id = seq_along(id)) |> -# tidyr::unnest(cols = data) -# } - - -#' @keywords internal -.deltamethod <- function(g, mean, cov, ses = TRUE) { - cov <- as.matrix(cov) - n <- length(mean) - if (!is.list(g)) { - g <- list(g) - } - if ((dim(cov)[1] != n) || (dim(cov)[2] != n)) { - insight::format_error( - "Covariances should be a ", n, " by ", n, - " matrix." - ) - } - syms <- paste("x", 1:n, sep = "") - for (i in 1:n) assign(syms[i], mean[i]) - gdashmu <- t(sapply(g, function(form) { - as.numeric(attr(eval(stats::deriv(form, syms)), "gradient")) - })) - new.covar <- gdashmu %*% cov %*% t(gdashmu) - if (ses) { - new.se <- sqrt(diag(new.covar)) - new.se - } else { - new.covar - } -} diff --git a/_pkgdown.yml b/_pkgdown.yml index 9c371bc0..4defa812 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -14,6 +14,7 @@ reference: Effect sizes for comparing two groups contents: - cohens_d + - repeated_measures_d - mahalanobis_d - rank_biserial - p_superiority @@ -88,6 +89,7 @@ reference: - subtitle: "Datasets" contents: - hardlyworking + - rouder2016 - screening_test - RCT_table - Music_preferences diff --git a/data-raw/df data.R b/data-raw/df data.R index da5839e3..56bb5411 100644 --- a/data-raw/df data.R +++ b/data-raw/df data.R @@ -246,4 +246,16 @@ hardlyworking <- data.frame( hardlyworking$is_senior <- hardlyworking$seniority > 4 save(hardlyworking, file = "data/hardlyworking.rdata") + + +# rouder2016 -------------------------------------------------------------- + +rouder2016 <- read.table("data-raw/effectSizePuzzler.txt", + header = TRUE, stringsAsFactors = FALSE +) +rouder2016[["id"]] <- factor(rouder2016[["id"]]) +rouder2016[["cond"]] <- factor(rouder2016[["cond"]]) + +save(rouder2016, file = "data/rouder2016.rdata") + # styler: on diff --git a/data-raw/effectSizePuzzler.txt b/data-raw/effectSizePuzzler.txt new file mode 100644 index 00000000..e21eaedf --- /dev/null +++ b/data-raw/effectSizePuzzler.txt @@ -0,0 +1,2501 @@ +id cond rt +1 1 0.56 +1 1 0.93 +1 1 0.795 +1 1 0.615 +1 1 1.028 +1 1 0.845 +1 1 0.723 +1 1 0.942 +1 1 0.938 +1 1 0.926 +1 1 0.897 +1 1 0.87 +1 1 0.759 +1 1 0.722 +1 1 0.711 +1 1 0.668 +1 1 0.737 +1 1 0.602 +1 1 1.303 +1 1 1.017 +1 1 0.617 +1 1 0.708 +1 1 0.699 +1 1 0.917 +1 1 0.756 +1 1 0.813 +1 1 0.765 +1 1 0.763 +1 1 1.058 +1 1 0.734 +1 1 1.098 +1 1 0.573 +1 1 0.876 +1 1 0.79 +1 1 0.806 +1 1 0.836 +1 1 0.694 +1 1 0.718 +1 1 0.629 +1 1 0.623 +1 1 0.822 +1 1 0.849 +1 1 0.778 +1 1 0.948 +1 1 1.262 +1 1 0.695 +1 1 0.509 +1 1 0.968 +1 1 0.666 +1 1 0.669 +1 2 1.043 +1 2 0.77 +1 2 0.638 +1 2 0.853 +1 2 0.794 +1 2 0.82 +1 2 0.894 +1 2 0.756 +1 2 0.95 +1 2 0.78 +1 2 0.883 +1 2 1.062 +1 2 0.904 +1 2 0.763 +1 2 1.076 +1 2 1.035 +1 2 0.929 +1 2 0.864 +1 2 0.717 +1 2 1.135 +1 2 0.721 +1 2 1.416 +1 2 1.187 +1 2 0.778 +1 2 0.662 +1 2 0.705 +1 2 0.868 +1 2 0.776 +1 2 0.759 +1 2 0.672 +1 2 0.811 +1 2 0.694 +1 2 0.589 +1 2 0.754 +1 2 1.016 +1 2 0.724 +1 2 0.942 +1 2 0.595 +1 2 0.809 +1 2 0.922 +1 2 0.877 +1 2 0.838 +1 2 0.715 +1 2 0.685 +1 2 0.663 +1 2 0.841 +1 2 0.672 +1 2 0.737 +1 2 0.774 +1 2 1.289 +2 1 0.686 +2 1 0.827 +2 1 0.799 +2 1 0.647 +2 1 0.773 +2 1 1.105 +2 1 0.868 +2 1 0.792 +2 1 0.719 +2 1 0.537 +2 1 1.021 +2 1 0.591 +2 1 0.929 +2 1 1.247 +2 1 0.593 +2 1 0.92 +2 1 0.743 +2 1 0.58 +2 1 0.586 +2 1 0.577 +2 1 0.703 +2 1 0.591 +2 1 0.917 +2 1 1.312 +2 1 0.609 +2 1 0.939 +2 1 0.935 +2 1 0.845 +2 1 0.641 +2 1 0.765 +2 1 0.74 +2 1 0.891 +2 1 0.726 +2 1 0.983 +2 1 0.726 +2 1 1.001 +2 1 0.636 +2 1 0.612 +2 1 1.809 +2 1 0.719 +2 1 0.839 +2 1 0.906 +2 1 0.71 +2 1 0.882 +2 1 0.852 +2 1 0.75 +2 1 0.797 +2 1 0.78 +2 1 1.322 +2 1 0.674 +2 2 0.665 +2 2 0.843 +2 2 0.898 +2 2 0.925 +2 2 0.757 +2 2 0.67 +2 2 1.135 +2 2 0.775 +2 2 0.696 +2 2 0.794 +2 2 0.801 +2 2 1.091 +2 2 0.852 +2 2 0.998 +2 2 0.75 +2 2 0.878 +2 2 0.779 +2 2 0.854 +2 2 0.692 +2 2 0.639 +2 2 1.379 +2 2 0.962 +2 2 0.646 +2 2 0.733 +2 2 0.654 +2 2 1.458 +2 2 1.149 +2 2 0.789 +2 2 0.949 +2 2 0.764 +2 2 0.754 +2 2 0.707 +2 2 0.736 +2 2 1.256 +2 2 0.826 +2 2 0.859 +2 2 0.884 +2 2 1.126 +2 2 0.748 +2 2 0.679 +2 2 1.264 +2 2 0.76 +2 2 0.716 +2 2 0.648 +2 2 0.642 +2 2 0.739 +2 2 0.966 +2 2 1.091 +2 2 0.987 +2 2 0.772 +3 1 0.893 +3 1 0.754 +3 1 0.752 +3 1 1.091 +3 1 0.707 +3 1 1.451 +3 1 0.862 +3 1 0.926 +3 1 0.748 +3 1 0.775 +3 1 0.666 +3 1 0.844 +3 1 0.972 +3 1 0.95 +3 1 0.741 +3 1 0.74 +3 1 0.787 +3 1 1.28 +3 1 0.69 +3 1 0.845 +3 1 1.429 +3 1 0.86 +3 1 0.661 +3 1 0.76 +3 1 0.988 +3 1 0.809 +3 1 0.777 +3 1 0.815 +3 1 0.899 +3 1 1.315 +3 1 0.863 +3 1 1.147 +3 1 1.024 +3 1 0.858 +3 1 0.639 +3 1 0.784 +3 1 0.789 +3 1 0.89 +3 1 1.215 +3 1 1.595 +3 1 1.298 +3 1 0.854 +3 1 0.614 +3 1 0.807 +3 1 0.899 +3 1 1.08 +3 1 1.113 +3 1 1.037 +3 1 0.656 +3 1 1.081 +3 2 0.849 +3 2 0.982 +3 2 0.958 +3 2 1.045 +3 2 0.947 +3 2 0.658 +3 2 1.13 +3 2 1.034 +3 2 0.884 +3 2 0.968 +3 2 0.972 +3 2 0.993 +3 2 1.439 +3 2 0.894 +3 2 0.98 +3 2 1.265 +3 2 1.228 +3 2 1.258 +3 2 0.824 +3 2 1.593 +3 2 0.957 +3 2 1.533 +3 2 0.7 +3 2 0.946 +3 2 1.293 +3 2 0.799 +3 2 0.793 +3 2 0.762 +3 2 0.744 +3 2 0.85 +3 2 1.02 +3 2 0.617 +3 2 0.991 +3 2 1.289 +3 2 1.609 +3 2 1.311 +3 2 1.136 +3 2 0.65 +3 2 0.82 +3 2 0.867 +3 2 1.12 +3 2 0.918 +3 2 0.713 +3 2 1.457 +3 2 1.182 +3 2 0.997 +3 2 1.282 +3 2 0.701 +3 2 1.108 +3 2 0.834 +4 1 0.935 +4 1 0.79 +4 1 0.924 +4 1 1.098 +4 1 0.801 +4 1 1.014 +4 1 0.63 +4 1 0.688 +4 1 1.151 +4 1 0.871 +4 1 0.544 +4 1 0.61 +4 1 0.766 +4 1 0.977 +4 1 0.783 +4 1 0.922 +4 1 1 +4 1 1.198 +4 1 0.81 +4 1 0.791 +4 1 0.571 +4 1 0.818 +4 1 0.709 +4 1 0.656 +4 1 0.77 +4 1 1.013 +4 1 0.549 +4 1 0.731 +4 1 0.821 +4 1 0.666 +4 1 0.862 +4 1 0.878 +4 1 0.794 +4 1 0.511 +4 1 1.53 +4 1 0.765 +4 1 0.928 +4 1 0.85 +4 1 1.016 +4 1 0.966 +4 1 0.765 +4 1 0.871 +4 1 0.659 +4 1 0.975 +4 1 0.726 +4 1 1.465 +4 1 0.581 +4 1 0.725 +4 1 0.968 +4 1 0.898 +4 2 0.75 +4 2 0.69 +4 2 0.881 +4 2 0.85 +4 2 0.595 +4 2 0.859 +4 2 0.891 +4 2 0.888 +4 2 0.682 +4 2 0.953 +4 2 1.195 +4 2 0.948 +4 2 0.671 +4 2 0.775 +4 2 0.924 +4 2 0.741 +4 2 0.56 +4 2 1.053 +4 2 0.713 +4 2 0.752 +4 2 1.236 +4 2 0.722 +4 2 1.043 +4 2 0.656 +4 2 0.788 +4 2 0.839 +4 2 0.667 +4 2 0.743 +4 2 0.847 +4 2 0.999 +4 2 0.61 +4 2 0.789 +4 2 1.02 +4 2 0.758 +4 2 0.898 +4 2 0.957 +4 2 0.907 +4 2 0.995 +4 2 0.829 +4 2 0.778 +4 2 0.519 +4 2 0.835 +4 2 0.943 +4 2 0.967 +4 2 0.755 +4 2 1.33 +4 2 0.911 +4 2 0.878 +4 2 1.163 +4 2 0.73 +5 1 0.73 +5 1 1.464 +5 1 0.805 +5 1 1.191 +5 1 0.604 +5 1 0.771 +5 1 0.874 +5 1 0.859 +5 1 0.654 +5 1 0.806 +5 1 0.645 +5 1 0.946 +5 1 1.035 +5 1 0.531 +5 1 1.075 +5 1 0.626 +5 1 0.89 +5 1 0.934 +5 1 0.769 +5 1 0.701 +5 1 0.833 +5 1 0.887 +5 1 0.985 +5 1 0.545 +5 1 0.584 +5 1 1.13 +5 1 1.026 +5 1 0.886 +5 1 0.946 +5 1 0.993 +5 1 0.498 +5 1 1.042 +5 1 0.725 +5 1 0.845 +5 1 0.754 +5 1 0.983 +5 1 0.745 +5 1 0.903 +5 1 0.739 +5 1 0.643 +5 1 1.068 +5 1 0.952 +5 1 1.22 +5 1 0.815 +5 1 1.046 +5 1 1.304 +5 1 0.756 +5 1 0.617 +5 1 0.763 +5 1 0.767 +5 2 0.886 +5 2 1.312 +5 2 0.796 +5 2 0.933 +5 2 0.813 +5 2 0.86 +5 2 0.921 +5 2 1.185 +5 2 0.88 +5 2 1.013 +5 2 1.03 +5 2 1.066 +5 2 0.755 +5 2 1.282 +5 2 0.787 +5 2 0.836 +5 2 1.209 +5 2 1.174 +5 2 0.68 +5 2 0.71 +5 2 0.646 +5 2 0.892 +5 2 0.889 +5 2 0.932 +5 2 0.974 +5 2 0.75 +5 2 0.693 +5 2 1.096 +5 2 1.023 +5 2 0.628 +5 2 0.838 +5 2 0.706 +5 2 0.569 +5 2 0.886 +5 2 0.841 +5 2 0.837 +5 2 0.9 +5 2 1.057 +5 2 0.897 +5 2 0.748 +5 2 0.73 +5 2 0.831 +5 2 0.92 +5 2 0.686 +5 2 0.821 +5 2 1.08 +5 2 0.835 +5 2 0.735 +5 2 0.805 +5 2 1.121 +6 1 1.015 +6 1 1.209 +6 1 0.919 +6 1 0.981 +6 1 0.785 +6 1 1.029 +6 1 0.794 +6 1 0.659 +6 1 0.917 +6 1 1.465 +6 1 1.08 +6 1 1.186 +6 1 0.968 +6 1 0.776 +6 1 0.849 +6 1 0.836 +6 1 0.8 +6 1 1.054 +6 1 0.688 +6 1 1.098 +6 1 1.098 +6 1 0.688 +6 1 1.037 +6 1 1.68 +6 1 0.785 +6 1 1.092 +6 1 0.748 +6 1 1.17 +6 1 0.943 +6 1 1.351 +6 1 0.654 +6 1 0.879 +6 1 0.79 +6 1 0.85 +6 1 0.773 +6 1 0.74 +6 1 1.022 +6 1 0.703 +6 1 1.291 +6 1 0.689 +6 1 0.911 +6 1 1.01 +6 1 1.024 +6 1 0.83 +6 1 0.906 +6 1 1.125 +6 1 0.654 +6 1 0.748 +6 1 0.959 +6 1 0.805 +6 2 1.352 +6 2 1.125 +6 2 0.968 +6 2 0.684 +6 2 0.957 +6 2 0.883 +6 2 0.929 +6 2 0.731 +6 2 1.076 +6 2 0.753 +6 2 0.902 +6 2 1.045 +6 2 0.795 +6 2 1.099 +6 2 0.711 +6 2 0.544 +6 2 1.067 +6 2 1.174 +6 2 0.889 +6 2 1.077 +6 2 0.735 +6 2 0.923 +6 2 0.63 +6 2 1.285 +6 2 1.549 +6 2 1.249 +6 2 0.945 +6 2 0.944 +6 2 0.683 +6 2 1.159 +6 2 0.905 +6 2 0.818 +6 2 0.697 +6 2 0.887 +6 2 0.784 +6 2 0.867 +6 2 0.725 +6 2 1.476 +6 2 0.948 +6 2 1.249 +6 2 0.562 +6 2 0.856 +6 2 0.814 +6 2 0.725 +6 2 1.419 +6 2 0.697 +6 2 1.028 +6 2 1.176 +6 2 0.993 +6 2 0.78 +7 1 1.023 +7 1 0.852 +7 1 0.658 +7 1 0.62 +7 1 1.379 +7 1 0.71 +7 1 0.572 +7 1 0.927 +7 1 0.88 +7 1 0.624 +7 1 0.563 +7 1 0.799 +7 1 1.075 +7 1 0.95 +7 1 0.738 +7 1 0.688 +7 1 0.872 +7 1 0.849 +7 1 0.948 +7 1 0.753 +7 1 1.012 +7 1 0.689 +7 1 0.763 +7 1 0.974 +7 1 1.035 +7 1 0.564 +7 1 0.84 +7 1 0.943 +7 1 0.613 +7 1 0.915 +7 1 0.689 +7 1 1.043 +7 1 0.928 +7 1 0.981 +7 1 0.842 +7 1 1.004 +7 1 1.143 +7 1 1.335 +7 1 0.815 +7 1 0.537 +7 1 0.826 +7 1 0.859 +7 1 0.792 +7 1 0.934 +7 1 1.041 +7 1 0.734 +7 1 0.769 +7 1 0.898 +7 1 0.729 +7 1 0.837 +7 2 0.589 +7 2 0.688 +7 2 0.661 +7 2 0.726 +7 2 0.751 +7 2 0.957 +7 2 1.11 +7 2 0.746 +7 2 0.705 +7 2 0.699 +7 2 0.797 +7 2 0.829 +7 2 0.981 +7 2 0.814 +7 2 0.578 +7 2 0.857 +7 2 1.171 +7 2 1.172 +7 2 0.736 +7 2 0.634 +7 2 1.659 +7 2 0.843 +7 2 0.855 +7 2 0.966 +7 2 0.627 +7 2 0.745 +7 2 0.635 +7 2 0.751 +7 2 0.899 +7 2 0.656 +7 2 1.007 +7 2 0.936 +7 2 0.719 +7 2 0.922 +7 2 1.047 +7 2 1.133 +7 2 0.833 +7 2 0.856 +7 2 0.858 +7 2 1.252 +7 2 1.152 +7 2 1.07 +7 2 0.82 +7 2 0.955 +7 2 0.962 +7 2 0.699 +7 2 0.614 +7 2 1.019 +7 2 0.636 +7 2 0.875 +8 1 0.778 +8 1 0.833 +8 1 0.768 +8 1 0.639 +8 1 0.918 +8 1 1.104 +8 1 0.896 +8 1 0.522 +8 1 1.014 +8 1 0.729 +8 1 0.826 +8 1 0.844 +8 1 0.723 +8 1 0.726 +8 1 0.925 +8 1 0.861 +8 1 0.919 +8 1 1.308 +8 1 0.852 +8 1 0.771 +8 1 0.502 +8 1 1.423 +8 1 0.67 +8 1 1.305 +8 1 0.799 +8 1 1.05 +8 1 0.721 +8 1 0.823 +8 1 0.772 +8 1 0.71 +8 1 0.72 +8 1 0.924 +8 1 0.708 +8 1 0.514 +8 1 0.709 +8 1 0.829 +8 1 0.843 +8 1 0.843 +8 1 0.542 +8 1 0.798 +8 1 0.914 +8 1 0.984 +8 1 0.704 +8 1 0.691 +8 1 1.037 +8 1 0.544 +8 1 0.676 +8 1 0.814 +8 1 0.548 +8 1 0.783 +8 2 1.233 +8 2 0.783 +8 2 0.739 +8 2 0.871 +8 2 0.739 +8 2 0.943 +8 2 0.964 +8 2 0.784 +8 2 0.62 +8 2 0.605 +8 2 0.693 +8 2 0.939 +8 2 0.544 +8 2 0.55 +8 2 0.685 +8 2 0.855 +8 2 0.651 +8 2 0.96 +8 2 0.843 +8 2 0.756 +8 2 0.944 +8 2 0.854 +8 2 0.714 +8 2 0.824 +8 2 0.907 +8 2 0.848 +8 2 0.684 +8 2 0.952 +8 2 1.024 +8 2 0.833 +8 2 0.809 +8 2 0.771 +8 2 1.33 +8 2 0.833 +8 2 0.758 +8 2 0.501 +8 2 0.58 +8 2 0.771 +8 2 0.82 +8 2 0.833 +8 2 0.945 +8 2 0.752 +8 2 1.04 +8 2 0.65 +8 2 0.617 +8 2 0.615 +8 2 0.927 +8 2 0.77 +8 2 0.938 +8 2 0.74 +9 1 0.677 +9 1 0.708 +9 1 0.542 +9 1 0.608 +9 1 0.58 +9 1 0.971 +9 1 0.676 +9 1 0.911 +9 1 1.088 +9 1 0.734 +9 1 0.812 +9 1 0.551 +9 1 0.648 +9 1 0.773 +9 1 0.815 +9 1 0.655 +9 1 1.487 +9 1 0.695 +9 1 0.774 +9 1 0.882 +9 1 0.759 +9 1 0.67 +9 1 0.968 +9 1 1.116 +9 1 0.759 +9 1 0.864 +9 1 0.748 +9 1 0.962 +9 1 0.609 +9 1 1.345 +9 1 0.675 +9 1 0.578 +9 1 0.71 +9 1 0.788 +9 1 1.118 +9 1 0.938 +9 1 0.787 +9 1 0.585 +9 1 0.642 +9 1 0.738 +9 1 1.433 +9 1 0.542 +9 1 0.989 +9 1 0.685 +9 1 1.131 +9 1 0.611 +9 1 0.788 +9 1 0.616 +9 1 0.936 +9 1 1.079 +9 2 1.314 +9 2 0.977 +9 2 1.277 +9 2 1.093 +9 2 0.789 +9 2 0.905 +9 2 0.665 +9 2 0.78 +9 2 1.086 +9 2 0.919 +9 2 0.901 +9 2 0.656 +9 2 0.715 +9 2 0.692 +9 2 0.888 +9 2 0.662 +9 2 0.924 +9 2 0.647 +9 2 1.272 +9 2 0.902 +9 2 0.701 +9 2 0.857 +9 2 0.753 +9 2 0.883 +9 2 0.858 +9 2 0.659 +9 2 0.688 +9 2 0.869 +9 2 1.209 +9 2 1.049 +9 2 0.712 +9 2 0.984 +9 2 0.804 +9 2 0.869 +9 2 0.861 +9 2 1.562 +9 2 0.638 +9 2 0.831 +9 2 0.575 +9 2 0.93 +9 2 1.052 +9 2 1.15 +9 2 0.561 +9 2 0.892 +9 2 1.195 +9 2 0.743 +9 2 0.776 +9 2 0.806 +9 2 0.882 +9 2 0.947 +10 1 1.053 +10 1 0.759 +10 1 0.809 +10 1 1.435 +10 1 0.852 +10 1 0.807 +10 1 0.597 +10 1 0.775 +10 1 0.74 +10 1 0.773 +10 1 0.688 +10 1 0.673 +10 1 0.669 +10 1 0.741 +10 1 1.067 +10 1 0.986 +10 1 0.719 +10 1 0.563 +10 1 0.653 +10 1 0.705 +10 1 0.792 +10 1 0.677 +10 1 1.259 +10 1 0.732 +10 1 0.611 +10 1 0.752 +10 1 0.634 +10 1 0.802 +10 1 0.815 +10 1 0.838 +10 1 0.569 +10 1 0.813 +10 1 0.829 +10 1 0.589 +10 1 0.964 +10 1 0.925 +10 1 1.362 +10 1 0.802 +10 1 0.783 +10 1 0.791 +10 1 0.787 +10 1 0.549 +10 1 0.565 +10 1 0.762 +10 1 0.688 +10 1 0.784 +10 1 0.527 +10 1 0.581 +10 1 0.623 +10 1 0.971 +10 2 0.657 +10 2 0.697 +10 2 0.84 +10 2 0.769 +10 2 0.852 +10 2 1.476 +10 2 0.654 +10 2 0.772 +10 2 0.738 +10 2 1.191 +10 2 0.701 +10 2 0.81 +10 2 0.991 +10 2 0.662 +10 2 1.237 +10 2 0.965 +10 2 0.66 +10 2 0.915 +10 2 0.787 +10 2 0.886 +10 2 0.809 +10 2 1.063 +10 2 0.627 +10 2 0.737 +10 2 0.781 +10 2 0.67 +10 2 0.665 +10 2 0.822 +10 2 0.801 +10 2 0.515 +10 2 1.056 +10 2 0.873 +10 2 1.523 +10 2 0.967 +10 2 0.749 +10 2 1.697 +10 2 1.714 +10 2 0.643 +10 2 0.919 +10 2 0.787 +10 2 0.86 +10 2 0.868 +10 2 0.637 +10 2 0.88 +10 2 1.268 +10 2 0.796 +10 2 0.796 +10 2 1.156 +10 2 1.019 +10 2 0.595 +11 1 0.908 +11 1 1.301 +11 1 1.221 +11 1 0.95 +11 1 1.022 +11 1 0.669 +11 1 0.923 +11 1 0.702 +11 1 0.778 +11 1 1.079 +11 1 0.677 +11 1 0.916 +11 1 0.952 +11 1 0.872 +11 1 1.362 +11 1 0.692 +11 1 0.994 +11 1 0.844 +11 1 0.812 +11 1 0.96 +11 1 0.693 +11 1 0.654 +11 1 0.772 +11 1 1.336 +11 1 0.872 +11 1 0.93 +11 1 0.825 +11 1 0.962 +11 1 0.702 +11 1 1.142 +11 1 0.989 +11 1 0.723 +11 1 0.872 +11 1 1.021 +11 1 0.982 +11 1 1.243 +11 1 0.753 +11 1 1.129 +11 1 1.107 +11 1 0.83 +11 1 0.699 +11 1 0.683 +11 1 0.959 +11 1 0.847 +11 1 1.346 +11 1 0.977 +11 1 0.793 +11 1 0.692 +11 1 0.758 +11 1 0.933 +11 2 0.83 +11 2 1.043 +11 2 0.852 +11 2 0.898 +11 2 0.78 +11 2 1.508 +11 2 0.997 +11 2 0.972 +11 2 0.643 +11 2 1.081 +11 2 0.734 +11 2 0.754 +11 2 1.155 +11 2 0.829 +11 2 0.636 +11 2 1.452 +11 2 0.57 +11 2 1.058 +11 2 1.186 +11 2 0.797 +11 2 1.025 +11 2 1.023 +11 2 1.193 +11 2 1.035 +11 2 0.869 +11 2 1.155 +11 2 1.121 +11 2 0.747 +11 2 0.68 +11 2 0.956 +11 2 0.864 +11 2 0.739 +11 2 0.939 +11 2 0.691 +11 2 0.956 +11 2 0.798 +11 2 1.167 +11 2 1.749 +11 2 0.75 +11 2 1.198 +11 2 1.128 +11 2 0.905 +11 2 0.829 +11 2 1.377 +11 2 0.607 +11 2 0.795 +11 2 0.675 +11 2 1.311 +11 2 0.88 +11 2 0.816 +12 1 1.869 +12 1 0.806 +12 1 0.741 +12 1 0.872 +12 1 0.597 +12 1 0.911 +12 1 0.798 +12 1 0.907 +12 1 0.665 +12 1 0.66 +12 1 0.704 +12 1 0.693 +12 1 1.111 +12 1 1.195 +12 1 0.787 +12 1 0.754 +12 1 0.759 +12 1 0.827 +12 1 0.833 +12 1 0.87 +12 1 0.696 +12 1 0.683 +12 1 1.083 +12 1 0.725 +12 1 0.872 +12 1 0.805 +12 1 0.668 +12 1 0.933 +12 1 0.847 +12 1 1.14 +12 1 0.836 +12 1 0.758 +12 1 0.867 +12 1 0.64 +12 1 0.684 +12 1 0.915 +12 1 0.758 +12 1 0.803 +12 1 0.794 +12 1 0.71 +12 1 0.554 +12 1 0.882 +12 1 0.972 +12 1 0.628 +12 1 1.165 +12 1 0.889 +12 1 1.123 +12 1 0.668 +12 1 0.846 +12 1 0.797 +12 2 1.045 +12 2 0.765 +12 2 0.867 +12 2 0.605 +12 2 0.733 +12 2 0.894 +12 2 0.744 +12 2 0.86 +12 2 0.783 +12 2 1.004 +12 2 1.156 +12 2 0.727 +12 2 0.811 +12 2 1.242 +12 2 0.564 +12 2 0.809 +12 2 1.472 +12 2 1.526 +12 2 0.901 +12 2 0.721 +12 2 0.903 +12 2 0.753 +12 2 1.246 +12 2 0.729 +12 2 0.948 +12 2 1.007 +12 2 0.736 +12 2 1.066 +12 2 0.738 +12 2 1.009 +12 2 1.135 +12 2 0.703 +12 2 1.138 +12 2 0.779 +12 2 0.931 +12 2 0.911 +12 2 0.79 +12 2 0.925 +12 2 0.67 +12 2 0.842 +12 2 1.06 +12 2 0.566 +12 2 0.638 +12 2 0.679 +12 2 0.626 +12 2 0.959 +12 2 0.702 +12 2 0.567 +12 2 0.755 +12 2 0.796 +13 1 0.998 +13 1 0.651 +13 1 1.076 +13 1 0.894 +13 1 0.887 +13 1 0.684 +13 1 1.324 +13 1 0.788 +13 1 0.573 +13 1 0.781 +13 1 0.563 +13 1 0.764 +13 1 0.746 +13 1 0.956 +13 1 1.036 +13 1 0.701 +13 1 0.985 +13 1 1.151 +13 1 0.693 +13 1 0.711 +13 1 0.949 +13 1 0.851 +13 1 0.926 +13 1 1.145 +13 1 0.892 +13 1 1.047 +13 1 0.943 +13 1 0.902 +13 1 0.892 +13 1 1.112 +13 1 0.664 +13 1 0.651 +13 1 0.936 +13 1 0.796 +13 1 0.83 +13 1 0.97 +13 1 0.973 +13 1 0.771 +13 1 0.763 +13 1 0.83 +13 1 1.05 +13 1 0.9 +13 1 1.154 +13 1 0.816 +13 1 1.066 +13 1 1.004 +13 1 0.94 +13 1 0.898 +13 1 0.769 +13 1 0.798 +13 2 0.919 +13 2 0.881 +13 2 1.095 +13 2 0.85 +13 2 0.857 +13 2 0.782 +13 2 0.844 +13 2 0.858 +13 2 0.554 +13 2 0.654 +13 2 0.857 +13 2 0.821 +13 2 0.675 +13 2 0.585 +13 2 0.805 +13 2 1.018 +13 2 1.363 +13 2 0.864 +13 2 1.263 +13 2 0.888 +13 2 0.895 +13 2 0.94 +13 2 0.721 +13 2 0.861 +13 2 1.085 +13 2 0.739 +13 2 0.81 +13 2 0.682 +13 2 0.947 +13 2 0.963 +13 2 1.017 +13 2 0.673 +13 2 0.893 +13 2 0.711 +13 2 0.871 +13 2 1.214 +13 2 0.779 +13 2 1.034 +13 2 0.739 +13 2 0.783 +13 2 0.966 +13 2 0.75 +13 2 0.615 +13 2 1.189 +13 2 0.948 +13 2 0.766 +13 2 0.584 +13 2 1.412 +13 2 2.171 +13 2 0.914 +14 1 0.976 +14 1 1.071 +14 1 0.693 +14 1 0.744 +14 1 0.574 +14 1 0.688 +14 1 0.924 +14 1 0.754 +14 1 0.766 +14 1 0.783 +14 1 0.562 +14 1 0.973 +14 1 0.603 +14 1 0.767 +14 1 0.731 +14 1 0.765 +14 1 1.137 +14 1 0.71 +14 1 0.682 +14 1 0.595 +14 1 0.679 +14 1 0.634 +14 1 0.879 +14 1 0.671 +14 1 0.858 +14 1 0.777 +14 1 0.604 +14 1 0.681 +14 1 0.984 +14 1 0.989 +14 1 1.313 +14 1 0.801 +14 1 0.597 +14 1 0.684 +14 1 0.879 +14 1 1.276 +14 1 0.822 +14 1 1.048 +14 1 0.957 +14 1 0.634 +14 1 0.773 +14 1 1.093 +14 1 0.982 +14 1 0.891 +14 1 0.893 +14 1 0.723 +14 1 0.616 +14 1 1.09 +14 1 0.605 +14 1 0.661 +14 2 0.992 +14 2 0.657 +14 2 0.757 +14 2 0.667 +14 2 0.99 +14 2 0.949 +14 2 0.943 +14 2 0.948 +14 2 0.974 +14 2 0.994 +14 2 0.579 +14 2 0.827 +14 2 0.877 +14 2 1.015 +14 2 0.666 +14 2 0.766 +14 2 0.681 +14 2 1.103 +14 2 1.168 +14 2 1.031 +14 2 0.662 +14 2 0.95 +14 2 1.13 +14 2 0.889 +14 2 0.755 +14 2 0.679 +14 2 0.74 +14 2 1.013 +14 2 0.777 +14 2 0.901 +14 2 1.173 +14 2 0.979 +14 2 1.195 +14 2 0.606 +14 2 0.803 +14 2 0.868 +14 2 0.979 +14 2 0.669 +14 2 1.036 +14 2 0.918 +14 2 0.909 +14 2 0.963 +14 2 0.833 +14 2 1.067 +14 2 0.996 +14 2 0.826 +14 2 1.099 +14 2 0.915 +14 2 1.001 +14 2 0.751 +15 1 1.117 +15 1 0.769 +15 1 0.932 +15 1 0.754 +15 1 0.726 +15 1 0.918 +15 1 0.57 +15 1 0.855 +15 1 0.839 +15 1 0.483 +15 1 0.834 +15 1 0.52 +15 1 0.892 +15 1 0.701 +15 1 0.668 +15 1 0.769 +15 1 1.06 +15 1 0.676 +15 1 0.871 +15 1 0.829 +15 1 0.611 +15 1 0.555 +15 1 0.534 +15 1 0.87 +15 1 0.764 +15 1 1.198 +15 1 0.874 +15 1 0.932 +15 1 1.049 +15 1 0.694 +15 1 0.862 +15 1 0.937 +15 1 1.059 +15 1 0.913 +15 1 0.844 +15 1 0.647 +15 1 0.906 +15 1 0.86 +15 1 0.886 +15 1 0.845 +15 1 0.738 +15 1 0.757 +15 1 0.897 +15 1 0.799 +15 1 0.651 +15 1 0.724 +15 1 0.596 +15 1 0.635 +15 1 0.747 +15 1 0.55 +15 2 0.587 +15 2 1.064 +15 2 0.724 +15 2 0.572 +15 2 0.799 +15 2 1.124 +15 2 0.955 +15 2 0.906 +15 2 1.086 +15 2 0.696 +15 2 0.97 +15 2 0.723 +15 2 0.819 +15 2 1.427 +15 2 1.029 +15 2 0.979 +15 2 0.652 +15 2 0.694 +15 2 1.455 +15 2 0.654 +15 2 0.86 +15 2 1.01 +15 2 1.042 +15 2 1.06 +15 2 0.79 +15 2 0.689 +15 2 0.766 +15 2 0.679 +15 2 0.947 +15 2 1.068 +15 2 1.393 +15 2 0.89 +15 2 0.682 +15 2 1.043 +15 2 1.013 +15 2 0.778 +15 2 0.601 +15 2 0.978 +15 2 1.071 +15 2 0.768 +15 2 0.926 +15 2 0.771 +15 2 0.959 +15 2 0.798 +15 2 0.76 +15 2 0.84 +15 2 0.77 +15 2 0.722 +15 2 0.765 +15 2 0.818 +16 1 0.938 +16 1 1.315 +16 1 0.669 +16 1 0.854 +16 1 1.041 +16 1 1.4 +16 1 0.989 +16 1 0.891 +16 1 0.833 +16 1 0.986 +16 1 1.139 +16 1 0.857 +16 1 0.929 +16 1 0.941 +16 1 1.066 +16 1 1.176 +16 1 0.955 +16 1 0.878 +16 1 1.267 +16 1 0.929 +16 1 1.331 +16 1 0.881 +16 1 1.036 +16 1 0.646 +16 1 0.871 +16 1 0.889 +16 1 0.755 +16 1 0.713 +16 1 1.127 +16 1 1.118 +16 1 0.677 +16 1 0.989 +16 1 0.702 +16 1 0.711 +16 1 1.014 +16 1 0.767 +16 1 1.141 +16 1 0.902 +16 1 1.016 +16 1 0.794 +16 1 0.697 +16 1 1.118 +16 1 0.945 +16 1 0.846 +16 1 0.908 +16 1 1.244 +16 1 0.765 +16 1 0.757 +16 1 0.778 +16 1 0.641 +16 2 1.174 +16 2 1.002 +16 2 1.006 +16 2 0.946 +16 2 0.849 +16 2 0.792 +16 2 1.184 +16 2 0.698 +16 2 1.066 +16 2 0.797 +16 2 1.024 +16 2 0.806 +16 2 0.846 +16 2 1.519 +16 2 1.129 +16 2 0.61 +16 2 0.986 +16 2 0.86 +16 2 0.741 +16 2 1.006 +16 2 0.987 +16 2 0.885 +16 2 1.609 +16 2 0.599 +16 2 1.18 +16 2 0.893 +16 2 1.126 +16 2 0.86 +16 2 0.833 +16 2 0.661 +16 2 0.91 +16 2 1.862 +16 2 1.228 +16 2 1.48 +16 2 1.204 +16 2 1.279 +16 2 1.2 +16 2 1.075 +16 2 0.835 +16 2 0.845 +16 2 0.675 +16 2 0.955 +16 2 1.199 +16 2 1.242 +16 2 0.978 +16 2 0.842 +16 2 2.376 +16 2 1.149 +16 2 1.379 +16 2 0.883 +17 1 0.815 +17 1 0.911 +17 1 1.239 +17 1 0.768 +17 1 1.004 +17 1 0.551 +17 1 0.737 +17 1 0.632 +17 1 1.071 +17 1 0.793 +17 1 0.755 +17 1 1.143 +17 1 1.071 +17 1 0.681 +17 1 0.906 +17 1 0.64 +17 1 0.742 +17 1 1.219 +17 1 1.167 +17 1 1.069 +17 1 0.727 +17 1 0.57 +17 1 0.646 +17 1 1.028 +17 1 0.771 +17 1 0.545 +17 1 0.79 +17 1 1.155 +17 1 0.954 +17 1 0.692 +17 1 0.604 +17 1 0.691 +17 1 0.828 +17 1 1.012 +17 1 0.565 +17 1 1.047 +17 1 0.823 +17 1 0.937 +17 1 0.593 +17 1 0.713 +17 1 0.746 +17 1 1.052 +17 1 1.048 +17 1 0.908 +17 1 1.215 +17 1 0.736 +17 1 1.044 +17 1 0.815 +17 1 0.713 +17 1 1.021 +17 2 1.235 +17 2 1.084 +17 2 0.783 +17 2 0.789 +17 2 1.234 +17 2 0.953 +17 2 1.071 +17 2 0.812 +17 2 1.197 +17 2 0.735 +17 2 1.018 +17 2 0.733 +17 2 0.544 +17 2 0.661 +17 2 0.905 +17 2 1.086 +17 2 0.612 +17 2 0.672 +17 2 1.37 +17 2 0.796 +17 2 0.989 +17 2 0.78 +17 2 0.82 +17 2 0.895 +17 2 0.879 +17 2 0.839 +17 2 0.789 +17 2 0.498 +17 2 1.409 +17 2 1.379 +17 2 0.692 +17 2 0.844 +17 2 1.233 +17 2 1.118 +17 2 1.202 +17 2 0.696 +17 2 1.722 +17 2 0.688 +17 2 1.051 +17 2 0.906 +17 2 0.801 +17 2 0.805 +17 2 0.708 +17 2 1.318 +17 2 0.895 +17 2 0.932 +17 2 0.921 +17 2 0.806 +17 2 0.688 +17 2 0.93 +18 1 0.496 +18 1 0.548 +18 1 0.58 +18 1 0.58 +18 1 0.724 +18 1 1.014 +18 1 0.54 +18 1 0.775 +18 1 0.859 +18 1 0.589 +18 1 0.7 +18 1 0.844 +18 1 0.673 +18 1 0.678 +18 1 0.754 +18 1 0.699 +18 1 0.636 +18 1 0.689 +18 1 1.088 +18 1 0.854 +18 1 0.596 +18 1 0.564 +18 1 0.66 +18 1 0.949 +18 1 0.752 +18 1 0.619 +18 1 0.856 +18 1 0.689 +18 1 0.576 +18 1 0.779 +18 1 0.995 +18 1 0.775 +18 1 0.736 +18 1 0.624 +18 1 0.798 +18 1 0.58 +18 1 0.529 +18 1 0.702 +18 1 0.703 +18 1 1.233 +18 1 0.566 +18 1 0.733 +18 1 0.841 +18 1 0.889 +18 1 0.706 +18 1 0.614 +18 1 0.699 +18 1 1.104 +18 1 0.783 +18 1 0.499 +18 2 1.042 +18 2 0.845 +18 2 0.746 +18 2 0.748 +18 2 0.728 +18 2 0.793 +18 2 0.678 +18 2 0.797 +18 2 0.625 +18 2 0.784 +18 2 0.964 +18 2 0.839 +18 2 0.947 +18 2 0.608 +18 2 0.76 +18 2 0.86 +18 2 0.61 +18 2 1.08 +18 2 0.614 +18 2 0.778 +18 2 0.775 +18 2 0.77 +18 2 0.719 +18 2 0.828 +18 2 0.614 +18 2 0.587 +18 2 0.659 +18 2 0.742 +18 2 1 +18 2 1.086 +18 2 0.804 +18 2 0.815 +18 2 0.714 +18 2 0.758 +18 2 0.576 +18 2 0.799 +18 2 0.674 +18 2 0.807 +18 2 0.699 +18 2 0.658 +18 2 0.718 +18 2 0.697 +18 2 0.961 +18 2 0.785 +18 2 0.825 +18 2 0.592 +18 2 1.061 +18 2 0.777 +18 2 0.634 +18 2 0.802 +19 1 1.022 +19 1 0.628 +19 1 1.262 +19 1 0.804 +19 1 1.089 +19 1 0.846 +19 1 0.774 +19 1 0.58 +19 1 0.662 +19 1 0.825 +19 1 1.012 +19 1 0.576 +19 1 1.162 +19 1 1.169 +19 1 0.657 +19 1 0.928 +19 1 0.671 +19 1 0.81 +19 1 1.037 +19 1 1.022 +19 1 0.696 +19 1 0.765 +19 1 0.679 +19 1 0.9 +19 1 0.609 +19 1 0.512 +19 1 1.191 +19 1 1.48 +19 1 0.754 +19 1 0.995 +19 1 0.831 +19 1 1.192 +19 1 0.947 +19 1 0.872 +19 1 0.584 +19 1 1.078 +19 1 0.771 +19 1 0.626 +19 1 0.796 +19 1 0.81 +19 1 1.072 +19 1 0.654 +19 1 0.738 +19 1 1.197 +19 1 1.157 +19 1 1.1 +19 1 1.253 +19 1 0.872 +19 1 0.735 +19 1 0.947 +19 2 1.153 +19 2 1.67 +19 2 0.596 +19 2 0.948 +19 2 1.04 +19 2 0.878 +19 2 0.641 +19 2 1.063 +19 2 0.748 +19 2 1.003 +19 2 1.109 +19 2 1.223 +19 2 0.641 +19 2 1.16 +19 2 0.752 +19 2 0.675 +19 2 1.233 +19 2 1.179 +19 2 0.841 +19 2 1.068 +19 2 0.736 +19 2 0.858 +19 2 0.87 +19 2 0.834 +19 2 1.061 +19 2 1.308 +19 2 0.802 +19 2 0.882 +19 2 1.344 +19 2 0.825 +19 2 0.537 +19 2 1.005 +19 2 0.732 +19 2 0.715 +19 2 1.268 +19 2 1.687 +19 2 0.709 +19 2 1.145 +19 2 0.87 +19 2 0.919 +19 2 1.203 +19 2 0.934 +19 2 0.737 +19 2 0.799 +19 2 1.048 +19 2 0.56 +19 2 1.164 +19 2 0.64 +19 2 0.893 +19 2 0.851 +20 1 1.045 +20 1 0.806 +20 1 0.791 +20 1 0.905 +20 1 0.655 +20 1 0.742 +20 1 1.015 +20 1 0.902 +20 1 0.603 +20 1 0.892 +20 1 0.592 +20 1 0.684 +20 1 1.024 +20 1 0.515 +20 1 0.554 +20 1 1.047 +20 1 0.656 +20 1 1.032 +20 1 0.747 +20 1 0.85 +20 1 0.93 +20 1 0.677 +20 1 0.726 +20 1 0.71 +20 1 1.569 +20 1 0.795 +20 1 0.859 +20 1 0.72 +20 1 0.735 +20 1 1.067 +20 1 0.721 +20 1 0.777 +20 1 0.84 +20 1 0.707 +20 1 1.24 +20 1 0.587 +20 1 1.258 +20 1 0.719 +20 1 1.062 +20 1 0.535 +20 1 0.962 +20 1 0.944 +20 1 0.604 +20 1 0.662 +20 1 0.807 +20 1 1.007 +20 1 0.662 +20 1 0.738 +20 1 1.121 +20 1 0.619 +20 2 1.029 +20 2 0.912 +20 2 0.655 +20 2 0.714 +20 2 0.989 +20 2 0.871 +20 2 1.162 +20 2 0.724 +20 2 0.587 +20 2 1.055 +20 2 0.723 +20 2 0.846 +20 2 1.255 +20 2 0.78 +20 2 1.2 +20 2 0.657 +20 2 1.024 +20 2 0.871 +20 2 0.704 +20 2 0.634 +20 2 0.838 +20 2 0.872 +20 2 0.877 +20 2 0.932 +20 2 0.746 +20 2 0.738 +20 2 0.869 +20 2 0.733 +20 2 1.102 +20 2 0.856 +20 2 0.722 +20 2 0.578 +20 2 0.718 +20 2 1.371 +20 2 0.73 +20 2 0.691 +20 2 0.958 +20 2 0.911 +20 2 0.981 +20 2 0.775 +20 2 1.075 +20 2 0.647 +20 2 0.815 +20 2 0.709 +20 2 0.964 +20 2 0.848 +20 2 1.072 +20 2 1.376 +20 2 0.85 +20 2 0.734 +21 1 0.635 +21 1 0.707 +21 1 0.736 +21 1 1.196 +21 1 0.601 +21 1 0.604 +21 1 0.687 +21 1 0.848 +21 1 0.895 +21 1 0.625 +21 1 0.767 +21 1 0.74 +21 1 0.978 +21 1 0.953 +21 1 0.7 +21 1 0.754 +21 1 0.861 +21 1 0.55 +21 1 0.7 +21 1 0.846 +21 1 0.672 +21 1 0.737 +21 1 0.743 +21 1 0.646 +21 1 0.615 +21 1 0.716 +21 1 0.695 +21 1 0.898 +21 1 1.062 +21 1 0.744 +21 1 0.813 +21 1 0.735 +21 1 0.851 +21 1 0.782 +21 1 0.785 +21 1 0.959 +21 1 0.616 +21 1 1.041 +21 1 0.804 +21 1 0.775 +21 1 0.667 +21 1 0.721 +21 1 0.809 +21 1 0.517 +21 1 0.662 +21 1 0.848 +21 1 0.703 +21 1 0.637 +21 1 0.657 +21 1 0.785 +21 2 0.578 +21 2 0.969 +21 2 0.531 +21 2 0.714 +21 2 0.674 +21 2 0.619 +21 2 0.638 +21 2 0.838 +21 2 0.773 +21 2 0.744 +21 2 0.519 +21 2 0.61 +21 2 0.771 +21 2 0.663 +21 2 0.673 +21 2 1.012 +21 2 0.824 +21 2 0.642 +21 2 0.719 +21 2 0.746 +21 2 0.689 +21 2 0.652 +21 2 0.784 +21 2 0.939 +21 2 0.834 +21 2 0.76 +21 2 0.865 +21 2 0.951 +21 2 0.77 +21 2 0.879 +21 2 0.63 +21 2 0.752 +21 2 0.726 +21 2 0.828 +21 2 0.859 +21 2 0.772 +21 2 0.677 +21 2 0.656 +21 2 0.844 +21 2 1.093 +21 2 0.674 +21 2 0.731 +21 2 0.854 +21 2 0.706 +21 2 0.815 +21 2 0.785 +21 2 0.676 +21 2 0.96 +21 2 0.963 +21 2 1.006 +22 1 1.057 +22 1 0.707 +22 1 0.713 +22 1 0.832 +22 1 0.906 +22 1 0.731 +22 1 0.719 +22 1 0.691 +22 1 1.116 +22 1 0.502 +22 1 0.758 +22 1 0.792 +22 1 0.635 +22 1 0.856 +22 1 0.544 +22 1 0.979 +22 1 0.571 +22 1 0.525 +22 1 0.672 +22 1 0.814 +22 1 0.687 +22 1 0.699 +22 1 0.846 +22 1 0.635 +22 1 0.771 +22 1 0.878 +22 1 1.161 +22 1 0.875 +22 1 1.185 +22 1 0.869 +22 1 0.785 +22 1 0.521 +22 1 0.617 +22 1 0.735 +22 1 0.923 +22 1 0.734 +22 1 0.888 +22 1 0.635 +22 1 0.741 +22 1 0.824 +22 1 0.728 +22 1 0.805 +22 1 0.684 +22 1 0.854 +22 1 0.772 +22 1 0.778 +22 1 0.546 +22 1 0.684 +22 1 0.588 +22 1 0.577 +22 2 0.752 +22 2 0.808 +22 2 0.893 +22 2 1.087 +22 2 0.927 +22 2 1.065 +22 2 0.747 +22 2 0.782 +22 2 1.085 +22 2 0.837 +22 2 0.598 +22 2 0.699 +22 2 1.064 +22 2 0.734 +22 2 0.903 +22 2 0.84 +22 2 0.751 +22 2 0.775 +22 2 0.916 +22 2 0.878 +22 2 1.127 +22 2 0.801 +22 2 0.689 +22 2 0.869 +22 2 0.987 +22 2 1.494 +22 2 0.757 +22 2 0.779 +22 2 1.031 +22 2 1.141 +22 2 0.726 +22 2 0.978 +22 2 0.741 +22 2 0.683 +22 2 0.968 +22 2 0.857 +22 2 0.915 +22 2 0.738 +22 2 1.306 +22 2 0.978 +22 2 0.771 +22 2 0.987 +22 2 0.651 +22 2 0.812 +22 2 1.178 +22 2 0.803 +22 2 1.039 +22 2 0.797 +22 2 0.54 +22 2 0.695 +23 1 0.784 +23 1 1.044 +23 1 0.664 +23 1 0.794 +23 1 0.62 +23 1 0.614 +23 1 0.641 +23 1 1.024 +23 1 0.923 +23 1 0.852 +23 1 0.962 +23 1 0.686 +23 1 0.885 +23 1 0.782 +23 1 0.61 +23 1 0.635 +23 1 0.756 +23 1 0.782 +23 1 0.7 +23 1 0.616 +23 1 0.516 +23 1 0.82 +23 1 0.704 +23 1 0.843 +23 1 0.561 +23 1 0.589 +23 1 0.731 +23 1 0.573 +23 1 0.524 +23 1 0.89 +23 1 0.914 +23 1 0.613 +23 1 0.707 +23 1 0.601 +23 1 0.801 +23 1 0.744 +23 1 0.631 +23 1 0.642 +23 1 0.609 +23 1 0.822 +23 1 0.847 +23 1 0.811 +23 1 0.634 +23 1 0.54 +23 1 0.84 +23 1 0.721 +23 1 0.742 +23 1 0.943 +23 1 0.628 +23 1 0.969 +23 2 0.729 +23 2 0.686 +23 2 0.761 +23 2 0.868 +23 2 0.761 +23 2 0.661 +23 2 0.749 +23 2 0.503 +23 2 0.715 +23 2 0.881 +23 2 0.767 +23 2 0.93 +23 2 0.887 +23 2 0.921 +23 2 0.923 +23 2 0.57 +23 2 0.796 +23 2 1.176 +23 2 0.719 +23 2 0.88 +23 2 0.821 +23 2 0.902 +23 2 0.75 +23 2 0.695 +23 2 0.808 +23 2 0.833 +23 2 0.764 +23 2 0.801 +23 2 0.872 +23 2 0.677 +23 2 1.038 +23 2 1.37 +23 2 1.131 +23 2 0.722 +23 2 0.562 +23 2 0.805 +23 2 0.974 +23 2 0.95 +23 2 0.622 +23 2 0.635 +23 2 0.819 +23 2 0.917 +23 2 0.972 +23 2 0.959 +23 2 0.653 +23 2 0.613 +23 2 0.545 +23 2 0.891 +23 2 0.962 +23 2 0.857 +24 1 0.619 +24 1 1.099 +24 1 0.706 +24 1 1.161 +24 1 0.86 +24 1 1 +24 1 0.818 +24 1 0.751 +24 1 0.624 +24 1 0.68 +24 1 0.754 +24 1 0.81 +24 1 0.756 +24 1 0.734 +24 1 0.792 +24 1 0.684 +24 1 0.683 +24 1 0.577 +24 1 0.921 +24 1 0.769 +24 1 0.748 +24 1 0.656 +24 1 0.723 +24 1 0.616 +24 1 0.62 +24 1 0.536 +24 1 0.951 +24 1 0.782 +24 1 0.612 +24 1 0.994 +24 1 0.874 +24 1 0.899 +24 1 0.727 +24 1 0.698 +24 1 0.746 +24 1 0.832 +24 1 0.911 +24 1 1.105 +24 1 0.686 +24 1 0.624 +24 1 0.778 +24 1 1.63 +24 1 0.697 +24 1 0.989 +24 1 0.724 +24 1 0.69 +24 1 0.66 +24 1 0.729 +24 1 1.12 +24 1 0.813 +24 2 0.905 +24 2 0.984 +24 2 1.354 +24 2 0.969 +24 2 0.61 +24 2 0.655 +24 2 0.593 +24 2 0.488 +24 2 1.102 +24 2 0.729 +24 2 0.886 +24 2 1.072 +24 2 0.727 +24 2 0.787 +24 2 0.877 +24 2 0.852 +24 2 0.689 +24 2 0.959 +24 2 0.918 +24 2 0.761 +24 2 0.633 +24 2 0.937 +24 2 1.141 +24 2 1.127 +24 2 0.992 +24 2 0.731 +24 2 0.724 +24 2 0.715 +24 2 0.742 +24 2 0.954 +24 2 0.858 +24 2 0.566 +24 2 0.566 +24 2 0.806 +24 2 0.838 +24 2 0.528 +24 2 0.683 +24 2 0.815 +24 2 1.151 +24 2 0.552 +24 2 0.629 +24 2 0.65 +24 2 0.843 +24 2 0.873 +24 2 0.756 +24 2 0.59 +24 2 0.709 +24 2 0.719 +24 2 0.775 +24 2 1.2 +25 1 0.668 +25 1 0.779 +25 1 0.664 +25 1 0.602 +25 1 0.883 +25 1 0.623 +25 1 1.515 +25 1 0.782 +25 1 0.776 +25 1 0.756 +25 1 1.189 +25 1 0.889 +25 1 0.727 +25 1 0.61 +25 1 0.624 +25 1 0.654 +25 1 1.014 +25 1 0.737 +25 1 0.658 +25 1 0.916 +25 1 1.047 +25 1 0.666 +25 1 0.699 +25 1 0.826 +25 1 0.766 +25 1 0.838 +25 1 1.15 +25 1 0.757 +25 1 0.723 +25 1 0.853 +25 1 0.759 +25 1 0.881 +25 1 0.731 +25 1 0.845 +25 1 0.57 +25 1 0.769 +25 1 0.689 +25 1 0.608 +25 1 0.704 +25 1 0.831 +25 1 0.782 +25 1 0.895 +25 1 0.948 +25 1 0.923 +25 1 0.716 +25 1 0.593 +25 1 0.723 +25 1 1.002 +25 1 0.747 +25 1 0.563 +25 2 0.912 +25 2 0.869 +25 2 0.748 +25 2 0.848 +25 2 1.133 +25 2 1.112 +25 2 0.739 +25 2 0.817 +25 2 0.61 +25 2 0.7 +25 2 1.341 +25 2 1.171 +25 2 0.776 +25 2 0.705 +25 2 0.62 +25 2 1.385 +25 2 0.837 +25 2 0.719 +25 2 1.052 +25 2 0.651 +25 2 0.965 +25 2 1.154 +25 2 0.779 +25 2 1.157 +25 2 0.945 +25 2 0.707 +25 2 0.93 +25 2 0.703 +25 2 0.728 +25 2 0.976 +25 2 0.736 +25 2 0.811 +25 2 1.036 +25 2 0.638 +25 2 1.201 +25 2 1.354 +25 2 0.939 +25 2 0.898 +25 2 0.733 +25 2 0.912 +25 2 0.732 +25 2 0.87 +25 2 0.705 +25 2 0.979 +25 2 0.957 +25 2 1.097 +25 2 1.332 +25 2 0.711 +25 2 1.023 +25 2 0.613 \ No newline at end of file diff --git a/data-raw/es_info.R b/data-raw/es_info.R index b4d6cd57..88044de6 100644 --- a/data-raw/es_info.R +++ b/data-raw/es_info.R @@ -4,6 +4,11 @@ es_info <- tibble::tribble( "Cohens_d", "Cohen's d", NA, "twotail", -Inf, Inf, 0, "Hedges_g", "Hedges' g", NA, "twotail", -Inf, Inf, 0, "Glass_delta", "Glass' delta", "Glass' \u0394", "twotail", -Inf, Inf, 0, + "d_rm", "d (rm)", "d\u1D63\u2098", "twotail", -Inf, Inf, 0, + "d_av", "d (av)", "d\u2090\u1D65", "twotail", -Inf, Inf, 0, + "d_z", "d (z)", NA, "twotail", -Inf, Inf, 0, + "Beckers_d", "Becker's d", NA, "twotail", -Inf, Inf, 0, + "d_r", "d (r)", "d\u1D63", "twotail", -Inf, Inf, 0, "Mahalanobis_D", "Mahalanobis' D", NA, "onetail", 0, Inf, 0, "Means_ratio", "Means Ratio", NA, "twotail", 0, Inf, 1, "Means_ratio_adjusted", "Means Ratio (adj.)", NA, "twotail", 0, Inf, 1, diff --git a/data/rouder2016.rdata b/data/rouder2016.rdata new file mode 100644 index 0000000000000000000000000000000000000000..ebab872aa26563bc3861e20d96e99fd69e083ec2 GIT binary patch literal 6442 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 literal 0 HcmV?d00001 diff --git a/man/Music_preferences.Rd b/man/Music_preferences.Rd index 827c24bb..4afd2b17 100644 --- a/man/Music_preferences.Rd +++ b/man/Music_preferences.Rd @@ -25,6 +25,7 @@ Other effect size datasets: \code{\link{Smoking_FASD}}, \code{\link{food_class}}, \code{\link{hardlyworking}}, +\code{\link{rouder2016}}, \code{\link{screening_test}} } \concept{effect size datasets} diff --git a/man/Music_preferences2.Rd b/man/Music_preferences2.Rd index c09e87a1..a86781c9 100644 --- a/man/Music_preferences2.Rd +++ b/man/Music_preferences2.Rd @@ -25,6 +25,7 @@ Other effect size datasets: \code{\link{Smoking_FASD}}, \code{\link{food_class}}, \code{\link{hardlyworking}}, +\code{\link{rouder2016}}, \code{\link{screening_test}} } \concept{effect size datasets} diff --git a/man/RCT_table.Rd b/man/RCT_table.Rd index 7edfc674..bf1e7426 100644 --- a/man/RCT_table.Rd +++ b/man/RCT_table.Rd @@ -25,6 +25,7 @@ Other effect size datasets: \code{\link{Smoking_FASD}}, \code{\link{food_class}}, \code{\link{hardlyworking}}, +\code{\link{rouder2016}}, \code{\link{screening_test}} } \concept{effect size datasets} diff --git a/man/Smoking_FASD.Rd b/man/Smoking_FASD.Rd index 945fc86d..ec24a35f 100644 --- a/man/Smoking_FASD.Rd +++ b/man/Smoking_FASD.Rd @@ -23,6 +23,7 @@ Other effect size datasets: \code{\link{RCT_table}}, \code{\link{food_class}}, \code{\link{hardlyworking}}, +\code{\link{rouder2016}}, \code{\link{screening_test}} } \concept{effect size datasets} diff --git a/man/cohens_d.Rd b/man/cohens_d.Rd index 0feecee3..90d7b1c8 100644 --- a/man/cohens_d.Rd +++ b/man/cohens_d.Rd @@ -59,7 +59,7 @@ variance). Else the mean SD from both groups is used instead.} \item{paired}{If \code{TRUE}, the values of \code{x} and \code{y} are considered as paired. This produces an effect size that is equivalent to the one-sample effect -size on \code{x - y}.} +size on \code{x - y}. See also \code{\link[=repeated_measures_d]{repeated_measures_d()}} for more options.} \item{ci}{Confidence Interval (CI) level} @@ -182,10 +182,12 @@ cohens_d(Pair(extra[group == 1], extra[group == 2]) ~ 1, data = sleep) # same as: # cohens_d(sleep$extra[sleep$group == 1], sleep$extra[sleep$group == 2], paired = TRUE) +# cohens_d(sleep$extra[sleep$group == 1] - sleep$extra[sleep$group == 2]) +# rm_d(sleep$extra[sleep$group == 1], sleep$extra[sleep$group == 2], method = "z", adjust = FALSE) # More options: -cohens_d(Pair(extra[group == 1], extra[group == 2]) ~ 1, data = sleep, mu = -1) -hedges_g(Pair(extra[group == 1], extra[group == 2]) ~ 1, data = sleep) +cohens_d(Pair(extra[group == 1], extra[group == 2]) ~ 1, data = sleep, mu = -1, verbose = FALSE) +hedges_g(Pair(extra[group == 1], extra[group == 2]) ~ 1, data = sleep, verbose = FALSE) # Interpretation ----------------------- @@ -219,12 +221,13 @@ Correcting error and bias in research findings. Sage. } } \seealso{ -\code{\link[=sd_pooled]{sd_pooled()}}, \code{\link[=t_to_d]{t_to_d()}}, \code{\link[=r_to_d]{r_to_d()}} +\code{\link[=rm_d]{rm_d()}}, \code{\link[=sd_pooled]{sd_pooled()}}, \code{\link[=t_to_d]{t_to_d()}}, \code{\link[=r_to_d]{r_to_d()}} Other standardized differences: \code{\link{mahalanobis_d}()}, \code{\link{means_ratio}()}, \code{\link{p_superiority}()}, -\code{\link{rank_biserial}()} +\code{\link{rank_biserial}()}, +\code{\link{repeated_measures_d}()} } \concept{standardized differences} diff --git a/man/effectsize.Rd b/man/effectsize.Rd index 5d931c82..17acf96c 100644 --- a/man/effectsize.Rd +++ b/man/effectsize.Rd @@ -49,6 +49,9 @@ input model. See details. \item For an object of class \code{htest}, data is extracted via \code{\link[insight:get_data]{insight::get_data()}}, and passed to the relevant function according to: \itemize{ \item A \strong{t-test} depending on \code{type}: \code{"cohens_d"} (default), \code{"hedges_g"}, or one of \code{"p_superiority"}, \code{"u1"}, \code{"u2"}, \code{"u3"}, \code{"overlap"}. +\itemize{ +\item For a \strong{Paired t-test}: depending on \code{type}: \code{"rm"}, \code{"av"}, \code{"b"}, \code{"d"}, \code{"z"}. +} \item A \strong{Chi-squared tests of independence} or \strong{Fisher's Exact Test}, depending on \code{type}: \code{"cramers_v"} (default), \code{"tschuprows_t"}, \code{"phi"}, \code{"cohens_w"}, \code{"pearsons_c"}, \code{"cohens_h"}, \code{"oddsratio"}, \code{"riskratio"}, \code{"arr"}, or \code{"nnt"}. \item A \strong{Chi-squared tests of goodness-of-fit}, depending on \code{type}: \code{"fei"} (default) \code{"cohens_w"}, \code{"pearsons_c"} \item A \strong{One-way ANOVA test}, depending on \code{type}: \code{"eta"} (default), \code{"omega"} or \code{"epsilon"} -squared, \code{"f"}, or \code{"f2"}. @@ -89,6 +92,13 @@ effectsize(Xsq, type = "cohens_w") Tt <- t.test(1:10, y = c(7:20), alternative = "less") effectsize(Tt) +Tt <- t.test( + x = c(1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30), + y = c(0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29), + paired = TRUE +) +effectsize(Tt, type = "rm_b") + Aov <- oneway.test(extra ~ group, data = sleep, var.equal = TRUE) effectsize(Aov) effectsize(Aov, type = "omega") diff --git a/man/food_class.Rd b/man/food_class.Rd index bd7aeb99..1bc5576e 100644 --- a/man/food_class.Rd +++ b/man/food_class.Rd @@ -24,6 +24,7 @@ Other effect size datasets: \code{\link{RCT_table}}, \code{\link{Smoking_FASD}}, \code{\link{hardlyworking}}, +\code{\link{rouder2016}}, \code{\link{screening_test}} } \concept{effect size datasets} diff --git a/man/hardlyworking.Rd b/man/hardlyworking.Rd index 7a588b6e..5dbd4572 100644 --- a/man/hardlyworking.Rd +++ b/man/hardlyworking.Rd @@ -35,6 +35,7 @@ Other effect size datasets: \code{\link{RCT_table}}, \code{\link{Smoking_FASD}}, \code{\link{food_class}}, +\code{\link{rouder2016}}, \code{\link{screening_test}} } \concept{effect size datasets} diff --git a/man/mahalanobis_d.Rd b/man/mahalanobis_d.Rd index 942f6090..889ee70f 100644 --- a/man/mahalanobis_d.Rd +++ b/man/mahalanobis_d.Rd @@ -159,6 +159,7 @@ Other standardized differences: \code{\link{cohens_d}()}, \code{\link{means_ratio}()}, \code{\link{p_superiority}()}, -\code{\link{rank_biserial}()} +\code{\link{rank_biserial}()}, +\code{\link{repeated_measures_d}()} } \concept{standardized differences} diff --git a/man/means_ratio.Rd b/man/means_ratio.Rd index 5eb6c619..2a0d6d0a 100644 --- a/man/means_ratio.Rd +++ b/man/means_ratio.Rd @@ -129,6 +129,7 @@ Other standardized differences: \code{\link{cohens_d}()}, \code{\link{mahalanobis_d}()}, \code{\link{p_superiority}()}, -\code{\link{rank_biserial}()} +\code{\link{rank_biserial}()}, +\code{\link{repeated_measures_d}()} } \concept{standardized differences} diff --git a/man/p_superiority.Rd b/man/p_superiority.Rd index 595ae442..eebe89aa 100644 --- a/man/p_superiority.Rd +++ b/man/p_superiority.Rd @@ -273,7 +273,8 @@ Other standardized differences: \code{\link{cohens_d}()}, \code{\link{mahalanobis_d}()}, \code{\link{means_ratio}()}, -\code{\link{rank_biserial}()} +\code{\link{rank_biserial}()}, +\code{\link{repeated_measures_d}()} Other rank-based effect sizes: \code{\link{rank_biserial}()}, diff --git a/man/rank_biserial.Rd b/man/rank_biserial.Rd index b5577eb4..2c62bb46 100644 --- a/man/rank_biserial.Rd +++ b/man/rank_biserial.Rd @@ -187,7 +187,8 @@ Other standardized differences: \code{\link{cohens_d}()}, \code{\link{mahalanobis_d}()}, \code{\link{means_ratio}()}, -\code{\link{p_superiority}()} +\code{\link{p_superiority}()}, +\code{\link{repeated_measures_d}()} Other rank-based effect sizes: \code{\link{p_superiority}()}, diff --git a/man/repeated_measures_d.Rd b/man/repeated_measures_d.Rd new file mode 100644 index 00000000..e6d9e785 --- /dev/null +++ b/man/repeated_measures_d.Rd @@ -0,0 +1,241 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/repeated_measures_d.R +\name{repeated_measures_d} +\alias{repeated_measures_d} +\alias{rm_d} +\title{Standardized Mean Differences for Repeated Measures} +\usage{ +repeated_measures_d( + x, + y, + data = NULL, + mu = 0, + method = c("rm", "av", "z", "b", "d", "r"), + adjust = TRUE, + ci = 0.95, + alternative = "two.sided", + verbose = TRUE, + ... +) + +rm_d( + x, + y, + data = NULL, + mu = 0, + method = c("rm", "av", "z", "b", "d", "r"), + adjust = TRUE, + ci = 0.95, + alternative = "two.sided", + verbose = TRUE, + ... +) +} +\arguments{ +\item{x, y}{Paired numeric vectors, or names of ones in \code{data}. \code{x} can also +be a formula: +\itemize{ +\item \code{Pair(x,y) ~ 1} for wide data. +\item \code{y ~ condition | id} for long data, possibly with repetitions. +}} + +\item{data}{An optional data frame containing the variables.} + +\item{mu}{a number indicating the true value of the mean (or + difference in means if you are performing a two sample test).} + +\item{method}{Method of repeated measures standardized differences. See +details.} + +\item{adjust}{Apply Hedges' small-sample bias correction? See \code{\link[=hedges_g]{hedges_g()}}.} + +\item{ci}{Confidence Interval (CI) level} + +\item{alternative}{a character string specifying the alternative hypothesis; +Controls the type of CI returned: \code{"two.sided"} (default, two-sided CI), +\code{"greater"} or \code{"less"} (one-sided CI). Partial matching is allowed (e.g., +\code{"g"}, \code{"l"}, \code{"two"}...). See \emph{One-Sided CIs} in \link{effectsize_CIs}.} + +\item{verbose}{Toggle warnings and messages on or off.} + +\item{...}{Arguments passed to or from other methods. When \code{x} is a formula, +these can be \code{subset} and \code{na.action}.} +} +\value{ +A data frame with the effect size and their CIs (\code{CI_low} and +\code{CI_high}). +} +\description{ +Compute effect size indices for standardized mean differences in repeated +measures data. Pair with any reported \code{stats::t.test(paired = TRUE)}. +\cr\cr +In a repeated-measures design, the same subjects are measured in multiple +conditions or time points. Unlike the case of independent groups, there are +multiple sources of variation that can be used to standardized the +differences between the means of the conditions / times. +} +\note{ +\code{rm_d()} is an alias for \code{repeated_measures_d()}. +} +\section{Standardized Mean Differences for Repeated Measures}{ +Unlike \link[=cohens_d]{Cohen's d} for independent groups, where standardization +naturally is done by the (pooled) population standard deviation (cf. Glass’s +\eqn{\Delta}), when measured across two conditions are dependent, there are +many more options for what error term to standardize by. Additionally, some +options allow for data to be replicated (many measurements per condition per +individual), others require a single observation per condition per individual +(aka, paired data; so replications are aggregated). + +(It should be noted that all of these have awful and confusing notations.) + +Standardize by... +\itemize{ +\item \strong{Difference Score Variance: \eqn{d_{z}}} (\emph{Requires paired data}) - This +is akin to computing difference scores for each individual and then +computing a one-sample Cohen's \emph{d} (Cohen, 1988, pp. 48; see examples). +\item \strong{Within-Subject Variance: \eqn{d_{rm}}} (\emph{Requires paired data}) - Cohen +suggested adjusting \eqn{d_{z}} to estimate the "standard" between-subjects +\emph{d} by a factor of \eqn{\sqrt{2(1-r)}}, where \emph{r} is the Pearson correlation +between the paired measures (Cohen, 1988, pp. 48). +\item \strong{Control Variance: \eqn{d_{b}} (aka Becker's \emph{d})} (\emph{Requires paired +data}) - Standardized by the variance of the control condition (or in a pre- +post-treatment setting, the pre-treatment condition). This is akin to Glass' +\emph{delta} (\code{\link[=glass_delta]{glass_delta()}}) (Becker, 1988). Note that this is taken here as the +\emph{second} condition (\code{y}). +\item \strong{Average Variance: \eqn{d_{av}}} (\emph{Requires paired data}) - Instead of +standardizing by the variance in the of the control (or pre) condition, +Cumming suggests standardizing by the average variance of the two paired +conditions (Cumming, 2013, pp. 291). +\item \strong{All Variance: \eqn{d_{d}}} - This is the same as computing a standard +independent-groups Cohen's \emph{d} (Cohen, 1988). Note that CIs \emph{do} account for +the dependence, and so are typically more narrow (see examples). +\item \strong{Residual Variance: \eqn{d_{r}}} (\emph{Requires data with replications}) - +Divide by the pooled variance after all individual differences have been +partialled out (i.e., the residual/level-1 variance in an ANOVA or MLM +setting). In between-subjects designs where each subject contributes a single +response, this is equivalent to classical Cohen’s d. Priors in the +\code{BayesFactor} package are defined on this scale (Rouder et al., 2012). +\cr\cr +Note that for paired data, when the two conditions have equal variance, +\eqn{d_{rm}}, \eqn{d_{av}}, \eqn{d_{b}} are equal to \eqn{d}. +} +} + +\section{Confidence (Compatibility) Intervals (CIs)}{ +Confidence intervals are estimated using the standard normal parametric +method (see Algina & Keselman, 2003; Becker, 1988; Cooper et al., 2009; +Hedges & Olkin, 1985; Pustejovsky et al., 2014). +} + +\section{CIs and Significance Tests}{ +"Confidence intervals on measures of effect size convey all the information +in a hypothesis test, and more." (Steiger, 2004). Confidence (compatibility) +intervals and p values are complementary summaries of parameter uncertainty +given the observed data. A dichotomous hypothesis test could be performed +with either a CI or a p value. The 100 (1 - \eqn{\alpha})\% confidence +interval contains all of the parameter values for which \emph{p} > \eqn{\alpha} +for the current data and model. For example, a 95\% confidence interval +contains all of the values for which p > .05. +\cr\cr +Note that a confidence interval including 0 \emph{does not} indicate that the null +(no effect) is true. Rather, it suggests that the observed data together with +the model and its assumptions combined do not provided clear evidence against +a parameter value of 0 (same as with any other value in the interval), with +the level of this evidence defined by the chosen \eqn{\alpha} level (Rafi & +Greenland, 2020; Schweder & Hjort, 2016; Xie & Singh, 2013). To infer no +effect, additional judgments about what parameter values are "close enough" +to 0 to be negligible are needed ("equivalence testing"; Bauer & Kiesser, +1996). +} + +\section{Plotting with \code{see}}{ + +The \code{see} package contains relevant plotting functions. See the \href{https://easystats.github.io/see/articles/effectsize.html}{plotting vignette in the \code{see} package}. +} + +\examples{ +# Paired data ------- + +data("sleep") +sleep2 <- reshape(sleep, + direction = "wide", + idvar = "ID", timevar = "group" +) + +repeated_measures_d(Pair(extra.1, extra.2) ~ 1, data = sleep2) + +# Same as: +# repeated_measures_d(sleep$extra[sleep$group==1], +# sleep$extra[sleep$group==2]) +# repeated_measures_d(extra ~ group | ID, data = sleep) + + +# More options: +repeated_measures_d(Pair(extra.1, extra.2) ~ 1, data = sleep2, mu = -1) +repeated_measures_d(Pair(extra.1, extra.2) ~ 1, data = sleep2, alternative = "less") + +# Other methods +repeated_measures_d(Pair(extra.1, extra.2) ~ 1, data = sleep2, method = "av") +repeated_measures_d(Pair(extra.1, extra.2) ~ 1, data = sleep2, method = "b") +repeated_measures_d(Pair(extra.1, extra.2) ~ 1, data = sleep2, method = "d") +repeated_measures_d(Pair(extra.1, extra.2) ~ 1, data = sleep2, method = "z", adjust = FALSE) + +# d_z is the same as Cohen's d for one sample (of individual difference): +cohens_d(extra.1 - extra.2 ~ 1, data = sleep2) + + + +# Repetition data ----------- + +data("rouder2016") + +# For rm, ad, z, b, data is aggregated +repeated_measures_d(rt ~ cond | id, data = rouder2016) + +# same as: +rouder2016_wide <- tapply(rouder2016[["rt"]], rouder2016[1:2], mean) +repeated_measures_d(rouder2016_wide[, 1], rouder2016_wide[, 2]) + +# For r or d, data is not aggragated: +repeated_measures_d(rt ~ cond | id, data = rouder2016, method = "r") +repeated_measures_d(rt ~ cond | id, data = rouder2016, method = "d", adjust = FALSE) + +# d is the same as Cohen's d for two independent groups: +cohens_d(rt ~ cond, data = rouder2016, ci = NULL) + +} +\references{ +\itemize{ +\item Algina, J., & Keselman, H. J. (2003). Approximate confidence intervals for +effect sizes. Educational and Psychological Measurement, 63(4), 537-553. +\item Becker, B. J. (1988). Synthesizing standardized mean‐change measures. +British Journal of Mathematical and Statistical Psychology, 41(2), 257-278. +\item Cohen, J. (1988). Statistical power analysis for the behavioral +sciences (2nd Ed.). New York: Routledge. +\item Cooper, H., Hedges, L., & Valentine, J. (2009). Handbook of research +synthesis and meta-analysis. Russell Sage Foundation, New York. +\item Cumming, G. (2013). Understanding the new statistics: Effect sizes, +confidence intervals, and meta-analysis. Routledge. +\item Hedges, L. V. & Olkin, I. (1985). Statistical methods for +meta-analysis. Orlando, FL: Academic Press. +\item Pustejovsky, J. E., Hedges, L. V., & Shadish, W. R. (2014). +Design-comparable effect sizes in multiple baseline designs: A general +modeling framework. Journal of Educational and Behavioral Statistics, 39(5), +368-393. +\item Rouder, J. N., Morey, R. D., Speckman, P. L., & Province, J. M. (2012). +Default Bayes factors for ANOVA designs. Journal of mathematical psychology, +56(5), 356-374. +} +} +\seealso{ +\code{\link[=cohens_d]{cohens_d()}}, and \code{lmeInfo::g_mlm()} and \code{emmeans::effsize()} for +more flexible methods. + +Other standardized differences: +\code{\link{cohens_d}()}, +\code{\link{mahalanobis_d}()}, +\code{\link{means_ratio}()}, +\code{\link{p_superiority}()}, +\code{\link{rank_biserial}()} +} +\concept{standardized differences} diff --git a/man/rouder2016.Rd b/man/rouder2016.Rd new file mode 100644 index 00000000..866741c0 --- /dev/null +++ b/man/rouder2016.Rd @@ -0,0 +1,43 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/datasets.R +\docType{data} +\name{rouder2016} +\alias{rouder2016} +\title{Jeff Rouder's Example Dataset for Repeated Measures} +\format{ +A data frame with 2500 rows and 3 variables: +\describe{ +\item{id}{participant: 1...25} +\item{cond}{condition: 1,2} +\item{rt}{response time in seconds} +} + +\if{html}{\out{
}}\preformatted{data("rouder2016") +head(rouder2016, n = 5) +#> id cond rt +#> 1 1 1 0.560 +#> 2 1 1 0.930 +#> 3 1 1 0.795 +#> 4 1 1 0.615 +#> 5 1 1 1.028 +}\if{html}{\out{
}} +} +\description{ +A dataset "with 25 people each observing 50 trials in 2 conditions", +published as \code{effectSizePuzzler.txt} by Jeff Rouder on March 24, 2016 +(\emph{http://jeffrouder.blogspot.com/2016/03/the-effect-size-puzzler.html}). +\cr\cr +The data is used in examples and tests of \code{\link[=rm_d]{rm_d()}}. +} +\seealso{ +Other effect size datasets: +\code{\link{Music_preferences2}}, +\code{\link{Music_preferences}}, +\code{\link{RCT_table}}, +\code{\link{Smoking_FASD}}, +\code{\link{food_class}}, +\code{\link{hardlyworking}}, +\code{\link{screening_test}} +} +\concept{effect size datasets} +\keyword{data} diff --git a/man/screening_test.Rd b/man/screening_test.Rd index f105b3e1..7b3b0a67 100644 --- a/man/screening_test.Rd +++ b/man/screening_test.Rd @@ -32,7 +32,8 @@ Other effect size datasets: \code{\link{RCT_table}}, \code{\link{Smoking_FASD}}, \code{\link{food_class}}, -\code{\link{hardlyworking}} +\code{\link{hardlyworking}}, +\code{\link{rouder2016}} } \concept{effect size datasets} \keyword{data} diff --git a/tests/testthat/test-effectsize.R b/tests/testthat/test-effectsize.R index 32b7d160..3e48ca7a 100644 --- a/tests/testthat/test-effectsize.R +++ b/tests/testthat/test-effectsize.R @@ -16,9 +16,6 @@ test_that("t-test", { model <- t.test(x, y, alternative = "less", conf.level = 0.8) expect_equal(effectsize(model), cohens_d(x, y, pooled_sd = FALSE, alternative = "less", ci = 0.8), ignore_attr = TRUE) - model <- t.test(x, y, paired = TRUE) - expect_equal(effectsize(model), cohens_d(x, y, paired = TRUE), ignore_attr = TRUE) - model <- t.test(x, y, var.equal = TRUE) expect_equal(effectsize(model), cohens_d(x, y), ignore_attr = TRUE) @@ -36,7 +33,6 @@ test_that("t-test", { ignore_attr = TRUE ) - # one sample z <<- mtcars$wt model <- t.test(z, mu = 3, var.equal = TRUE) @@ -45,6 +41,23 @@ test_that("t-test", { ignore_attr = TRUE ) + ## Paired sample + model <- t.test(x, y, paired = TRUE) + expect_equal(effectsize(model, verbose = FALSE), cohens_d(x, y, paired = TRUE, verbose = FALSE), ignore_attr = TRUE) + + sleep2 <<- reshape(sleep, + direction = "wide", + idvar = "ID", timevar = "group" + ) + tt <- t.test(sleep2$extra.1, sleep2$extra.2, paired = TRUE) + + es1 <- effectsize(tt, type = "rm_b") + es2 <- rm_d(tt, method = "b") + es <- rm_d(sleep2$extra.1, sleep2$extra.2, method = "b") + expect_equal(es1, es, ignore_attr = TRUE) + expect_equal(es2, es, ignore_attr = TRUE) + + ## Missing y <<- rnorm(12) g <<- c(rep(letters[1:2], each = 5), NA, NA) diff --git a/tests/testthat/test-rm_d.R b/tests/testthat/test-rm_d.R new file mode 100644 index 00000000..af94290d --- /dev/null +++ b/tests/testthat/test-rm_d.R @@ -0,0 +1,126 @@ +test_that("rm_d | paired data", { + data("sleep") + sleep2 <- reshape(sleep, + direction = "wide", + idvar = "ID", timevar = "group" + ) + + d1 <- rm_d( + sleep$extra[sleep$group == 1], + sleep$extra[sleep$group == 2] + ) + d2 <- rm_d(Pair(extra.1, extra.2) ~ 1, data = sleep2) + expect_no_message(d3 <- rm_d(extra ~ group | ID, data = sleep)) + + expect_equal(d1, d2) + expect_equal(d1, d3) + + d_z <- rm_d(Pair(extra.1, extra.2) ~ 1, data = sleep2, method = "z") + d_z2 <- hedges_g(sleep$extra[sleep$group == 1] - sleep$extra[sleep$group == 2]) + + expect_equal(d_z[[1]], d_z2[[1]]) + expect_equal(d_z$CI_low, d_z2$CI_low, tolerance = 0.01) + expect_equal(d_z$CI_high, d_z2$CI_high, tolerance = 0.1) + + expect_error( + rm_d(Pair(extra.1, extra.2) ~ 1, data = sleep2, method = "r"), + regexp = "replications" + ) + + + # equal with equal variance: + dat <- data.frame( + V1 = c( + -0.32150435528124, -4.02978032779713, 0.159645811226589, + 1.95179927058772, 0.168527299289471, 3.4499229496418, + -1.87888939495506, 0.431333839911973, -0.26004200470096, + 0.328986912076835 + ), + V2 = c( + 2.50107579495566, -0.32926747002329, 4.01118960037018, + 1.44969284040984, -1.46241877172319, 1.25068499614667, + 0.028928469929524, 3.05532100575796, -1.67014771817319, + 3.16494125234984 + ) + ) + + d_rm <- rm_d("V1", "V2", data = dat, adjust = FALSE) + d_av <- rm_d("V1", "V2", data = dat, adjust = FALSE, method = "av") + d_b <- rm_d("V1", "V2", data = dat, adjust = FALSE, method = "b") + d_d <- rm_d("V1", "V2", data = dat, adjust = FALSE, method = "d") + + expect_equal(d_rm[[1]], d_d[[1]]) + expect_equal(d_av[[1]], d_d[[1]]) + expect_equal(d_b[[1]], d_d[[1]]) +}) + +test_that("rm_d | replication data", { + data("rouder2016") + + expect_message( + rm_d(rt ~ cond | id, data = rouder2016), + regexp = "requires paired data" + ) + expect_no_message( + rm_d(rt ~ cond | id, data = rouder2016, verbose = FALSE), + ) + expect_no_message( + rm_d(rt ~ cond | id, data = rouder2016, method = "d"), + ) + + d_av <- rm_d(rt ~ cond | id, + data = rouder2016, method = "av", + adjust = FALSE, verbose = FALSE + ) + d_z <- rm_d(rt ~ cond | id, + data = rouder2016, method = "z", + adjust = FALSE, verbose = FALSE + ) + d_d <- rm_d(rt ~ cond | id, + data = rouder2016, method = "d", + adjust = FALSE + ) + d_r <- rm_d(rt ~ cond | id, + data = rouder2016, method = "r", + adjust = FALSE + ) + + # values takes from + # https://jakewestfall.org/blog/index.php/2016/03/25/five-different-cohens-d-statistics-for-within-subject-designs/ + expect_equal(d_av[[1]], -0.8357347, tolerance = 0.001) + expect_equal(d_z[[1]], -1.353713, tolerance = 0.001) + expect_equal(d_d[[1]], -0.2497971, tolerance = 0.001) + expect_equal(d_r[[1]], -0.052298 / 0.20195, tolerance = 0.001) + + # also: + expect_equal(d_d[[1]], cohens_d(rt ~ cond, data = rouder2016)[[1]], tolerance = 0.001) + + rouder2016_wide <- tapply(rouder2016[["rt"]], rouder2016[1:2], mean, na.rm = TRUE) + d_z2 <- cohens_d(rouder2016_wide[, 1] - rouder2016_wide[, 2]) + expect_equal(d_z[[1]], d_z2[[1]]) + expect_equal(d_z$CI_low, d_z2$CI_low, tolerance = 0.02) + expect_equal(d_z$CI_high, d_z2$CI_high, tolerance = 0.02) + + d_rm <- rm_d(rt ~ cond | id, data = rouder2016, verbose = FALSE) + d_rm2 <- rm_d(rouder2016_wide[, 1], rouder2016_wide[, 2]) + expect_equal(d_rm2, d_rm) + + + # # compare CIs to lmeInfo::g_mlm + # mod1 <- nlme::lme(rt ~ cond, random = ~ cond | id, + # data = rouder2016, + # control = nlme::nlmeControl(opt = "nlm")) + # g_r <- lmeInfo::g_mlm(mod1, p_const = c(0, -1), r_const = c(0, 0, 0, 1)) + # g_r_ci <- lmeInfo::CI_g(g_r) + # g_d <- lmeInfo::g_mlm(mod1, p_const = c(0, -1), r_const = c(1, 1, 1, 1)) + # g_d_ci <- lmeInfo::CI_g(g_d) + + d_r2 <- rm_d(rt ~ cond | id, data = rouder2016, method = "r") + expect_equal(d_r2$CI_low, -0.342050038016442, tolerance = 0.05) + expect_equal(d_r2$CI_high, -0.17575096606632, tolerance = 0.05) + + + d_d2 <- rm_d(rt ~ cond | id, data = rouder2016, method = "d") + expect_equal(d_d2$CI_low, -0.329333102235032, tolerance = 0.05) + expect_equal(d_d2$CI_high, -0.168904897964021, tolerance = 0.05) +}) diff --git a/vignettes/standardized_differences.Rmd b/vignettes/standardized_differences.Rmd index a1aa33e1..a12288a8 100644 --- a/vignettes/standardized_differences.Rmd +++ b/vignettes/standardized_differences.Rmd @@ -105,7 +105,9 @@ hedges_g(mtcars$wt, mu = 2.7) ## Paired Samples -For paired-samples, the difference is standardized by the variation in the differences. This effect size, known as Cohen's $d_z$, represents the difference in terms of its homogeneity (a small but stable difference will have a large $d_z$). +In a repeated-measures design, the same subjects are measured in multiple conditions or time points. Unlike the case of independent groups, there are multiple sources of variation that can be used to standardized the differences between the means of the conditions / times, and each provides a unique standardized mean difference. + +The most basic option is compute from the paired samples difference scores and compute a one-sample effect size. This effect size, known as Cohen's $d_z$, represents the difference in terms of its homogeneity (a small but stable difference will have a large $d_z$). ```{r} sleep_wide <- datawizard::data_to_wide(sleep, @@ -117,9 +119,35 @@ sleep_wide <- datawizard::data_to_wide(sleep, t.test(sleep_wide[["extra_1"]], sleep_wide[["extra_2"]], paired = TRUE) -cohens_d(sleep_wide[["extra_1"]], sleep_wide[["extra_2"]], paired = TRUE) +repeated_measures_d(sleep_wide[["extra_1"]], sleep_wide[["extra_2"]], method = "z") + +# same as: +hedges_g(sleep_wide[["extra_1"]] - sleep_wide[["extra_2"]]) +``` + +Other options try to get close to the value that would have been reached if the samples were independant (see more info in the documentation of `repeated_measures_d()`): + +```{r} +repeated_measures_d(sleep_wide[["extra_1"]], sleep_wide[["extra_2"]]) + +repeated_measures_d(sleep_wide[["extra_1"]], sleep_wide[["extra_2"]], method = "av") + +repeated_measures_d(sleep_wide[["extra_1"]], sleep_wide[["extra_2"]], method = "b") + +repeated_measures_d(sleep_wide[["extra_1"]], sleep_wide[["extra_2"]], method = "d") + +# all closer to: +cohens_d(sleep_wide[["extra_1"]], sleep_wide[["extra_2"]], ci = NULL) +``` + +For data containing repetition in each condition/subject, another effect size (residual _d_) is also available: + +```{r} +data("rouder2016") + +head(rouder2016) -hedges_g(sleep_wide[["extra_1"]], sleep_wide[["extra_2"]], paired = TRUE) +repeated_measures_d(rt ~ cond | id, data = rouder2016, method = "r") ``` ## For a Bayesian *t*-test From 9b662516609c50f246f6e38a96ac87bc135e05b3 Mon Sep 17 00:00:00 2001 From: "Mattan S. Ben-Shachar" Date: Tue, 7 Nov 2023 10:05:57 +0200 Subject: [PATCH 4/7] quick typo fix --- R/repeated_measures_d.R | 2 +- man/repeated_measures_d.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/repeated_measures_d.R b/R/repeated_measures_d.R index 53fcace6..6db41967 100644 --- a/R/repeated_measures_d.R +++ b/R/repeated_measures_d.R @@ -49,7 +49,7 @@ #' standardizing by the variance in the of the control (or pre) condition, #' Cumming suggests standardizing by the average variance of the two paired #' conditions (Cumming, 2013, pp. 291). -#' - **All Variance: \eqn{d_{d}}** - This is the same as computing a standard +#' - **All Variance: Just \eqn{d}** - This is the same as computing a standard #' independent-groups Cohen's _d_ (Cohen, 1988). Note that CIs _do_ account for #' the dependence, and so are typically more narrow (see examples). #' - **Residual Variance: \eqn{d_{r}}** (_Requires data with replications_) - diff --git a/man/repeated_measures_d.Rd b/man/repeated_measures_d.Rd index e6d9e785..58a130a1 100644 --- a/man/repeated_measures_d.Rd +++ b/man/repeated_measures_d.Rd @@ -106,7 +106,7 @@ post-treatment setting, the pre-treatment condition). This is akin to Glass' standardizing by the variance in the of the control (or pre) condition, Cumming suggests standardizing by the average variance of the two paired conditions (Cumming, 2013, pp. 291). -\item \strong{All Variance: \eqn{d_{d}}} - This is the same as computing a standard +\item \strong{All Variance: Just \eqn{d}} - This is the same as computing a standard independent-groups Cohen's \emph{d} (Cohen, 1988). Note that CIs \emph{do} account for the dependence, and so are typically more narrow (see examples). \item \strong{Residual Variance: \eqn{d_{r}}} (\emph{Requires data with replications}) - From 3efc17eb5256ac99cb5291ed4803d07e8f5a2909 Mon Sep 17 00:00:00 2001 From: "Mattan S. Ben-Shachar" Date: Tue, 7 Nov 2023 10:14:19 +0200 Subject: [PATCH 5/7] another typo --- R/effectsize.R | 2 +- man/effectsize.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/effectsize.R b/R/effectsize.R index b0377c17..af80dc8b 100644 --- a/R/effectsize.R +++ b/R/effectsize.R @@ -14,7 +14,7 @@ #' #' - For an object of class `htest`, data is extracted via [insight::get_data()], and passed to the relevant function according to: #' - A **t-test** depending on `type`: `"cohens_d"` (default), `"hedges_g"`, or one of `"p_superiority"`, `"u1"`, `"u2"`, `"u3"`, `"overlap"`. -#' - For a **Paired t-test**: depending on `type`: `"rm"`, `"av"`, `"b"`, `"d"`, `"z"`. +#' - For a **Paired t-test**: depending on `type`: `"rm_rm"`, `"rm_av"`, `"rm_b"`, `"rm_d"`, `"rm_z"`. #' - A **Chi-squared tests of independence** or **Fisher's Exact Test**, depending on `type`: `"cramers_v"` (default), `"tschuprows_t"`, `"phi"`, `"cohens_w"`, `"pearsons_c"`, `"cohens_h"`, `"oddsratio"`, `"riskratio"`, `"arr"`, or `"nnt"`. #' - A **Chi-squared tests of goodness-of-fit**, depending on `type`: `"fei"` (default) `"cohens_w"`, `"pearsons_c"` #' - A **One-way ANOVA test**, depending on `type`: `"eta"` (default), `"omega"` or `"epsilon"` -squared, `"f"`, or `"f2"`. diff --git a/man/effectsize.Rd b/man/effectsize.Rd index 17acf96c..3fdaf561 100644 --- a/man/effectsize.Rd +++ b/man/effectsize.Rd @@ -50,7 +50,7 @@ input model. See details. \itemize{ \item A \strong{t-test} depending on \code{type}: \code{"cohens_d"} (default), \code{"hedges_g"}, or one of \code{"p_superiority"}, \code{"u1"}, \code{"u2"}, \code{"u3"}, \code{"overlap"}. \itemize{ -\item For a \strong{Paired t-test}: depending on \code{type}: \code{"rm"}, \code{"av"}, \code{"b"}, \code{"d"}, \code{"z"}. +\item For a \strong{Paired t-test}: depending on \code{type}: \code{"rm_rm"}, \code{"rm_av"}, \code{"rm_b"}, \code{"rm_d"}, \code{"rm_z"}. } \item A \strong{Chi-squared tests of independence} or \strong{Fisher's Exact Test}, depending on \code{type}: \code{"cramers_v"} (default), \code{"tschuprows_t"}, \code{"phi"}, \code{"cohens_w"}, \code{"pearsons_c"}, \code{"cohens_h"}, \code{"oddsratio"}, \code{"riskratio"}, \code{"arr"}, or \code{"nnt"}. \item A \strong{Chi-squared tests of goodness-of-fit}, depending on \code{type}: \code{"fei"} (default) \code{"cohens_w"}, \code{"pearsons_c"} From 8fdbfad67a82be3de5e39498032cf8ce50aea210 Mon Sep 17 00:00:00 2001 From: "Mattan S. Ben-Shachar" Date: Wed, 8 Nov 2023 20:36:57 +0200 Subject: [PATCH 6/7] fix nnt bug --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ R/xtab_diff.R | 2 +- tests/testthat/test-xtab.R | 8 ++++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5c10ce47..904a59c8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: effectsize Title: Indices of Effect Size -Version: 0.8.6.2 +Version: 0.8.6.3 Authors@R: c(person(given = "Mattan S.", family = "Ben-Shachar", diff --git a/NEWS.md b/NEWS.md index 05d6febf..bfd8f3f0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,10 @@ - `repeated_measures_d()` to compute standardized mean differences (SMD) for repeated measures data. - Also supported in `effectsize()` + +## Bug fixes + +- `nnt()` now properly accepts the `y` argument. # effectsize 0.8.7 diff --git a/R/xtab_diff.R b/R/xtab_diff.R index a80f6455..2346f85d 100644 --- a/R/xtab_diff.R +++ b/R/xtab_diff.R @@ -304,7 +304,7 @@ nnt <- function(x, y = NULL, ci = 0.95, alternative = "two.sided", ...) { return(effectsize(x, type = "nnt", ci = ci, ...)) } - out <- arr(x, y = t, ci = ci, alternative = alternative2, ...) + out <- arr(x, y = y, ci = ci, alternative = alternative2, ...) out[[1]] <- 1 / out[[1]] colnames(out)[1] <- "NNT" diff --git a/tests/testthat/test-xtab.R b/tests/testthat/test-xtab.R index aaa9bbb6..667127cb 100644 --- a/tests/testthat/test-xtab.R +++ b/tests/testthat/test-xtab.R @@ -200,6 +200,14 @@ test_that("oddsratio & riskratio", { expect_equal(ARR[[1]], -0.4891775, tolerance = 0.001) expect_equal(ARR$CI_low, -0.8092576, tolerance = 0.001) expect_equal(ARR$CI_high, -0.1690974, tolerance = 0.001) + + # fix + set.seed(111) + x <- rbinom(10, 1, 0.5) + y <- rbinom(10, 1, 0.5) + + expect_no_error(NNT <- nnt(x, y)) + expect_equal(NNT[[1]], arr_to_nnt(arr(x, y)[[1]])) }) From 8b5636fbb2df90b9040e51eb55a05927f425b7d1 Mon Sep 17 00:00:00 2001 From: "Mattan S. Ben-Shachar" Date: Tue, 5 Dec 2023 13:10:07 +0200 Subject: [PATCH 7/7] fix #622 --- DESCRIPTION | 2 +- R/utils_validate_input_data.R | 2 +- tests/testthat/test-rm_d.R | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 904a59c8..74feca8e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: effectsize Title: Indices of Effect Size -Version: 0.8.6.3 +Version: 0.8.6.4 Authors@R: c(person(given = "Mattan S.", family = "Ben-Shachar", diff --git a/R/utils_validate_input_data.R b/R/utils_validate_input_data.R index 3002ece0..0aa5e2f1 100644 --- a/R/utils_validate_input_data.R +++ b/R/utils_validate_input_data.R @@ -126,7 +126,7 @@ return(mf) } - if (verbose && any(tapply(mf[[1]], mf[3:2], length) > 1L)) { + if (verbose && any(tapply(mf[[1]], mf[3:2], length) > 1L, na.rm = TRUE)) { insight::format_alert( paste0("The ", method, " standardized difference requires paired data,"), "but data contains more than one observation per design cell.", diff --git a/tests/testthat/test-rm_d.R b/tests/testthat/test-rm_d.R index af94290d..ed0c09e2 100644 --- a/tests/testthat/test-rm_d.R +++ b/tests/testthat/test-rm_d.R @@ -27,6 +27,12 @@ test_that("rm_d | paired data", { regexp = "replications" ) + sleep[1, "extra"] <- NA + sleep2[1, "extra.1"] <- NA + expect_no_error(d1NA <- rm_d(extra ~ group | ID, data = sleep)) + expect_no_error(d2NA <- rm_d(Pair(extra.1, extra.2) ~ 1, data = sleep2)) + expect_equal(d1NA, d2NA) + # equal with equal variance: dat <- data.frame(