Skip to content

Commit

Permalink
Cran 0.7.0.5 (#465)
Browse files Browse the repository at this point in the history
## Breaking Changes

`effectsize` now requires minimal *`R`* version of `3.5`.

## Bug fixes

- `cohens_d()` for paired / one sample now gives more accurate CIs (was off by a factor of `(N - 1) / N`; #457)
- `kendalls_w()` now deals correctly with singular ties (#448).
  • Loading branch information
mattansb authored Aug 10, 2022
1 parent bee3d96 commit 114d9de
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 57 deletions.
12 changes: 3 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: effectsize
Title: Indices of Effect Size and Standardized Parameters
Version: 0.7.0.1
Version: 0.7.0.5
Authors@R:
c(person(given = "Mattan S.",
family = "Ben-Shachar",
Expand Down Expand Up @@ -59,16 +59,10 @@ Imports:
bayestestR (>= 0.12.1),
insight (>= 0.18.0),
parameters (>= 0.18.1),
performance (>= 0.9.0),
datawizard (>= 0.4.1.10),
performance (>= 0.9.1),
datawizard (>= 0.5.0),
stats,
utils
Remotes:
easystats/datawizard,
easystats/parameters,
easystats/performance,
easystats/correlation,
easystats/bayestestR
Suggests:
correlation (>= 0.8.1),
see (>= 0.7.1),
Expand Down
9 changes: 2 additions & 7 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
# effectsize 0.7.1.9990

## Bug fixes

- `cohens_d()` for paired / one sample now gives more accurate CIs (was off by a factor of `(N - 1) / N`; #457)

# effectsize 0.7.0.9
# effectsize 0.7.0.5

## Breaking Changes

`effectsize` now requires minimal *`R`* version of `3.5`.

## Bug fixes

- `cohens_d()` for paired / one sample now gives more accurate CIs (was off by a factor of `(N - 1) / N`; #457)
- `kendalls_w()` now deals correctly with singular ties (#448).

# effectsize 0.7.0
Expand Down
18 changes: 11 additions & 7 deletions R/effectsize.htest.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ effectsize.htest <- function(model, type = NULL, verbose = TRUE, ...) {
args <- list(
t = unname(model$statistic),
df_error = unname(model$parameter),
paired = !grepl("Two", model$method)
paired = !grepl("Two", model$method),
verbose = verbose
)
} else {
if (grepl(" by ", model$data.name, fixed = TRUE)) {
Expand Down Expand Up @@ -144,6 +145,7 @@ effectsize.htest <- function(model, type = NULL, verbose = TRUE, ...) {
nrow = nr,
ncol = nc,
p = p,
verbose = verbose,
...
)
} else {
Expand Down Expand Up @@ -198,6 +200,7 @@ effectsize.htest <- function(model, type = NULL, verbose = TRUE, ...) {
f = model$statistic,
df = model$parameter[1],
df_error = model$parameter[2],
verbose = verbose,
...
)
colnames(out)[1] <- sub("_partial", "", colnames(out)[1])
Expand All @@ -216,9 +219,9 @@ effectsize.htest <- function(model, type = NULL, verbose = TRUE, ...) {
.fail_if_approx(approx, "cohens_g")

if (inherits(data, "table")) {
out <- cohens_g(data, ...)
out <- cohens_g(data, verbose = verbose, ...)
} else {
out <- cohens_g(data[[1]], data[[2]], ...)
out <- cohens_g(data[[1]], data[[2]], verbose = verbose, ...)
}
out
}
Expand Down Expand Up @@ -251,7 +254,8 @@ effectsize.htest <- function(model, type = NULL, verbose = TRUE, ...) {
args <- list(
x = data[[1]],
y = if (ncol(data) == 2) data[[2]],
paired = grepl("signed rank", model$method, fixed = TRUE)
paired = grepl("signed rank", model$method, fixed = TRUE),
verbose = verbose
)

if (type == "cles") {
Expand All @@ -278,10 +282,10 @@ effectsize.htest <- function(model, type = NULL, verbose = TRUE, ...) {


if (inherits(data, "data.frame")) {
out <- rank_epsilon_squared(data[[1]], data[[2]], ...)
out <- rank_epsilon_squared(data[[1]], data[[2]], verbose = verbose, ...)
} else {
# data frame
out <- rank_epsilon_squared(data, ...)
out <- rank_epsilon_squared(data, verbose = verbose, ...)
}
out
}
Expand All @@ -300,7 +304,7 @@ effectsize.htest <- function(model, type = NULL, verbose = TRUE, ...) {
data <- as.data.frame(data)[c("Freq", "Var2", "Var1")]
}

out <- kendalls_w(data[[1]], data[[2]], data[[3]], ...)
out <- kendalls_w(data[[1]], data[[2]], data[[3]], verbose = verbose, ...)
out
}

Expand Down
19 changes: 9 additions & 10 deletions R/eta_squared.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@
#' epsilon_squared(model)
#' cohens_f(model)
#'
#' if (require(see)) plot(eta2)
#'
#' model0 <- aov(mpg ~ am_f + cyl_f, data = mtcars) # no interaction
#' cohens_f_squared(model0, model2 = model)
#'
Expand All @@ -125,7 +123,10 @@
#'
#' interpret(eta2, rules = "cohen1992")
#'
#' @examplesIf require("car") && require("afex")
#' @examplesIf require("see") && FALSE
#' plot(eta2) # Requires the {see} package
#'
#' @examplesIf require("car")
#' # Recommended: Type-2 or -3 effect sizes + effects coding
#' # -------------------------------------------------------
#' contrasts(mtcars$am_f) <- contr.sum
Expand All @@ -134,28 +135,27 @@
#' model <- aov(mpg ~ am_f * cyl_f, data = mtcars)
#' model_anova <- car::Anova(model, type = 3)
#'
#' eta_squared(model_anova)
#' epsilon_squared(model_anova)
#'
#' @examplesIf require("car") && require("afex")
#' # afex takes care of both type-3 effects and effects coding:
#' data(obk.long, package = "afex")
#' model <- afex::aov_car(value ~ treatment * gender + Error(id / (phase)),
#' data = obk.long, observed = "gender"
#' )
#' eta_squared(model)
#' epsilon_squared(model)
#'
#' omega_squared(model)
#' eta_squared(model, generalized = TRUE) # observed vars are pulled from the afex model.
#'
#' @examplesIf require("lmerTest") && require("lme4")
#' @examplesIf require("lmerTest") && require("lme4") && FALSE
#' ## Approx. effect sizes for mixed models
#' ## -------------------------------------
#' model <- lme4::lmer(mpg ~ am_f * cyl_f + (1 | vs), data = mtcars)
#' omega_squared(model)
#'
#' @examplesIf require(rstanarm) && require(bayestestR) && require(car)
#' @examplesIf require(rstanarm) && require(bayestestR) && require(car) && FALSE
#' ## Bayesian Models (PPD)
#' ## ---------------------
#' \dontrun{
#' fit_bayes <- rstanarm::stan_glm(
#' mpg ~ factor(cyl) * wt + qsec,
#' data = mtcars, family = gaussian(),
Expand All @@ -175,7 +175,6 @@
#' )
#' aov_table <- car::Anova(fit_freq, type = 3)
#' eta_squared(aov_table)
#' }
#'
#' @return A data frame containing the effect size values and their confidence
#' intervals.
Expand Down
3 changes: 1 addition & 2 deletions R/interpret_bf.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
#' Sociological methodology, 25, 111-164.
#'
#' - Jarosz, A. F., & Wiley, J. (2014). What are the odds? A practical guide to
#' computing and reporting Bayes factors. The Journal of Problem Solving, 7(1),
#' 2.
#' computing and reporting Bayes factors. The Journal of Problem Solving, 7(1), 2.
#'
#' @export
interpret_bf <- function(bf,
Expand Down
9 changes: 5 additions & 4 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
All URL issues have been resolved.
DOI issues are a false positive.

## Test environments

* local installation: R 4.1.1 on Windows
* local installation: R 4.2.1 on Windows
* GitHub Actions
- Windows: devel, release, oldrel
- macOS: devel, release, oldrel
- ubuntu-16.04: devel, release, oldrel, 4.0, 3.6, 3.5
- macOS: devel, release, oldrel, 4.0, 3.6, 3.5
- ubuntu-18.04: devel, release, oldrel
* win-builder: release


Expand All @@ -23,7 +24,7 @@ All URL issues have been resolved.

## revdepcheck results

We checked 17 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.
We checked 16 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.

* We saw 0 new problems
* We failed to check 0 packages
21 changes: 10 additions & 11 deletions man/eta_squared.Rd

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

5 changes: 1 addition & 4 deletions man/interpret_bf.Rd

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

5 changes: 3 additions & 2 deletions tests/testthat/test-effectsize.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ if (require("testthat") && require("effectsize")) {
)
)
ft <- friedman.test(RoundingTimes)
expect_equal(effectsize(ft)[[1]], W <- kendalls_w(RoundingTimes)[[1]], ignore_attr = TRUE)
expect_equal(kendalls_w(ft)[[1]], W, ignore_attr = TRUE)
W <- kendalls_w(RoundingTimes, verbose = FALSE, ci = NULL)
expect_equal(effectsize(ft, verbose = FALSE, ci = NULL), W, ignore_attr = TRUE)
expect_equal(kendalls_w(ft, verbose = FALSE, ci = NULL), W, ignore_attr = TRUE)

X <<- c(2.9, 3.0, 2.5, 2.6, 3.2) # normal subjects
Y <<- c(3.8, 2.7, 4.0, 2.4) # with obstructive airway disease
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-rankES.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ if (require("testthat") && require("effectsize")) {
)
dat

W <- kendalls_w(mrt ~ interaction(condition, congruency) | pno, data = dat)
W <- kendalls_w(mrt ~ interaction(condition, congruency) | pno, data = dat, verbose = FALSE)
expect_equal(W[[1]], 0.4011, tolerance = 0.01)


Expand Down

0 comments on commit 114d9de

Please sign in to comment.