Size does matter
The goal of this package is to provide utilities to work with indices of effect size and standardized parameters, allowing computation and conversion of indices such as Cohen’s d, r, odds-ratios, etc.
Run the following to install the latest GitHub-version of effectsize
:
Or install the latest stable release from CRAN:
Click on the buttons above to access the package documentation and the easystats blog, and check-out these vignettes:
This package is focused on indices of effect size. But there are hundreds of them! Thus, everybody is welcome to contribute by adding support for the interpretation of new indices. If you’re not sure how to code it’s okay, just open an issue to discuss it and we’ll help :)
The package provides functions to compute indices of effect size.
cohens_d(iris$Sepal.Length, iris$Sepal.Width)
## Cohen's d | 95% CI
## ------------------------
## 4.21 | [3.80, 4.61]
hedges_g(iris$Sepal.Length, iris$Sepal.Width)
## Hedge's g | 95% CI
## ------------------------
## 4.20 | [3.79, 4.60]
glass_delta(iris$Sepal.Length, iris$Sepal.Width)
## Glass' delta | 95% CI
## ---------------------------
## 6.39 | [5.83, 6.95]
model <- aov(Sepal.Length ~ Species, data = iris)
omega_squared(model)
## Parameter | Omega2 (partial) | 90% CI
## -------------------------------------------
## Species | 0.61 | [0.53, 0.67]
eta_squared(model)
## Parameter | Eta2 (partial) | 90% CI
## -----------------------------------------
## Species | 0.62 | [0.54, 0.68]
epsilon_squared(model)
## Parameter | Epsilon2 (partial) | 90% CI
## ---------------------------------------------
## Species | 0.61 | [0.54, 0.67]
cohens_f(model)
## Parameter | Cohen's f (partial) | 90% CI
## ----------------------------------------------
## Species | 1.27 | [1.09, 1.45]
Importantly, effectsize
also provides advanced methods to compute standardized parameters for regression models.
lm(Sepal.Length ~ Species + Sepal.Length, data = iris) %>%
standardize_parameters()
## Parameter | Coefficient (std.) | 95% CI
## -------------------------------------------------------
## (Intercept) | -1.01 | [-1.18, -0.84]
## Speciesversicolor | 1.12 | [ 0.88, 1.37]
## Speciesvirginica | 1.91 | [ 1.66, 2.16]
The package allows for an automated interpretation of different indices.
Different sets of “rules of thumb” are implemented (guidelines are detailed here) and can be easily changed.
interpret_d(d = 0.45, rules = "cohen1988")
## [1] "small"
interpret_d(d = 0.45, rules = "funder2019")
## [1] "medium"
The package also provides ways of converting between different effect sizes.
Many indices of effect size stem out, or are related, to standardization. Thus, it is expected that effectsize
provides functions to standardize data and models.
A standardization sets the mean and SD to 0 and 1:
library(parameters)
df <- standardize(iris)
describe_distribution(df$Sepal.Length)
## Mean | SD | IQR | Range | Skewness | Kurtosis | n | n_Missing
## -----------------------------------------------------------------------------
## -4.48e-16 | 1 | 1.57 | [-1.86, 2.48] | 0.31 | -0.55 | 150 | 0
This can be also applied to statistical models:
std_model <- standardize(lm(Sepal.Length ~ Species, data = iris))
coef(std_model)
## (Intercept) Speciesversicolor Speciesvirginica
## -1.01 1.12 1.91
Alternatively, normalization is similar to standardization in that it is a linear translation of the parameter space (i.e., it does not change the shape of the data distribution). However, it puts the values within a 0 - 1 range, which can be useful in cases where you want to compare or visualise data on the same scale.
df <- normalize(iris)
describe_distribution(df$Sepal.Length)
## Mean | SD | IQR | Range | Skewness | Kurtosis | n | n_Missing
## -------------------------------------------------------------------------
## 0.43 | 0.23 | 0.36 | [0.00, 1.00] | 0.31 | -0.55 | 150 | 0
This is a special case of a rescaling function, which can be used to rescale the data to an arbitrary new scale. Let’s change all numeric variables to “percentages”:
df <- change_scale(iris, to = c(0, 100))
describe_distribution(df$Sepal.Length)
## Mean | SD | IQR | Range | Skewness | Kurtosis | n | n_Missing
## ------------------------------------------------------------------------------
## 42.87 | 23.00 | 36.11 | [0.00, 100.00] | 0.31 | -0.55 | 150 | 0
For some robust statistics, one might also want to transfom the numeric values into ranks (or signed-ranks), which can be performed using the ranktransform()
function.