diff --git a/DESCRIPTION b/DESCRIPTION index 833a41b74..e22cb4f61 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: effectsize Title: Indices of Effect Size and Standardized Parameters -Version: 0.6.0.7 +Version: 0.7.0 Authors@R: c(person(given = "Mattan S.", family = "Ben-Shachar", @@ -56,11 +56,11 @@ BugReports: https://github.com/easystats/effectsize/issues/ Depends: R (>= 3.4) Imports: - bayestestR (>= 0.11.5.1), - insight (>= 0.16.0.16), - parameters (>= 0.17.0.10), - performance (>= 0.8.0.8), - datawizard (>= 0.4.0.17), + bayestestR (>= 0.12.1), + insight (>= 0.17.0), + parameters (>= 0.18.0), + performance (>= 0.9.0), + datawizard (>= 0.4.1), stats, utils Suggests: @@ -91,17 +91,11 @@ Suggests: spelling, testthat, tidymodels -Remotes: - easystats/insight, - easystats/performance, - easystats/parameters, - easystats/datawizard, - easystats/bayestestR VignetteBuilder: knitr Encoding: UTF-8 Language: en-US Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.0 Config/testthat/edition: 3 Config/testthat/parallel: true diff --git a/NAMESPACE b/NAMESPACE index e8e45868b..2f38db059 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -16,7 +16,6 @@ S3method(eta_squared_posterior,brmsfit) S3method(eta_squared_posterior,stanreg) S3method(format,effectsize_anova) S3method(format,effectsize_difference) -S3method(format,effectsize_std_params) S3method(format,effectsize_table) S3method(format,equivalence_test_effectsize) S3method(format,rules) diff --git a/NEWS.md b/NEWS.md index a8375028d..fa123fc87 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,16 +1,11 @@ -# effectsize 0.6.0.3 +# effectsize 0.7.0 ## Breaking Changes -- `standardize_parameters()`, `standardize_posteriors()`, & `standardize_info()` have been moved to the `parameters` package. -- `standardize()` (for models) has been moved to the `datawizard` package. -- `phi()` only works for 2x2 tables. -- `cramers_v()` only works for 2D tables. - -## Bug fixes - -- `kendalls_w()` now deals with ties. -- `eta_squared()` works with `car::Manova()` that does not have an i-design. +- **`standardize_parameters()`, `standardize_posteriors()`, & `standardize_info()` have been moved to the `parameters` package.** +- **`standardize()` (for models) has been moved to the `datawizard` package.** +- `phi()` only works for 2x2 tables. +- `cramers_v()` only works for 2D tables. ## New features @@ -18,6 +13,11 @@ - `cohens_w()` is now a fully-fledged function for x-tables and goodness-of-fit effect size (not just an alias for `phi()`). - Support for `insight`'s `display`, `print_md` and `print_html` for all `{effectsize}` outputs. +## Bug fixes + +- `kendalls_w()` now deals with ties. +- `eta_squared()` works with `car::Manova()` that does not have an i-design. + # effectsize 0.6.0.1 *This is a patch release.* diff --git a/R/print.effectsize_table.R b/R/print.effectsize_table.R index c5c7d9d33..e44c5e7d1 100644 --- a/R/print.effectsize_table.R +++ b/R/print.effectsize_table.R @@ -189,33 +189,6 @@ format.effectsize_anova <- function(x, digits = 2, ...) { format.effectsize_table(x, digits = digits, ...) } -#' @export -format.effectsize_std_params <- function(x, digits = 2, ...) { - footer <- caption <- subtitle <- NULL - - caption <- sprintf("Standardization method: %s", attr(x, "std_method")) - - # robust / two_sd - if (attr(x, "two_sd") || attr(x, "robust")) { - footer <- sprintf("Scaled by %s %s%s from the %s.", - ifelse(attr(x, "two_sd"), "two", "one"), - ifelse(attr(x, "robust"), "MAD", "SD"), - ifelse(attr(x, "two_sd"), "s", ""), - ifelse(attr(x, "robust"), "median", "mean")) - } - - # include_response - if (!attr(x, "include_response")) { - resp_footer <- "Response is unstandardized." - footer <- c(footer, resp_footer) - } - - attr(x, "table_footer") <- footer - attr(x, "table_caption") <- caption - attr(x, "table_subtitle") <- subtitle - format.effectsize_table(x, digits = digits, ...) -} - #' @export format.equivalence_test_effectsize <- function(x, digits = 2, ...) { colnames(x)[colnames(x) == "ROPE_Equivalence"] <- "H0" diff --git a/R/xtab.R b/R/xtab.R index 328ce8423..a125e3f81 100644 --- a/R/xtab.R +++ b/R/xtab.R @@ -26,20 +26,26 @@ #' Pearson's *C* should be used, as they are bounded between 0-1. Cohen's *w* #' can also be used, but since it is not bounded at 1 (can be larger) its #' interpretation is more difficult. -#' \cr\cr +#' \cr \cr #' For goodness-of-fit in 1D tables Cohen's *W*, normalized Chi (\eqn{\chi}) or #' Pearson's *C* can be used. Cohen's *w* has no upper bound (can be arbitrarily #' large, depending on the expected distribution). Normalized Chi is an adjusted #' Cohen's *w*, accounting for the expected distribution, making it bounded #' between 0-1. Pearson's *C* is also bounded between 0-1. -#' \cr\cr +#' \cr \cr +#' To summarize, for correlation-like effect sizes, we recommend: +#' +#' - For a 2x2 table, use `phi()` +#' - For larger tables, use `cramers_v()` +#' - For goodness-of-fit, use `normalized_chi()` +#' \cr \cr #' For 2-by-2 contingency tables, Odds ratios, Risk ratios and Cohen's *h* can #' also be estimated. Note that these are computed with each **column** #' representing the different groups, and the *first* column representing the #' treatment group and the *second* column baseline (or control). Effects are #' given as `treatment / control`. If you wish you use rows as groups you must #' pass a transposed table, or switch the `x` and `y` arguments. -#' \cr\cr +#' \cr \cr #' Cohen's *g* is an effect size for dependent (paired) contingency tables #' ranging between 0 (perfect symmetry) and 0.5 (perfect asymmetry) (see #' [stats::mcnemar.test()]). @@ -48,13 +54,13 @@ #' For Cohen's *g*, confidence intervals are based on the proportion (\eqn{P = g #' + 0.5}) confidence intervals returned by [stats::prop.test()] (minus 0.5), #' which give a good close approximation. -#' \cr\cr +#' \cr \cr #' For Odds ratios, Risk ratios and Cohen's *h*, confidence intervals are #' estimated using the standard normal parametric method (see Katz et al., 1978; #' Szumilas, 2010). -#' \cr\cr -#' See *Confidence (Compatibility) Intervals (CIs)*, *CIs and Significance -#' Tests*, and *One-Sided CIs* sections for *phi*, Cohen's *w*, Cramer's *V*, +#' \cr \cr +#' See *Confidence (Compatibility) Intervals (CIs)*, *CIs and Significance Tests*, +#' and *One-Sided CIs* sections for *phi*, Cohen's *w*, Cramer's *V*, #' Pearson's *C*, and normalized Chi. #' #' @inheritSection effectsize_CIs Confidence (Compatibility) Intervals (CIs) diff --git a/README.md b/README.md index 02fe149ca..62979b7f6 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![total](https://cranlogs.r-pkg.org/badges/grand-total/effectsize)](https://cran.r-project.org/package=effectsize/) [![status](https://tinyverse.netlify.com/badge/effectsize/)](https://CRAN.R-project.org/package=effectsize/) -***Significant is just not enough\!*** +***Significant is just not enough!*** The goal of this package is to provide utilities to work with indices of effect size and standardized parameters, allowing computation and @@ -29,7 +29,7 @@ CRAN: install.packages("effectsize") ``` -Or you can install the latest development version `0.6.0.3` from +Or you can install the latest development version `0.6.0.7` from [*R-universe*](https://easystats.r-universe.dev): ``` r @@ -37,13 +37,9 @@ install.packages("effectsize", repos = "https://easystats.r-universe.dev/") ``` - - - - ## Documentation @@ -57,21 +53,17 @@ Click on the buttons above to access the package [**easystats blog**](https://easystats.github.io/blog/posts/), and check-out these vignettes: - - **Effect Sizes** - - [**Parameter and Model - Standardization**](https://easystats.github.io/effectsize/articles/standardize_parameters.html) - - [**ANOVA Effect - Sizes**](https://easystats.github.io/effectsize/articles/anovaES.html) - - [**Effect Sizes in Bayesian - Models**](https://easystats.github.io/effectsize/articles/bayesian_models.html) - - [**For Simple Hypothesis +- **Effect Sizes** + - [**For Simple Hypothesis Tests**](https://easystats.github.io/effectsize/articles/simple_htests.html) - - **Effect Sizes Conversion** - - [**Between Effect + - [**ANOVA Effect + Sizes**](https://easystats.github.io/effectsize/articles/anovaES.html) +- **Effect Sizes Conversion** + - [**Between Effect Sizes**](https://easystats.github.io/effectsize/articles/convert.html) - - [**Effect Size from Test + - [**Effect Size from Test Statistics**](https://easystats.github.io/effectsize/articles/from_test_statistics.html) - - [**Automated Interpretation of Indices of Effect +- [**Automated Interpretation of Indices of Effect Size**](https://easystats.github.io/effectsize/articles/interpret.html) # Features @@ -149,38 +141,16 @@ epsilon_squared(model) And more… -### Regression Models (Standardized Parameters) - -Importantly, `effectsize` also provides [advanced -methods](https://easystats.github.io/effectsize/articles/standardize_parameters.html) -to compute standardized parameters for regression models. - -``` r -m <- lm(rating ~ complaints + privileges + advance, data = attitude) - -standardize_parameters(m) -## # Standardization method: refit -## -## Parameter | Coefficient (std.) | 95% CI -## ------------------------------------------------ -## (Intercept) | -9.57e-16 | [-0.22, 0.22] -## complaints | 0.85 | [ 0.58, 1.13] -## privileges | -0.04 | [-0.33, 0.24] -## advance | -0.02 | [-0.26, 0.22] -``` - -Also, models can be re-fit with standardized data: - -``` r -standardize(m) -## -## Call: -## lm(formula = rating ~ complaints + privileges + advance, data = data_std) -## -## Coefficients: -## (Intercept) complaints privileges advance -## -9.57e-16 8.55e-01 -4.35e-02 -2.19e-02 -``` + + + + + + + + + + ## Effect Size Conversion @@ -245,7 +215,7 @@ 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 +- 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 diff --git a/cran-comments.md b/cran-comments.md index 9aba20317..0791aa98f 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -6,7 +6,7 @@ All URL issues have been resolved. * GitHub Actions - Windows: devel, release, oldrel - macOS: devel, release, oldrel - - ubuntu-16.04: devel, release, oldrel, 3.6, 3.5, 3.4 + - ubuntu-16.04: devel, release, oldrel, 4.0, 3.6, 3.5, 3.4 * win-builder: release @@ -18,11 +18,12 @@ All URL issues have been resolved. ### Known issues - Failed handshake with *shinyapps.io* is a false positive. +- Unavailable DOI link are false positives. ## revdepcheck results -We checked 16 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. +We checked 17 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 diff --git a/man/effectsize_CIs.Rd b/man/effectsize_CIs.Rd index b088a5187..e11b5a3b7 100644 --- a/man/effectsize_CIs.Rd +++ b/man/effectsize_CIs.Rd @@ -96,10 +96,14 @@ An alternative approach to aligning significance tests using CIs and 1-tailed conducting \strong{equivalence tests}. For example, a 90\% 2-sided interval gives the bounds for an equivalence test with \eqn{\alpha} = .05. However, be aware that this interval does not give 95\% coverage for the underlying effect size -parameter value. For that, construct a 95\% 2-sided CI.\if{html}{\out{
}}\preformatted{data("hardlyworking") +parameter value. For that, construct a 95\% 2-sided CI. + +\if{html}{\out{
}}\preformatted{data("hardlyworking") fit <- lm(salary ~ n_comps + age, data = hardlyworking) eta_squared(fit) # default, ci = 0.95, alternative = "greater" -}\if{html}{\out{
}}\preformatted{## # Effect Size for ANOVA (Type I) +}\if{html}{\out{
}} + +\if{html}{\out{
}}\preformatted{## # Effect Size for ANOVA (Type I) ## ## Parameter | Eta2 (partial) | 95\% CI ## ----------------------------------------- @@ -107,8 +111,12 @@ eta_squared(fit) # default, ci = 0.95, alternative = "greater" ## age | 0.10 | [0.06, 1.00] ## ## - One-sided CIs: upper bound fixed at [1.00]. -}\if{html}{\out{
}}\preformatted{eta_squared(fit, alternative = "less") # Test is eta is smaller than some value -}\if{html}{\out{
}}\preformatted{## # Effect Size for ANOVA (Type I) +}\if{html}{\out{
}} + +\if{html}{\out{
}}\preformatted{eta_squared(fit, alternative = "less") # Test is eta is smaller than some value +}\if{html}{\out{
}} + +\if{html}{\out{
}}\preformatted{## # Effect Size for ANOVA (Type I) ## ## Parameter | Eta2 (partial) | 95\% CI ## ----------------------------------------- @@ -116,21 +124,29 @@ eta_squared(fit) # default, ci = 0.95, alternative = "greater" ## age | 0.10 | [0.00, 0.14] ## ## - One-sided CIs: lower bound fixed at [0.00]. -}\if{html}{\out{
}}\preformatted{eta_squared(fit, alternative = "two.sided") # 2-sided bounds for alpha = .05 -}\if{html}{\out{
}}\preformatted{## # Effect Size for ANOVA (Type I) +}\if{html}{\out{
}} + +\if{html}{\out{
}}\preformatted{eta_squared(fit, alternative = "two.sided") # 2-sided bounds for alpha = .05 +}\if{html}{\out{
}} + +\if{html}{\out{
}}\preformatted{## # Effect Size for ANOVA (Type I) ## ## Parameter | Eta2 (partial) | 95\% CI ## ----------------------------------------- ## n_comps | 0.21 | [0.15, 0.27] ## age | 0.10 | [0.06, 0.15] -}\if{html}{\out{
}}\preformatted{eta_squared(fit, ci = 0.9, alternative = "two.sided") # both 1-sided bounds for alpha = .05 -}\if{html}{\out{
}}\preformatted{## # Effect Size for ANOVA (Type I) +}\if{html}{\out{
}} + +\if{html}{\out{
}}\preformatted{eta_squared(fit, ci = 0.9, alternative = "two.sided") # both 1-sided bounds for alpha = .05 +}\if{html}{\out{
}} + +\if{html}{\out{
}}\preformatted{## # Effect Size for ANOVA (Type I) ## ## Parameter | Eta2 (partial) | 90\% CI ## ----------------------------------------- ## n_comps | 0.21 | [0.16, 0.26] ## age | 0.10 | [0.06, 0.14] -} +}\if{html}{\out{
}} } \section{CI Does Not Contain the Estimate}{ @@ -139,11 +155,15 @@ For very large sample sizes or effect sizes, the width of the CI can be smaller than the tolerance of the optimizer, resulting in CIs of width 0. This can also result in the estimated CIs excluding the point estimate. -For example:\if{html}{\out{
}}\preformatted{t_to_d(80, df_error = 4555555) -}\if{html}{\out{
}}\preformatted{## d | 95\% CI +For example: + +\if{html}{\out{
}}\preformatted{t_to_d(80, df_error = 4555555) +}\if{html}{\out{
}} + +\if{html}{\out{
}}\preformatted{## d | 95\% CI ## ------------------- ## 0.07 | [0.08, 0.08] -} +}\if{html}{\out{
}} In these cases, consider an alternative optimizer, or an alternative method for computing CIs, such as the bootstrap. diff --git a/man/phi.Rd b/man/phi.Rd index b13de3fb2..d81b7950c 100644 --- a/man/phi.Rd +++ b/man/phi.Rd @@ -81,35 +81,42 @@ dependence) and 1 (perfect dependence). For larger tables, Cramer's \emph{V} or Pearson's \emph{C} should be used, as they are bounded between 0-1. Cohen's \emph{w} can also be used, but since it is not bounded at 1 (can be larger) its interpretation is more difficult. -\cr\cr +\cr \cr For goodness-of-fit in 1D tables Cohen's \emph{W}, normalized Chi (\eqn{\chi}) or Pearson's \emph{C} can be used. Cohen's \emph{w} has no upper bound (can be arbitrarily large, depending on the expected distribution). Normalized Chi is an adjusted Cohen's \emph{w}, accounting for the expected distribution, making it bounded between 0-1. Pearson's \emph{C} is also bounded between 0-1. -\cr\cr +\cr \cr +To summarize, for correlation-like effect sizes, we recommend: +\itemize{ +\item For a 2x2 table, use \code{phi()} +\item For larger tables, use \code{cramers_v()} +\item For goodness-of-fit, use \code{normalized_chi()} +\cr \cr For 2-by-2 contingency tables, Odds ratios, Risk ratios and Cohen's \emph{h} can also be estimated. Note that these are computed with each \strong{column} representing the different groups, and the \emph{first} column representing the treatment group and the \emph{second} column baseline (or control). Effects are given as \code{treatment / control}. If you wish you use rows as groups you must pass a transposed table, or switch the \code{x} and \code{y} arguments. -\cr\cr +\cr \cr Cohen's \emph{g} is an effect size for dependent (paired) contingency tables ranging between 0 (perfect symmetry) and 0.5 (perfect asymmetry) (see \code{\link[stats:mcnemar.test]{stats::mcnemar.test()}}). } +} \section{Confidence Intervals for Cohen's g, OR, RR and Cohen's h}{ For Cohen's \emph{g}, confidence intervals are based on the proportion (\eqn{P = g + 0.5}) confidence intervals returned by \code{\link[stats:prop.test]{stats::prop.test()}} (minus 0.5), which give a good close approximation. -\cr\cr +\cr \cr For Odds ratios, Risk ratios and Cohen's \emph{h}, confidence intervals are estimated using the standard normal parametric method (see Katz et al., 1978; Szumilas, 2010). -\cr\cr -See \emph{Confidence (Compatibility) Intervals (CIs)}, \emph{CIs and Significance -Tests}, and \emph{One-Sided CIs} sections for \emph{phi}, Cohen's \emph{w}, Cramer's \emph{V}, +\cr \cr +See \emph{Confidence (Compatibility) Intervals (CIs)}, \emph{CIs and Significance Tests}, +and \emph{One-Sided CIs} sections for \emph{phi}, Cohen's \emph{w}, Cramer's \emph{V}, Pearson's \emph{C}, and normalized Chi. } diff --git a/vignettes/anovaES.Rmd b/vignettes/anovaES.Rmd index 5ab651434..4982813dc 100644 --- a/vignettes/anovaES.Rmd +++ b/vignettes/anovaES.Rmd @@ -252,7 +252,7 @@ epsilon_squared(fit_lmm) omega_squared(fit_lmm) ``` -Another case where *SS*s are not available is when use Bayesian models. `effectsize` has Bayesian solutions for Bayesian models, about which you can read in the [*Effect Sizes for Bayesian Models* vignette](https://easystats.github.io/effectsize/articles/bayesian_models.html). +Another case where *SS*s are not available is when using Bayesian models... ## For Bayesian Models diff --git a/vignettes/simple_htests.Rmd b/vignettes/simple_htests.Rmd index dfdfec35e..508c89584 100644 --- a/vignettes/simple_htests.Rmd +++ b/vignettes/simple_htests.Rmd @@ -138,7 +138,7 @@ eta_squared(onew) ### 2-by-2 Tables -For 2-by-2 contingency tables, $\phi$ (Phi) is homologous (though directionless) to the bi-serial correlation between the two dichotomous variables, with 0 representing to association, and 1 representing a perfect association. A "cousin" effect size is Pearson's contingency coefficient. +For 2-by-2 contingency tables, $\phi$ (Phi) is homologous (though directionless) to the bi-serial correlation between the two dichotomous variables, with 0 representing no association, and 1 representing a perfect association. A "cousin" effect size is Pearson's contingency coefficient. ```{r} MPG_Gear <- table(mtcars$mpg < 20, mtcars$vs)