Skip to content

Commit

Permalink
CRAN 0.8.3 (#558)
Browse files Browse the repository at this point in the history
* version bump

* .eval_if_requireNamespace

* Update from_test_statistics.Rmd

* Update cran-comments.md
  • Loading branch information
mattansb authored Jan 28, 2023
1 parent 13b46a6 commit 566cfda
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 58 deletions.
14 changes: 7 additions & 7 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
Version: 0.8.2.10
Version: 0.8.3
Authors@R:
c(person(given = "Mattan S.",
family = "Ben-Shachar",
Expand Down Expand Up @@ -67,15 +67,15 @@ Depends:
R (>= 3.6)
Imports:
bayestestR (>= 0.13.0),
insight (>= 0.18.4),
parameters (>= 0.19.0),
performance (>= 0.10.0),
datawizard (>= 0.6.2),
insight (>= 0.18.8),
parameters (>= 0.20.2),
performance (>= 0.10.2),
datawizard (>= 0.6.5),
stats,
utils
Suggests:
correlation (>= 0.8.2),
see (>= 0.7.3),
correlation (>= 0.8.3),
see (>= 0.7.4),
afex,
BayesFactor,
boot,
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# effectsize 0.8.2.xxx
# effectsize 0.8.3

## Changes

Expand Down
24 changes: 10 additions & 14 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
All URL issues have been resolved.
DOI issues are a false positive.
## Known issues

- Failed handshake with *shinyapps.io* is a false positive.
- Unavailable DOI link are false positives.
- Spelling mistakes are false positives.

## Test environments

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


Expand All @@ -16,16 +19,9 @@ DOI issues are a false positive.
0 errors | 0 warnings | 0 notes


### Known issues

- Failed handshake with *shinyapps.io* is a false positive.
- Unavailable DOI link are false positives.
- Spelling mistakes are false positives.


## revdepcheck results

We checked 18 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.
We checked 19 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
Expand Down
34 changes: 15 additions & 19 deletions vignettes/anovaES.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ options(digits = 2)
knitr::opts_chunk$set(comment = ">", warning = FALSE)
set.seed(1)
pkgs <- c("effectsize", "afex")
knitr::opts_chunk$set(eval = all(sapply(pkgs, requireNamespace, quietly = TRUE)))
.eval_if_requireNamespace <- function(...) {
pkgs <- c(...)
knitr::opts_chunk$get("eval") && all(sapply(pkgs, requireNamespace, quietly = TRUE))
}
knitr::opts_chunk$set(eval = .eval_if_requireNamespace("effectsize", "afex"))
```

## Eta<sup>2</sup>
Expand Down Expand Up @@ -112,7 +118,7 @@ is common to use "simultaneous" sums of squares (*type-II* or *type-III* tests),
where each *SS* is computed controlling for all other predictors, regardless of
order. This can be done with `car::Anova(type = ...)`:

```{r, eval=requireNamespace("car", quietly = TRUE)}
```{r, eval=.eval_if_requireNamespace("car")}
eta_squared(car::Anova(m, type = 2), partial = FALSE)
eta_squared(car::Anova(m, type = 3)) # partial = TRUE by default
Expand All @@ -138,7 +144,7 @@ for factors this can be done by using orthogonal coding (such as `contr.sum` for
This unfortunately makes parameter interpretation harder, but *only* when this is does do the *SS*s associated with each lower-order term (or lower-order interaction) represent the ***SS*** of the **main effect** (with treatment coding they represent the *SS* of the simple effects).


```{r, eval=requireNamespace("car", quietly = TRUE)}
```{r, eval=.eval_if_requireNamespace("car")}
# compare
m_interaction1 <- lm(value ~ treatment * gender, data = obk.long)
Expand Down Expand Up @@ -233,12 +239,7 @@ always the case.

For example, in linear mixed models (LMM/HLM/MLM), the estimation of all required *SS*s is not straightforward. However, we can still *approximate* these effect sizes (only their partial versions) based on the **test-statistic approximation method** (learn more in the [*Effect Size from Test Statistics* vignette](https://easystats.github.io/effectsize/articles/from_test_statistics.html)).

```{r, echo = FALSE, eval=TRUE}
lmm_pkgs <- c("lmerTest", "lme4")
eval_lmm <- all(sapply(lmm_pkgs, requireNamespace, quietly = TRUE))
```

```{r, eval=eval_lmm}
```{r, eval=.eval_if_requireNamespace("lmerTest", "lme4")}
library(lmerTest)
fit_lmm <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
Expand All @@ -251,7 +252,7 @@ F_to_eta2(45.8, df = 1, df_error = 17)
Or directly with `eta_squared() and co.:


```{r, eval=eval_lmm}
```{r, eval=.eval_if_requireNamespace("lmerTest", "lme4")}
eta_squared(fit_lmm)
epsilon_squared(fit_lmm)
omega_squared(fit_lmm)
Expand All @@ -277,14 +278,9 @@ model!** So it is vital to [validate the
PPD](https://mc-stan.org/docs/2_23/stan-users-guide/meta-models-part.html#meta-models.part/)
before using it to estimate explained variance measures.

```{r, echo = FALSE, eval=TRUE}
bayes_pkgs <- c("rstanarm", "bayestestR", "car")
eval_bayes <- all(sapply(bayes_pkgs, requireNamespace, quietly = TRUE))
```

Let's fit our model:

```{r, eval = eval_bayes}
```{r, eval = .eval_if_requireNamespace("rstanarm", "bayestestR", "car")}
library(rstanarm)
m_bayes <- stan_glm(value ~ gender + phase + treatment,
Expand All @@ -297,7 +293,7 @@ We can use `eta_squared_posterior()` to get the posterior distribution of
$eta^2$ or $eta^2_p$ for each effect. Like an ANOVA table, we must make sure to
use the right effects-coding and *SS*-type:

```{r, eval = eval_bayes}
```{r, eval = .eval_if_requireNamespace("rstanarm", "bayestestR", "car")}
pes_posterior <- eta_squared_posterior(m_bayes,
draws = 500, # how many samples from the PPD?
partial = TRUE, # partial eta squared
Expand All @@ -315,7 +311,7 @@ bayestestR::describe_posterior(pes_posterior,

Compare to:

```{r, eval = eval_bayes}
```{r, eval = .eval_if_requireNamespace("rstanarm", "bayestestR", "car")}
m_ML <- lm(value ~ gender + phase + treatment, data = obk.long)
eta_squared(car::Anova(m_ML, type = 3))
Expand Down
9 changes: 7 additions & 2 deletions vignettes/convert_r_d_OR.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ library(knitr)
options(knitr.kable.NA = "")
knitr::opts_chunk$set(comment = ">")
options(digits = 3)
.eval_if_requireNamespace <- function(...) {
pkgs <- c(...)
knitr::opts_chunk$get("eval") && all(sapply(pkgs, requireNamespace, quietly = TRUE))
}
```

The `effectsize` package contains function to convert among indices of effect
Expand Down Expand Up @@ -48,7 +53,7 @@ cohens_d(salary ~ is_senior, data = hardlyworking)

But we can also compute a point-biserial correlation, which is Pearson's *r* when treating the 2-level `is_senior` variable as a numeric binary variable:

```{r, warning=FALSE, eval=requireNamespace("correlation", quietly = TRUE)}
```{r, warning=FALSE, eval=.eval_if_requireNamespace("correlation")}
correlation::cor_test(hardlyworking, "salary", "is_senior")
```

Expand Down Expand Up @@ -91,7 +96,7 @@ t_to_d(5.31, df_error = 497)[[1]]
We can convert these semi-*d* values to *r* values, but in this case these
represent the *partial* correlation:

```{r, eval=requireNamespace("correlation", quietly = TRUE)}
```{r, eval=.eval_if_requireNamespace("correlation")}
t_to_r(5.31, df_error = 497)
correlation::correlation(hardlyworking[, c("salary", "xtra_hours", "is_senior")],
Expand Down
27 changes: 16 additions & 11 deletions vignettes/from_test_statistics.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ options(digits = 2)
options(knitr.kable.NA = "")
set.seed(747)
.eval_if_requireNamespace <- function(...) {
pkgs <- c(...)
knitr::opts_chunk$get("eval") && all(sapply(pkgs, requireNamespace, quietly = TRUE))
}
```

# Introduction
Expand Down Expand Up @@ -63,7 +68,7 @@ The conversion of the $F$- or $t$-statistic is based on

Let's look at an example:

```{r, eval = requireNamespace("afex", quietly = TRUE), message=FALSE}
```{r, eval = .eval_if_requireNamespace("afex"), message=FALSE}
library(afex)
data(md_12.1)
Expand Down Expand Up @@ -105,7 +110,7 @@ For example:

### In Simple Effect and Contrast Analysis

```{r, eval = requireNamespace("afex", quietly = TRUE) && requireNamespace("emmeans", quietly = TRUE)}
```{r, eval = .eval_if_requireNamespace("afex", "emmeans")}
library(emmeans)
joint_tests(aov_fit, by = "noise")
Expand All @@ -119,7 +124,7 @@ F_to_eta2(

We can also use `t_to_eta2()` for contrast analysis:

```{r, eval = requireNamespace("afex", quietly = TRUE) && requireNamespace("emmeans", quietly = TRUE)}
```{r, eval = .eval_if_requireNamespace("afex", "emmeans")}
pairs(emmeans(aov_fit, ~angle))
t_to_eta2(
Expand All @@ -130,7 +135,7 @@ t_to_eta2(

### In Linear Mixed Models

```{r, eval = requireNamespace("lmerTest", quietly = TRUE), message=FALSE}
```{r, eval = .eval_if_requireNamespace("lmerTest"), message=FALSE}
library(lmerTest)
fit_lmm <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
Expand All @@ -143,7 +148,7 @@ F_to_eta2(45.8, 1, 17)
We can also use `t_to_eta2()` for the slope of `Days` (which in this case gives
the same result).

```{r, eval = requireNamespace("lmerTest", quietly = TRUE)}
```{r, eval = .eval_if_requireNamespace("lmerTest")}
parameters::model_parameters(fit_lmm, effects = "fixed", ci_method = "satterthwaite")
t_to_eta2(6.77, df_error = 17)
Expand Down Expand Up @@ -171,7 +176,7 @@ better).

### For Slopes

```{r, eval = requireNamespace("lmerTest", quietly = TRUE)}
```{r, eval = .eval_if_requireNamespace("lmerTest")}
parameters::model_parameters(fit_lmm, effects = "fixed", ci_method = "satterthwaite")
t_to_r(6.77, df_error = 17)
Expand All @@ -193,7 +198,7 @@ t_to_r(

to:

```{r, eval=require(correlation, quietly = TRUE)}
```{r, eval=.eval_if_requireNamespace("correlation")}
correlation::correlation(attitude,
select = "rating",
select2 = c("complaints", "critical"),
Expand All @@ -206,7 +211,7 @@ correlation::correlation(attitude,
This measure is also sometimes used in contrast analysis, where it is called the
point bi-serial correlation - $r_{pb}$ [@cohen1965some; @rosnow2000contrasts]:

```{r, eval = requireNamespace("afex", quietly = TRUE) && requireNamespace("emmeans", quietly = TRUE)}
```{r, eval = .eval_if_requireNamespace("afex", "emmeans")}
pairs(emmeans(aov_fit, ~angle))
t_to_r(
Expand All @@ -226,7 +231,7 @@ These can be useful in contrast analyses.

### Between-Subject Contrasts

```{r, eval = requireNamespace("emmeans", quietly = TRUE)}
```{r, eval = .eval_if_requireNamespace("emmeans")}
m <- lm(breaks ~ tension, data = warpbreaks)
em_tension <- emmeans(m, ~tension)
Expand All @@ -242,13 +247,13 @@ However, these are merely approximations of a *true* Cohen's *d*. It is advised
to directly estimate Cohen's *d*, whenever possible. For example, here with
`emmeans::eff_size()`:

```{r, eval = requireNamespace("emmeans", quietly = TRUE)}
```{r, eval = .eval_if_requireNamespace("emmeans")}
eff_size(em_tension, sigma = sigma(m), edf = df.residual(m))
```

### Within-Subject Contrasts

```{r, eval = requireNamespace("afex", quietly = TRUE) && requireNamespace("emmeans", quietly = TRUE)}
```{r, eval = .eval_if_requireNamespace("afex", "emmeans")}
pairs(emmeans(aov_fit, ~angle))
t_to_d(
Expand Down
9 changes: 7 additions & 2 deletions vignettes/standardized_differences.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ knitr::opts_chunk$set(comment = ">")
options(digits = 3)
set.seed(7)
.eval_if_requireNamespace <- function(...) {
pkgs <- c(...)
knitr::opts_chunk$get("eval") && all(sapply(pkgs, requireNamespace, quietly = TRUE))
}
```

This vignette provides a review of effect sizes for comparisons of groups, which
Expand Down Expand Up @@ -115,7 +120,7 @@ hedges_g(extra ~ group, data = sleep, paired = TRUE)
A Bayesian estimate of Cohen's *d* can also be provided based on `BayesFactor`'s
version of a *t*-test via the `effectsize()` function:

```{r, eval = requireNamespace("BayesFactor", quietly = TRUE), message=FALSE}
```{r, eval = .eval_if_requireNamespace("BayesFactor"), message=FALSE}
library(BayesFactor)
BFt <- ttestBF(formula = mpg ~ am, data = mtcars)
Expand Down Expand Up @@ -310,7 +315,7 @@ A Bayesian estimate of (the parametric version of) these effect sizes can also
be provided based on `BayesFactor`'s version of a *t*-test via the
`effectsize()` function:

```{r, eval = requireNamespace("BayesFactor", quietly = TRUE)}
```{r, eval = .eval_if_requireNamespace("BayesFactor")}
effectsize(BFt, type = "p_superiority")
effectsize(BFt, type = "u1")
Expand Down
9 changes: 7 additions & 2 deletions vignettes/xtabs.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ knitr::opts_chunk$set(comment = ">")
options(digits = 3)
set.seed(7)
.eval_if_requireNamespace <- function(...) {
pkgs <- c(...)
knitr::opts_chunk$get("eval") && all(sapply(pkgs, requireNamespace, quietly = TRUE))
}
```

This vignette provides a review of effect sizes for 1- and 2-D contingency
Expand Down Expand Up @@ -104,7 +109,7 @@ cohens_w(Music_preferences2) # > 1
A Bayesian estimate of these effect sizes can also be provided based on
`BayesFactor`'s version of a $\chi^2$-test via the `effectsize()` function:

```{r, eval = requireNamespace("BayesFactor", quietly = TRUE), message=FALSE}
```{r, eval = .eval_if_requireNamespace("BayesFactor"), message=FALSE}
library(BayesFactor)
BFX <- contingencyTableBF(MPG_Gear, sampleType = "jointMulti")
Expand Down Expand Up @@ -194,7 +199,7 @@ cohens_h(RCT_table)
A Bayesian estimate of these effect sizes can also be provided based on
`BayesFactor`'s version of a $\chi^2$-test via the `effectsize()` function:

```{r, eval = requireNamespace("BayesFactor", quietly = TRUE)}
```{r, eval = .eval_if_requireNamespace("BayesFactor")}
BFX <- contingencyTableBF(RCT_table, sampleType = "jointMulti")
effectsize(BFX, type = "or")
Expand Down

0 comments on commit 566cfda

Please sign in to comment.