diff --git a/R/adjust.R b/R/adjust.R
index 9b622bb70..1bb81f8f9 100644
--- a/R/adjust.R
+++ b/R/adjust.R
@@ -1,30 +1,39 @@
#' Adjust data for the effect of other variable(s)
#'
-#' This function can be used to adjust the data for the effect of other variables present in the dataset. It is based on an underlying fitting of regressions models, allowing for quite some flexibility, such as including factors as random effects in mixed models (multilevel partialization), continuous variables as smooth terms in general additive models (non-linear partialization) and/or fitting these models under a Bayesian framework. The values returned by this function are the residuals of the regression models. Note that a regular correlation between two "adjusted" variables is equivalent to the partial correlation between them.
+#' This function can be used to adjust the data for the effect of other
+#' variables present in the dataset. It is based on an underlying fitting of
+#' regressions models, allowing for quite some flexibility, such as including
+#' factors as random effects in mixed models (multilevel partialization),
+#' continuous variables as smooth terms in general additive models (non-linear
+#' partialization) and/or fitting these models under a Bayesian framework. The
+#' values returned by this function are the residuals of the regression models.
+#' Note that a regular correlation between two "adjusted" variables is
+#' equivalent to the partial correlation between them.
#'
#' @param data A dataframe.
-#' @param effect Character vector of column names to be adjusted for (regressed out). If `NULL` (the default), all variables will be selected.
+#' @param effect Character vector of column names to be adjusted for (regressed
+#' out). If `NULL` (the default), all variables will be selected.
#' @inheritParams standardize
-#' @param multilevel If `TRUE`, the factors are included as random factors. Else, if `FALSE` (default), they are included as fixed effects in the simple regression model.
-#' @param additive If `TRUE`, continuous variables as included as smooth terms in additive models. The goal is to regress-out potential non-linear effects.
-#' @param bayesian If `TRUE`, the models are fitted under the Bayesian framework using `rstanarm`.
+#' @param multilevel If `TRUE`, the factors are included as random factors.
+#' Else, if `FALSE` (default), they are included as fixed effects in the
+#' simple regression model.
+#' @param additive If `TRUE`, continuous variables as included as smooth terms
+#' in additive models. The goal is to regress-out potential non-linear
+#' effects.
+#' @param bayesian If `TRUE`, the models are fitted under the Bayesian framework
+#' using `rstanarm`.
+#'
+#' @return A data frame comparable to `data`, with adjusted variables.
#'
#' @examples
-#' adjust(iris, effect = "Species", select = "Sepal.Length")
+#' adjust(attitude)
+#' adjust(attitude, effect = "complaints", select = "rating")
#' \donttest{
#' \dontrun{
-#' adjust(iris, effect = "Species", select = "Sepal.Length", multilevel = TRUE)
-#' adjust(iris, effect = "Species", select = "Sepal.Length", bayesian = TRUE)
-#' adjust(iris, effect = "Petal.Width", select = "Sepal.Length", additive = TRUE)
-#' adjust(iris,
-#' effect = "Petal.Width", select = "Sepal.Length",
-#' additive = TRUE, bayesian = TRUE
-#' )
-#' adjust(iris,
-#' effect = c("Petal.Width", "Species"), select = "Sepal.Length",
-#' multilevel = TRUE, additive = TRUE
-#' )
-#' adjust(iris)
+#' adjust(attitude, effect = "complaints", select = "rating", bayesian = TRUE)
+#' adjust(attitude, effect = "complaints", select = "rating", additive = TRUE)
+#' attitude$complaints_LMH <- cut(attitude$complaints, 3)
+#' adjust(attitude, effect = "complaints_LMH", select = "rating", multilevel = TRUE)
#' }
#' }
#'
diff --git a/R/change_scale.R b/R/change_scale.R
index bd9c15528..861f399fd 100644
--- a/R/change_scale.R
+++ b/R/change_scale.R
@@ -13,7 +13,7 @@
#' change_scale(c(0, 1, 5, -5, -2))
#' change_scale(c(0, 1, 5, -5, -2), to = c(-5, 5))
#'
-#' head(change_scale(iris))
+#' head(change_scale(trees))
#' @seealso [normalize()] [standardize()] [ranktransform()]
#'
#' @return A rescaled object.
diff --git a/R/cohens_d.R b/R/cohens_d.R
index 21633e850..5837df690 100644
--- a/R/cohens_d.R
+++ b/R/cohens_d.R
@@ -35,14 +35,17 @@
#'
#' @inheritSection effectsize-CIs Confidence Intervals
#'
-#' @return A data frame with the effect size(s) and confidence interval(s).
+#' @return A data frame with the effect size ( `Cohens_d`, `Hedges_g`,
+#' `Glass_delta`) and their CIs (`CI_low` and `CI_high`).
#'
#' @seealso [d_to_common_language()] [sd_pooled()]
#' @family effect size indices
#'
#' @examples
-#' cohens_d(iris$Sepal.Length, iris$Sepal.Width)
-#' hedges_g("Sepal.Length", "Sepal.Width", data = iris)
+#' cohens_d(sleep$extra, sleep$group)
+#' hedges_g("extra", "group", data = sleep)
+#'
+#' cohens_d(sleep$extra[sleep$group==1], sleep$extra[sleep$group==2], paired = TRUE)
#'
#' cohens_d(mpg ~ am, data = mtcars)
#' cohens_d(mpg ~ am, data = mtcars, pooled_sd = FALSE)
@@ -51,7 +54,7 @@
#'
#' print(cohens_d(mpg ~ am, data = mtcars), append_CL = TRUE)
#' @references
-#' - Cohen, J. (2013). Statistical power analysis for the behavioral sciences. Routledge.
+#' - Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd Ed.). New York: Routledge.
#' - Hedges, L. V. & Olkin, I. (1985). Statistical methods for meta-analysis. Orlando, FL: Academic Press.
#' - Hunter, J. E., & Schmidt, F. L. (2004). Methods of meta-analysis: Correcting error and bias in research findings. Sage.
#' - McGrath, R. E., & Meyer, G. J. (2006). When effect sizes disagree: the case of r and d. Psychological methods, 11(4), 386.
diff --git a/R/convert_OR_to_RR.R b/R/convert_OR_to_RR.R
index b8739277e..73963f4f7 100644
--- a/R/convert_OR_to_RR.R
+++ b/R/convert_OR_to_RR.R
@@ -4,6 +4,8 @@
#' @param p0 Baseline risk
#' @inheritParams oddsratio_to_d
#'
+#' @return Converted index.
+#'
#' @family convert between effect sizes
#'
#' @examples
diff --git a/R/convert_chisq.R b/R/convert_chisq.R
index f0b996f9a..d723b4b06 100644
--- a/R/convert_chisq.R
+++ b/R/convert_chisq.R
@@ -11,7 +11,8 @@
#' @param adjust Should the effect size be bias-corrected? Defaults to `FALSE`.
#' @param ... Arguments passed to or from other methods.
#'
-#' @return A data frame with the effect size(s) between 0-1, and confidence interval(s).
+#' @return A data frame with the effect size(s) between 0-1, and confidence
+#' interval(s). See [cramers_v()].
#'
#' @details These functions use the following formulae:
#' \cr
diff --git a/R/convert_d_to_common_language.R b/R/convert_d_to_common_language.R
index dd2505b6c..5a10a8ea1 100644
--- a/R/convert_d_to_common_language.R
+++ b/R/convert_d_to_common_language.R
@@ -10,6 +10,8 @@
#' \cr\cr
#' \deqn{Pr(superiority) = \Phi(d/\sqrt{2})}
#'
+#' @return A list of `Cohen's U3`, `Overlap`, `Probability of superiority`.
+#'
#' @note
#' These calculations assume that the populations have equal variance and are
#' normally distributed.
@@ -18,7 +20,7 @@
#' @family convert between effect sizes
#'
#' @references
-#' - Cohen, J. (1977). Statistical power analysis for the behavioral sciencies. Routledge.
+#' - Cohen, J. (1977). Statistical power analysis for the behavioral sciences. New York: Routledge.
#' - Reiser, B., & Faraggi, D. (1999). Confidence intervals for the overlapping coefficient: the normal equal variance case. Journal of the Royal Statistical Society, 48(3), 413-418.
#' - Ruscio, J. (2008). A probability-based measure of effect size: robustness to base rates and other factors. Psychological methods, 13(1), 19–30.
#'
diff --git a/R/convert_odds_to_probs.R b/R/convert_odds_to_probs.R
index 9a877b6e4..69739907d 100644
--- a/R/convert_odds_to_probs.R
+++ b/R/convert_odds_to_probs.R
@@ -9,6 +9,8 @@
#' from transformation.
#' @param ... Arguments passed to or from other methods.
#'
+#' @return Converted index.
+#'
#' @seealso [stats::plogis()]
#' @family convert between effect sizes
#'
diff --git a/R/convert_tF_to_pve.R b/R/convert_tF_to_pve.R
index 373960529..7e64b0056 100644
--- a/R/convert_tF_to_pve.R
+++ b/R/convert_tF_to_pve.R
@@ -15,9 +15,12 @@
#' @inheritParams chisq_to_phi
#' @param ... Arguments passed to or from other methods.
#'
-#' @return A data frame with the effect size(s) between 0-1, and confidence interval(s) (Note that for \eqn{\omega_p^2} and \eqn{\epsilon_p^2}
-#' it is possible to compute a negative number; even though this doesn't make any practical sense,
-#' it is recommended to report the negative number and not a 0).
+#' @return A data frame with the effect size(s) between 0-1 (`Eta2_partial`,
+#' `Epsilon2_partial`, `Omega2_partial`, `Cohens_f_partial` or
+#' `Cohens_f2_partial`), and their CIs (`CI_low` and `CI_high`). (Note that
+#' for \eqn{\omega_p^2} and \eqn{\epsilon_p^2} it is possible to compute a
+#' negative number; even though this doesn't make any practical sense, it is
+#' recommended to report the negative number and not a 0).
#'
#' @details These functions use the following formulae:
#' \cr
diff --git a/R/convert_tFz_to_r.R b/R/convert_tFz_to_r.R
index 0e30fe9f1..510357d1e 100644
--- a/R/convert_tFz_to_r.R
+++ b/R/convert_tFz_to_r.R
@@ -2,22 +2,27 @@
#' Convert test statistics (t, z, F) to effect sizes of differences (Cohen's d) or association (**partial** r)
#'
-#' These functions are convenience functions to convert t, z and F test statistics to Cohen's d and
-#' **partial** r. These are useful in cases where the data required to compute these are not easily
-#' available or their computation is not straightforward (e.g., in liner mixed models, contrasts, etc.).
+#' These functions are convenience functions to convert t, z and F test
+#' statistics to Cohen's d and **partial** r. These are useful in cases where
+#' the data required to compute these are not easily available or their
+#' computation is not straightforward (e.g., in liner mixed models, contrasts,
+#' etc.).
#' \cr
#' See [Effect Size from Test Statistics vignette.](https://easystats.github.io/effectsize/articles/from_test_statistics.html)
#'
#' @param t,f,z The t, the F or the z statistics.
-#' @param df,df_error Degrees of freedom of numerator or of the error estimate (i.e., the residuals).
+#' @param df,df_error Degrees of freedom of numerator or of the error estimate
+#' (i.e., the residuals).
#' @param n The number of observations (the sample size).
-#' @param paired Should the estimate accout for the t-value being testing the difference between dependant means?
+#' @param paired Should the estimate accout for the t-value being testing the
+#' difference between dependant means?
#' @param pooled Deprecated. Use `paired`.
#' @inheritParams chisq_to_phi
#' @param ... Arguments passed to or from other methods.
#'
#'
-#' @return A data frame with the effect size(s) between 0-1, and confidence interval(s)
+#' @return A data frame with the effect size(s)(`r` or `d`), and their CIs
+#' (`CI_low` and `CI_high`).
#'
#'
#' @details These functions use the following formulae to approximate *r* and *d*:
@@ -52,7 +57,7 @@
#' t_to_r(t = res$statistic, res$parameter)
#' \donttest{
#' ## Linear Regression
-#' model <- lm(Sepal.Length ~ Sepal.Width + Petal.Length, data = iris)
+#' model <- lm(rating ~ complaints + critical, data = attitude)
#' library(parameters)
#' (param_tab <- parameters(model))
#'
@@ -62,7 +67,7 @@
#'
#' # How does this compare to actual partial correlations?
#' if (require("correlation")) {
-#' correlation::correlation(iris[, 1:3], partial = TRUE)[1:2, c(2, 3, 7, 8)]
+#' correlation::correlation(attitude[, c(1, 2, 6)], partial = TRUE)[1:2, c(2, 3, 7, 8)]
#' }
#'
#' ## Use with emmeans based contrasts (see also t_to_eta2)
diff --git a/R/effectsize.R b/R/effectsize.R
index 958fc8b0c..e5ad9183b 100644
--- a/R/effectsize.R
+++ b/R/effectsize.R
@@ -24,6 +24,9 @@
#' **For statistical models it is recommended to directly use the listed
#' functions, for the full range of options they provide.**
#'
+#' @return A data frame with the effect size (depending on input) and and its
+#' CIs (`CI_low` and `CI_high`).
+#'
#' @family effect size indices
#'
#' @examples
@@ -49,7 +52,7 @@
#' bf1 <- ttestBF(mtcars$mpg[mtcars$am == 1], mtcars$mpg[mtcars$am == 0])
#' effectsize(bf1, test = NULL)
#'
-#' bf2 <- correlationBF(iris$Sepal.Length, iris$Sepal.Width)
+#' bf2 <- correlationBF(attitude$rating, attitude$complaints)
#' effectsize(bf2, test = NULL)
#'
#' data(raceDolls)
diff --git a/R/equivalence_test.R b/R/equivalence_test.R
index 6074d7ff5..1bb809db8 100644
--- a/R/equivalence_test.R
+++ b/R/equivalence_test.R
@@ -35,7 +35,7 @@ bayestestR::equivalence_test
#'
#' @seealso For more details, see [bayestestR::equivalence_test()].
#'
-#' @return A data frame.
+#' @return A data frame with the results of the equivalence test.
#'
#' @references
#' - Campbell, H., & Gustafson, P. (2018). Conditional equivalence testing: An alternative remedy for publication bias. PLOS ONE, 13(4), e0195145. https://doi.org/10.1371/journal.pone.0195145
diff --git a/R/eta_squared.R b/R/eta_squared.R
index ce44c96ff..b5bdc5a18 100644
--- a/R/eta_squared.R
+++ b/R/eta_squared.R
@@ -24,7 +24,9 @@
#' @param ... For Bayesian models, passed to `ss_function`. Otherwise ignored.
#'
#' @return
-#' A data frame with the effect size(s) and confidence interval(s).
+#' A data frame with the effect size(s) between 0-1 (`Eta2`, `Epsilon2`,
+#' `Omega2`, `Cohens_f` or `Cohens_f2`, possibly with the `partial` or
+#' `generalized` suffix), and their CIs (`CI_low` and `CI_high`).
#' \cr\cr
#' For `eta_squared_posterior()`, a data frame containing the ppd of the Eta
#' squared for each fixed effect, which can then be passed to
@@ -58,6 +60,10 @@
#' Though Omega is the more popular choice (Albers \& Lakens, 2018), Epsilon is
#' analogous to adjusted R2 (Allen, 2017, p. 382), and has been found to be less
#' biased (Carroll & Nordholm, 1975).
+#' \cr\cr
+#' (Note that for \eqn{\omega_p^2} and \eqn{\epsilon_p^2} it is possible to
+#' compute a negative number; even though this doesn't make any practical sense,
+#' it is recommended to report the negative number and not a 0.)
#'
#' ## Cohen's f
#' Cohen's f can take on values between zero, when the population means are all
diff --git a/R/interpret_d.R b/R/interpret_d.R
index 86124b50e..2cc5ac563 100644
--- a/R/interpret_d.R
+++ b/R/interpret_d.R
@@ -35,7 +35,7 @@
#' interpret_d(c(.5, .02))
#' @references
#' - Gignac, G. E., & Szodorai, E. T. (2016). Effect size guidelines for individual differences researchers. Personality and individual differences, 102, 74-78.
-#' - Cohen, J. (1988). Statistical power analysis for the behavioural sciences.
+#' - Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd Ed.). New York: Routledge.
#' - Sawilowsky, S. S. (2009). New effect size rules of thumb.
#'
#' @export
diff --git a/R/interpret_oddsratio.R b/R/interpret_oddsratio.R
index 4a9329efa..49df642da 100644
--- a/R/interpret_oddsratio.R
+++ b/R/interpret_oddsratio.R
@@ -25,7 +25,7 @@
#' @aliases interpret_odds
#'
#' @references
-#' - Cohen, J. (1988). Statistical power analysis for the behavioural sciences.
+#' - Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd Ed.). New York: Routledge.
#' - Chen, H., Cohen, P., & Chen, S. (2010). How big is a big odds ratio? Interpreting the magnitudes of odds ratios in epidemiological studies. Communications in Statistics—Simulation and Computation, 39(4), 860-864.
#' - Sánchez-Meca, J., Marín-Martínez, F., & Chacón-Moscoso, S. (2003). Effect-size indices for dichotomized outcomes in meta-analysis. Psychological methods, 8(4), 448.
#'
diff --git a/R/interpret_parameters.R b/R/interpret_parameters.R
index e149b2b71..c382ed136 100644
--- a/R/interpret_parameters.R
+++ b/R/interpret_parameters.R
@@ -8,9 +8,6 @@
#' @param standardize_method See [standardize_parameters()].
#' @param standardize_robust See [standardize_parameters()].
#'
-#' @examples
-#' model <- lm(Sepal.Length ~ Species * Petal.Width, data = iris)
-#' interpret_parameters(model)
#' @export
interpret_parameters <- function(model, ...) {
## ----------------------------- NOTE ---------------------------------------
diff --git a/R/interpret_r.R b/R/interpret_r.R
index b6cee8591..e89625bc1 100644
--- a/R/interpret_r.R
+++ b/R/interpret_r.R
@@ -39,7 +39,7 @@
#' @references
#' - Funder, D. C., & Ozer, D. J. (2019). Evaluating effect size in psychological research: sense and nonsense. Advances in Methods and Practices in Psychological Science.
#' - Gignac, G. E., & Szodorai, E. T. (2016). Effect size guidelines for individual differences researchers. Personality and individual differences, 102, 74-78.
-#' - Cohen, J. (1988). Statistical power analysis for the behavioural sciences.
+#' - Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd Ed.). New York: Routledge.
#' - Evans, J. D. (1996). Straightforward statistics for the behavioral sciences. Thomson Brooks/Cole Publishing Co.
#'
#' @export
diff --git a/R/interpret_r2.R b/R/interpret_r2.R
index f2bb20004..add4cb902 100644
--- a/R/interpret_r2.R
+++ b/R/interpret_r2.R
@@ -33,7 +33,7 @@
#' interpret_r2(.02)
#' interpret_r2(c(.5, .02))
#' @references
-#' - Cohen, J. (1988). Statistical power analysis for the behavioural sciences.
+#' - Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd Ed.). New York: Routledge.
#' - Falk, R. F., & Miller, N. B. (1992). A primer for soft modeling. University of Akron Press.
#' - Chin, W. W. (1998). The partial least squares approach to structural equation modeling. Modern methods for business research, 295(2), 295-336.
#' - Hair, J. F., Ringle, C. M., & Sarstedt, M. (2011). PLS-SEM: Indeed a silver bullet. Journal of Marketing theory and Practice, 19(2), 139-152.
diff --git a/R/normalize.R b/R/normalize.R
index c6b8d792f..5aab2afb9 100644
--- a/R/normalize.R
+++ b/R/normalize.R
@@ -18,13 +18,14 @@
#' normalize(c(0, 1, 5, -5, -2))
#' normalize(c(0, 1, 5, -5, -2), include_bounds = FALSE)
#'
-#' head(normalize(iris))
+#' head(normalize(trees))
#' @references
#' - Smithson M, Verkuilen J (2006). A Better Lemon Squeezer? Maximum-Likelihood Regression with Beta-Distributed Dependent Variables. Psychological Methods, 11(1), 54–71.
#'
#' @family transform utilities
#'
#' @return A normalized object.
+#'
#' @export
normalize <- function(x, ...) {
UseMethod("normalize")
diff --git a/R/ranktransform.R b/R/ranktransform.R
index 1e4567cff..aa90113f6 100644
--- a/R/ranktransform.R
+++ b/R/ranktransform.R
@@ -13,7 +13,8 @@
#' ranktransform(c(0, 1, 5, -5, -2))
#' ranktransform(c(0, 1, 5, -5, -2), sign = TRUE)
#'
-#' head(ranktransform(iris))
+#' head(ranktransform(trees))
+#'
#' @return A rank-transformed object.
#'
#' @family transform utilities
diff --git a/R/sd_pooled.R b/R/sd_pooled.R
index 386dd2355..33daa5ebb 100644
--- a/R/sd_pooled.R
+++ b/R/sd_pooled.R
@@ -15,9 +15,7 @@ sd_pooled <- function(x, y = NULL, data = NULL) {
# This actually works, you must see if you want to keep this code. If you do,
# following will work:
- # sd_pooled(Sepal.Length, Petal.Width, data = iris)
- # sd_pooled("Sepal.Length", "Petal.Width", data = iris)
- # sd_pooled(iris$Sepal.Length, iris$Petal.Width)
+ # sd_pooled(mpg, hp, data = mtcars)
# sd_pooled(x, y) # called from a different function, like cohens_d()
# needs modification in in ".sd_pooled()" as well...
diff --git a/R/standardize.R b/R/standardize.R
index c6222487f..005d38957 100644
--- a/R/standardize.R
+++ b/R/standardize.R
@@ -38,10 +38,10 @@
#'
#' @examples
#' # Data frames
-#' summary(standardize(iris))
+#' summary(standardize(swiss))
#'
#' # Models
-#' model <- lm(Sepal.Length ~ Species * Petal.Width, data = iris)
+#' model <- lm(Infant.Mortality ~ Education * Fertility, data = swiss)
#' coef(standardize(model))
#' @export
standardize <- function(x, robust = FALSE, two_sd = FALSE, weights = NULL, verbose = TRUE, ...) {
diff --git a/R/standardize_info.R b/R/standardize_info.R
index 5a6502950..416ecb18d 100644
--- a/R/standardize_info.R
+++ b/R/standardize_info.R
@@ -6,10 +6,19 @@
#' @param include_pseudo (For (G)LMMs) Should Pseudo-standardized information be included?
#' @param ... Arguments passed to or from other methods.
#'
+#' @return A data frame with information on each parameter (see
+#' [parameters::parameters_type]), and various standardization coefficients
+#' for the post-hoc methods (see [standardize_parameters()]) for the predictor
+#' and the response.
+#'
#' @family standardize
#'
#' @examples
-#' model <- lm(Sepal.Width ~ Sepal.Length * Species, data = iris)
+#' model <- lm(mpg ~ ., data = mtcars)
+#' standardize_info(model)
+#' standardize_info(model, robust = TRUE)
+#' standardize_info(model, two_sd = TRUE)
+#'
#' @importFrom parameters parameters_type
#' @export
standardize_info <- function(model, robust = FALSE, two_sd = FALSE, include_pseudo = FALSE, ...) {
diff --git a/R/standardize_parameters.R b/R/standardize_parameters.R
index c88e3413c..b2f068999 100644
--- a/R/standardize_parameters.R
+++ b/R/standardize_parameters.R
@@ -80,16 +80,19 @@
#' coefficients (e.g., in a binomial model: the exponent of the standardized
#' parameter is the OR of a change of 1 SD in the predictor, etc.)
#'
-#' @return A data frame with the standardized parameters and their CIs.
+#' @return A data frame with the standardized parameters (`Std_*`, depending on
+#' the model type) and their CIs (`CI_low` and `CI_high`). Where applicable,
+#' standard errors (SEs) are returned as an attribute (`attr(x,
+#' "standard_error")`).
#'
#' @family standardize
#' @family effect size indices
+#' @seealso [standardize_info()]
#'
#' @examples
#' library(effectsize)
-#' data(iris)
#'
-#' model <- lm(Sepal.Length ~ Species * Petal.Width, data = iris)
+#' model <- lm(len ~ supp * dose, data = ToothGrowth)
#' standardize_parameters(model, method = "refit")
#' \donttest{
#' standardize_parameters(model, method = "posthoc")
@@ -116,19 +119,15 @@
#'
#' \dontrun{
#' if (require("rstanarm")) {
-#' model <- stan_glm(Sepal.Length ~ Species + Petal.Width, data = iris, refresh = 0)
-#' # standardize_posteriors(model, method = "refit")
-#' # standardize_posteriors(model, method = "posthoc")
-#' # standardize_posteriors(model, method = "smart")
+#' model <- stan_glm(rating ~ critical + privileges, data = attitude, refresh = 0)
+#' standardize_posteriors(model, method = "refit")
+#' standardize_posteriors(model, method = "posthoc")
+#' standardize_posteriors(model, method = "smart")
#' head(standardize_posteriors(model, method = "basic"))
#' }
#' }
#' }
#'
-#' @seealso [standardize_info()]
-#'
-#' @return Standardized parameters table.
-#'
#' @references
#' - Hoffman, L. (2015). Longitudinal analysis: Modeling within-person fluctuation and change. Routledge.
#' - Neter, J., Wasserman, W., & Kutner, M. H. (1989). Applied linear regression models.
diff --git a/R/xtab.R b/R/xtab.R
index 89b5f646f..22987803a 100644
--- a/R/xtab.R
+++ b/R/xtab.R
@@ -43,7 +43,9 @@
#' @inheritSection cohens_d Confidence Intervals
#' @inheritSection chisq_to_phi CI Contains Zero
#'
-#' @return A data frame with the effect size(s), and confidence interval(s).
+#' @return A data frame with the effect size (`Cramers_v`, `phi` (possibly with
+#' the suffix `_adjusted`), `Odds_ratio`, `Risk_ratio` (possibly with the
+#' prefix `log_`), or `Cohens_g`) and its CIs (`CI_low` and `CI_high`).
#'
#' @seealso [chisq_to_phi()] for details regarding estimation and CIs.
#' @family effect size indices
@@ -98,7 +100,7 @@
#'
#' cohens_g(Performance)
#' @references
-#' - Cohen, J. (1988). Statistical power analysis for the behavioural sciences.
+#' - Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd Ed.). New York: Routledge.
#' - Katz, D. J. S. M., Baptista, J., Azen, S. P., & Pike, M. C. (1978). Obtaining confidence intervals for the risk ratio in cohort studies. Biometrics, 469-474.
#' - Szumilas, M. (2010). Explaining odds ratios. Journal of the Canadian academy of child and adolescent psychiatry, 19(3), 227.
#'
diff --git a/README.Rmd b/README.Rmd
index 86b4a635b..6902b2fd0 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -86,17 +86,17 @@ library(effectsize)
The package provides functions to compute indices of effect size.
```{r, warning=FALSE, message=FALSE}
-cohens_d(iris$Sepal.Length, iris$Sepal.Width)
+cohens_d(mpg ~ am, data = mtcars)
-hedges_g(iris$Sepal.Length, iris$Sepal.Width)
+hedges_g(mpg ~ am, data = mtcars)
-glass_delta(iris$Sepal.Length, iris$Sepal.Width)
+glass_delta(mpg ~ am, data = mtcars)
```
### ANOVAs (Eta2, Omega2, ...)
```{r, warning=FALSE, message=FALSE}
-model <- aov(Sepal.Length ~ Species, data = iris)
+model <- aov(mpg ~ factor(gear), data = mtcars)
eta_squared(model)
@@ -113,7 +113,7 @@ And more...
Importantly, `effectsize` also provides [advanced methods](https://easystats.github.io/effectsize/articles/standardize_parameters.html) to compute standardized parameters for regression models.
```{r, warning=FALSE, message=FALSE}
-m <- lm(Sepal.Length ~ Species + Sepal.Width, data = iris)
+m <- lm(rating ~ complaints + privileges + advance, data = attitude)
standardize_parameters(m)
```
@@ -172,25 +172,25 @@ Many indices of effect size stem out, or are related, to [*standardization*](htt
A standardization sets the mean and SD to 0 and 1:
```{r, warning=FALSE, message=FALSE}
-library(parameters)
+library(parameters) # for describe_distribution
-df <- standardize(iris)
-describe_distribution(df$Sepal.Length)
+df <- standardize(attitude)
+describe_distribution(df$rating)
```
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.
```{r, warning=FALSE, message=FALSE}
-df <- normalize(iris)
-describe_distribution(df$Sepal.Length)
+df <- normalize(attitude)
+describe_distribution(df$rating)
```
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":
```{r, warning=FALSE, message=FALSE}
-df <- change_scale(iris, to = c(0, 100))
-describe_distribution(df$Sepal.Length)
+df <- change_scale(attitude, to = c(0, 100))
+describe_distribution(df$rating)
```
diff --git a/README.md b/README.md
index ed4a3e3cc..f89595ec5 100644
--- a/README.md
+++ b/README.md
@@ -17,8 +17,8 @@ conversion of indices such as Cohen’s *d*, *r*, odds-ratios, etc.
Run the following to install the latest GitHub-version of `effectsize`:
``` r
-install.packages("devtools")
-devtools::install_github("easystats/effectsize")
+install.packages("remotes")
+remotes::install_github("easystats/effectsize")
```
Or install the latest stable release from CRAN:
@@ -70,41 +70,44 @@ library(effectsize)
The package provides functions to compute indices of effect size.
``` r
-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]
+cohens_d(mpg ~ am, data = mtcars)
+## Cohen's d | 95% CI
+## --------------------------
+## -1.48 | [-2.27, -0.67]
+## - Estimated using pooled SD
+
+hedges_g(mpg ~ am, data = mtcars)
+## Hedge's g | 95% CI
+## --------------------------
+## -1.44 | [-2.21, -0.65]
+## - Estimated using pooled SD
+## - Bias corrected using Hedges and Olkin's correction
+
+glass_delta(mpg ~ am, data = mtcars)
+## Glass' delta | 95% CI
+## -----------------------------
+## -1.17 | [-1.93, -0.40]
```
### ANOVAs (Eta2, Omega2, …)
``` r
-model <- aov(Sepal.Length ~ Species, data = iris)
+model <- aov(mpg ~ factor(gear), data = mtcars)
eta_squared(model)
-## Parameter | Eta2 (partial) | 90% CI
-## -----------------------------------------
-## Species | 0.62 | [0.54, 0.68]
+## Parameter | Eta2 | 90% CI
+## ----------------------------------
+## factor(gear) | 0.43 | [0.18, 0.59]
omega_squared(model)
-## Parameter | Omega2 (partial) | 90% CI
-## -------------------------------------------
-## Species | 0.61 | [0.53, 0.67]
+## Parameter | Omega2 | 90% CI
+## ------------------------------------
+## factor(gear) | 0.38 | [0.14, 0.55]
epsilon_squared(model)
-## Parameter | Epsilon2 (partial) | 90% CI
-## ---------------------------------------------
-## Species | 0.61 | [0.54, 0.67]
+## Parameter | Epsilon2 | 90% CI
+## --------------------------------------
+## factor(gear) | 0.39 | [0.14, 0.56]
```
And more…
@@ -116,17 +119,17 @@ methods](https://easystats.github.io/effectsize/articles/standardize_parameters.
to compute standardized parameters for regression models.
``` r
-m <- lm(Sepal.Length ~ Species + Sepal.Width, data = iris)
+m <- lm(rating ~ complaints + privileges + advance, data = attitude)
standardize_parameters(m)
-## Parameter | Coefficient (std.) | 95% CI
-## -------------------------------------------------------
-## (Intercept) | -1.37 | [-1.55, -1.20]
-## Speciesversicolor | 1.76 | [ 1.49, 2.03]
-## Speciesvirginica | 2.35 | [ 2.11, 2.59]
-## Sepal.Width | 0.42 | [ 0.31, 0.53]
+## 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]
##
-## # Standardization method: Refit
+## # Standardization method: refit
```
Also, models can be re-fit with standardized data:
@@ -135,11 +138,11 @@ Also, models can be re-fit with standardized data:
standardize(m)
##
## Call:
-## lm(formula = Sepal.Length ~ Species + Sepal.Width, data = data_std)
+## lm(formula = rating ~ complaints + privileges + advance, data = data_std)
##
## Coefficients:
-## (Intercept) Speciesversicolor Speciesvirginica Sepal.Width
-## -1.371 1.762 2.351 0.423
+## (Intercept) complaints privileges advance
+## -9.57e-16 8.55e-01 -4.35e-02 -2.19e-02
```
@@ -210,13 +213,13 @@ data.
A standardization sets the mean and SD to 0 and 1:
``` r
-library(parameters)
+library(parameters) # for describe_distribution
-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
+df <- standardize(attitude)
+describe_distribution(df$rating)
+## Mean | SD | IQR | Range | Skewness | Kurtosis | n | n_Missing
+## ----------------------------------------------------------------------------
+## -5.46e-16 | 1 | 1.29 | [-2.02, 1.67] | -0.40 | -0.49 | 30 | 0
```
Alternatively, normalization is similar to standardization in that it is
@@ -226,11 +229,11 @@ a 0 - 1 range, which can be useful in cases where you want to compare or
visualise data on the same scale.
``` r
-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
+df <- normalize(attitude)
+describe_distribution(df$rating)
+## Mean | SD | IQR | Range | Skewness | Kurtosis | n | n_Missing
+## ------------------------------------------------------------------------
+## 0.55 | 0.27 | 0.35 | [0.00, 1.00] | -0.40 | -0.49 | 30 | 0
```
This is a special case of a rescaling function, which can be used to
@@ -238,11 +241,11 @@ rescale the data to an arbitrary new scale. Let’s change all numeric
variables to “percentages”:
``` r
-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
+df <- change_scale(attitude, to = c(0, 100))
+describe_distribution(df$rating)
+## Mean | SD | IQR | Range | Skewness | Kurtosis | n | n_Missing
+## -----------------------------------------------------------------------------
+## 54.74 | 27.05 | 35.00 | [0.00, 100.00] | -0.40 | -0.49 | 30 | 0
```
For some robust statistics, one might also want to transfom the numeric
diff --git a/man/F_to_eta2.Rd b/man/F_to_eta2.Rd
index 1341b7aed..cdc479872 100644
--- a/man/F_to_eta2.Rd
+++ b/man/F_to_eta2.Rd
@@ -51,9 +51,12 @@ t_to_f2(t, df_error, ci = 0.9, squared = TRUE, ...)
\item{squared}{Return Cohen's \emph{f} or Cohen's \emph{f}-squared?}
}
\value{
-A data frame with the effect size(s) between 0-1, and confidence interval(s) (Note that for \eqn{\omega_p^2} and \eqn{\epsilon_p^2}
-it is possible to compute a negative number; even though this doesn't make any practical sense,
-it is recommended to report the negative number and not a 0).
+A data frame with the effect size(s) between 0-1 (\code{Eta2_partial},
+\code{Epsilon2_partial}, \code{Omega2_partial}, \code{Cohens_f_partial} or
+\code{Cohens_f2_partial}), and their CIs (\code{CI_low} and \code{CI_high}). (Note that
+for \eqn{\omega_p^2} and \eqn{\epsilon_p^2} it is possible to compute a
+negative number; even though this doesn't make any practical sense, it is
+recommended to report the negative number and not a 0).
}
\description{
These functions are convenience functions to convert F and t test statistics to
diff --git a/man/adjust.Rd b/man/adjust.Rd
index a3ccf70ae..1b77d62bd 100644
--- a/man/adjust.Rd
+++ b/man/adjust.Rd
@@ -17,38 +17,48 @@ adjust(
\arguments{
\item{data}{A dataframe.}
-\item{effect}{Character vector of column names to be adjusted for (regressed out). If \code{NULL} (the default), all variables will be selected.}
+\item{effect}{Character vector of column names to be adjusted for (regressed
+out). If \code{NULL} (the default), all variables will be selected.}
\item{select}{Character vector of column names. If \code{NULL} (the default), all
variables will be selected.}
\item{exclude}{Character vector of column names to be excluded from selection.}
-\item{multilevel}{If \code{TRUE}, the factors are included as random factors. Else, if \code{FALSE} (default), they are included as fixed effects in the simple regression model.}
+\item{multilevel}{If \code{TRUE}, the factors are included as random factors.
+Else, if \code{FALSE} (default), they are included as fixed effects in the
+simple regression model.}
-\item{additive}{If \code{TRUE}, continuous variables as included as smooth terms in additive models. The goal is to regress-out potential non-linear effects.}
+\item{additive}{If \code{TRUE}, continuous variables as included as smooth terms
+in additive models. The goal is to regress-out potential non-linear
+effects.}
-\item{bayesian}{If \code{TRUE}, the models are fitted under the Bayesian framework using \code{rstanarm}.}
+\item{bayesian}{If \code{TRUE}, the models are fitted under the Bayesian framework
+using \code{rstanarm}.}
+}
+\value{
+A data frame comparable to \code{data}, with adjusted variables.
}
\description{
-This function can be used to adjust the data for the effect of other variables present in the dataset. It is based on an underlying fitting of regressions models, allowing for quite some flexibility, such as including factors as random effects in mixed models (multilevel partialization), continuous variables as smooth terms in general additive models (non-linear partialization) and/or fitting these models under a Bayesian framework. The values returned by this function are the residuals of the regression models. Note that a regular correlation between two "adjusted" variables is equivalent to the partial correlation between them.
+This function can be used to adjust the data for the effect of other
+variables present in the dataset. It is based on an underlying fitting of
+regressions models, allowing for quite some flexibility, such as including
+factors as random effects in mixed models (multilevel partialization),
+continuous variables as smooth terms in general additive models (non-linear
+partialization) and/or fitting these models under a Bayesian framework. The
+values returned by this function are the residuals of the regression models.
+Note that a regular correlation between two "adjusted" variables is
+equivalent to the partial correlation between them.
}
\examples{
-adjust(iris, effect = "Species", select = "Sepal.Length")
+adjust(attitude)
+adjust(attitude, effect = "complaints", select = "rating")
\donttest{
\dontrun{
-adjust(iris, effect = "Species", select = "Sepal.Length", multilevel = TRUE)
-adjust(iris, effect = "Species", select = "Sepal.Length", bayesian = TRUE)
-adjust(iris, effect = "Petal.Width", select = "Sepal.Length", additive = TRUE)
-adjust(iris,
- effect = "Petal.Width", select = "Sepal.Length",
- additive = TRUE, bayesian = TRUE
-)
-adjust(iris,
- effect = c("Petal.Width", "Species"), select = "Sepal.Length",
- multilevel = TRUE, additive = TRUE
-)
-adjust(iris)
+adjust(attitude, effect = "complaints", select = "rating", bayesian = TRUE)
+adjust(attitude, effect = "complaints", select = "rating", additive = TRUE)
+attitude$complaints_LMH <- cut(attitude$complaints, 3)
+adjust(attitude, effect = "complaints_LMH", select = "rating", multilevel = TRUE)
}
}
diff --git a/man/change_scale.Rd b/man/change_scale.Rd
index fba8e52dd..4f9e78e8c 100644
--- a/man/change_scale.Rd
+++ b/man/change_scale.Rd
@@ -55,7 +55,7 @@ Rescale a numeric variable to a new range.
change_scale(c(0, 1, 5, -5, -2))
change_scale(c(0, 1, 5, -5, -2), to = c(-5, 5))
-head(change_scale(iris))
+head(change_scale(trees))
}
\seealso{
\code{\link[=normalize]{normalize()}} \code{\link[=standardize]{standardize()}} \code{\link[=ranktransform]{ranktransform()}}
diff --git a/man/chisq_to_phi.Rd b/man/chisq_to_phi.Rd
index 850bded11..8cdbc3c62 100644
--- a/man/chisq_to_phi.Rd
+++ b/man/chisq_to_phi.Rd
@@ -31,7 +31,8 @@ phi_to_chisq(phi, n, ...)
\item{phi}{The Phi statistic.}
}
\value{
-A data frame with the effect size(s) between 0-1, and confidence interval(s).
+A data frame with the effect size(s) between 0-1, and confidence
+interval(s). See \code{\link[=cramers_v]{cramers_v()}}.
}
\description{
Convert between Chi square, (\eqn{\chi^2}), Cramer's V, phi (\eqn{\phi}) and
diff --git a/man/cohens_d.Rd b/man/cohens_d.Rd
index f9a9b0f0f..5582aeb26 100644
--- a/man/cohens_d.Rd
+++ b/man/cohens_d.Rd
@@ -62,7 +62,8 @@ Not applicable to Glass' Delta (See \code{\link[=d_to_common_language]{d_to_comm
\item{...}{Not used.}
}
\value{
-A data frame with the effect size(s) and confidence interval(s).
+A data frame with the effect size ( \code{Cohens_d}, \code{Hedges_g},
+\code{Glass_delta}) and their CIs (\code{CI_low} and \code{CI_high}).
}
\description{
Compute effect size indices for standardized differences: Cohen's \emph{d},
@@ -94,8 +95,10 @@ sizes. (See full \link{effectsize-CIs} for more.)
}
\examples{
-cohens_d(iris$Sepal.Length, iris$Sepal.Width)
-hedges_g("Sepal.Length", "Sepal.Width", data = iris)
+cohens_d(sleep$extra, sleep$group)
+hedges_g("extra", "group", data = sleep)
+
+cohens_d(sleep$extra[sleep$group==1], sleep$extra[sleep$group==2], paired = TRUE)
cohens_d(mpg ~ am, data = mtcars)
cohens_d(mpg ~ am, data = mtcars, pooled_sd = FALSE)
@@ -106,7 +109,7 @@ print(cohens_d(mpg ~ am, data = mtcars), append_CL = TRUE)
}
\references{
\itemize{
-\item Cohen, J. (2013). Statistical power analysis for the behavioral sciences. Routledge.
+\item Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd Ed.). New York: Routledge.
\item Hedges, L. V. & Olkin, I. (1985). Statistical methods for meta-analysis. Orlando, FL: Academic Press.
\item Hunter, J. E., & Schmidt, F. L. (2004). Methods of meta-analysis: Correcting error and bias in research findings. Sage.
\item McGrath, R. E., & Meyer, G. J. (2006). When effect sizes disagree: the case of r and d. Psychological methods, 11(4), 386.
diff --git a/man/d_to_common_language.Rd b/man/d_to_common_language.Rd
index a7685d1f4..17a98fa52 100644
--- a/man/d_to_common_language.Rd
+++ b/man/d_to_common_language.Rd
@@ -12,6 +12,9 @@ convert_d_to_common_language(d)
\arguments{
\item{d}{Standardized difference value (Cohen's d).}
}
+\value{
+A list of \verb{Cohen's U3}, \code{Overlap}, \verb{Probability of superiority}.
+}
\description{
Convert Standardized Mean Difference to Common Language Effect Sizes
}
@@ -29,7 +32,7 @@ normally distributed.
}
\references{
\itemize{
-\item Cohen, J. (1977). Statistical power analysis for the behavioral sciencies. Routledge.
+\item Cohen, J. (1977). Statistical power analysis for the behavioral sciences. New York: Routledge.
\item Reiser, B., & Faraggi, D. (1999). Confidence intervals for the overlapping coefficient: the normal equal variance case. Journal of the Royal Statistical Society, 48(3), 413-418.
\item Ruscio, J. (2008). A probability-based measure of effect size: robustness to base rates and other factors. Psychological methods, 13(1), 19–30.
}
diff --git a/man/effectsize.Rd b/man/effectsize.Rd
index e138ebdd4..22e9f4f70 100644
--- a/man/effectsize.Rd
+++ b/man/effectsize.Rd
@@ -22,6 +22,10 @@ effectsize(model, ...)
\item{type}{The effect size of interest. See details.}
}
+\value{
+A data frame with the effect size (depending on input) and and its
+CIs (\code{CI_low} and \code{CI_high}).
+}
\description{
This function tries to return the best effect-size measure for the provided
input model. See details.
@@ -71,7 +75,7 @@ if (require(BayesFactor)) {
bf1 <- ttestBF(mtcars$mpg[mtcars$am == 1], mtcars$mpg[mtcars$am == 0])
effectsize(bf1, test = NULL)
- bf2 <- correlationBF(iris$Sepal.Length, iris$Sepal.Width)
+ bf2 <- correlationBF(attitude$rating, attitude$complaints)
effectsize(bf2, test = NULL)
data(raceDolls)
diff --git a/man/equivalence_test.effectsize_table.Rd b/man/equivalence_test.effectsize_table.Rd
index 0b08c627e..a099f3153 100644
--- a/man/equivalence_test.effectsize_table.Rd
+++ b/man/equivalence_test.effectsize_table.Rd
@@ -23,7 +23,7 @@ the lower bound is set to 0. If \code{"default"}, will be set to \verb{[-.1, .1]
\item{...}{Arguments passed to or from other methods.}
}
\value{
-A data frame.
+A data frame with the results of the equivalence test.
}
\description{
Perform a \strong{Test for Practical Equivalence} for indices of effect size.
diff --git a/man/eta_squared.Rd b/man/eta_squared.Rd
index 728ec3f66..e02be00c9 100644
--- a/man/eta_squared.Rd
+++ b/man/eta_squared.Rd
@@ -84,7 +84,9 @@ from the posterior predictive distribution to return. Larger numbers take
longer to run, but provide estimates that are more stable.}
}
\value{
-A data frame with the effect size(s) and confidence interval(s).
+A data frame with the effect size(s) between 0-1 (\code{Eta2}, \code{Epsilon2},
+\code{Omega2}, \code{Cohens_f} or \code{Cohens_f2}, possibly with the \code{partial} or
+\code{generalized} suffix), and their CIs (\code{CI_low} and \code{CI_high}).
\cr\cr
For \code{eta_squared_posterior()}, a data frame containing the ppd of the Eta
squared for each fixed effect, which can then be passed to
@@ -132,6 +134,10 @@ which to choose?
Though Omega is the more popular choice (Albers \& Lakens, 2018), Epsilon is
analogous to adjusted R2 (Allen, 2017, p. 382), and has been found to be less
biased (Carroll & Nordholm, 1975).
+\cr\cr
+(Note that for \eqn{\omega_p^2} and \eqn{\epsilon_p^2} it is possible to
+compute a negative number; even though this doesn't make any practical sense,
+it is recommended to report the negative number and not a 0.)
}
\subsection{Cohen's f}{
diff --git a/man/interpret_d.Rd b/man/interpret_d.Rd
index e1680c499..f7be03b3b 100644
--- a/man/interpret_d.Rd
+++ b/man/interpret_d.Rd
@@ -61,7 +61,7 @@ interpret_d(c(.5, .02))
\references{
\itemize{
\item Gignac, G. E., & Szodorai, E. T. (2016). Effect size guidelines for individual differences researchers. Personality and individual differences, 102, 74-78.
-\item Cohen, J. (1988). Statistical power analysis for the behavioural sciences.
+\item Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd Ed.). New York: Routledge.
\item Sawilowsky, S. S. (2009). New effect size rules of thumb.
}
}
diff --git a/man/interpret_oddsratio.Rd b/man/interpret_oddsratio.Rd
index c81d069ba..713fd9c08 100644
--- a/man/interpret_oddsratio.Rd
+++ b/man/interpret_oddsratio.Rd
@@ -45,7 +45,7 @@ interpret_oddsratio(c(5, 2))
}
\references{
\itemize{
-\item Cohen, J. (1988). Statistical power analysis for the behavioural sciences.
+\item Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd Ed.). New York: Routledge.
\item Chen, H., Cohen, P., & Chen, S. (2010). How big is a big odds ratio? Interpreting the magnitudes of odds ratios in epidemiological studies. Communications in Statistics—Simulation and Computation, 39(4), 860-864.
\item Sánchez-Meca, J., Marín-Martínez, F., & Chacón-Moscoso, S. (2003). Effect-size indices for dichotomized outcomes in meta-analysis. Psychological methods, 8(4), 448.
}
diff --git a/man/interpret_parameters.Rd b/man/interpret_parameters.Rd
index 1c8d0573d..ea8f19083 100644
--- a/man/interpret_parameters.Rd
+++ b/man/interpret_parameters.Rd
@@ -39,7 +39,3 @@ interpret_parameters(model, ...)
\description{
Automated interpretation of standardized slopes.
}
-\examples{
-model <- lm(Sepal.Length ~ Species * Petal.Width, data = iris)
-interpret_parameters(model)
-}
diff --git a/man/interpret_r.Rd b/man/interpret_r.Rd
index 9806adb53..0487ac6bb 100644
--- a/man/interpret_r.Rd
+++ b/man/interpret_r.Rd
@@ -61,7 +61,7 @@ interpret_r(c(.5, -.02))
\itemize{
\item Funder, D. C., & Ozer, D. J. (2019). Evaluating effect size in psychological research: sense and nonsense. Advances in Methods and Practices in Psychological Science.
\item Gignac, G. E., & Szodorai, E. T. (2016). Effect size guidelines for individual differences researchers. Personality and individual differences, 102, 74-78.
-\item Cohen, J. (1988). Statistical power analysis for the behavioural sciences.
+\item Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd Ed.). New York: Routledge.
\item Evans, J. D. (1996). Straightforward statistics for the behavioral sciences. Thomson Brooks/Cole Publishing Co.
}
}
diff --git a/man/interpret_r2.Rd b/man/interpret_r2.Rd
index 712542371..662f71ad2 100644
--- a/man/interpret_r2.Rd
+++ b/man/interpret_r2.Rd
@@ -59,7 +59,7 @@ interpret_r2(c(.5, .02))
}
\references{
\itemize{
-\item Cohen, J. (1988). Statistical power analysis for the behavioural sciences.
+\item Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd Ed.). New York: Routledge.
\item Falk, R. F., & Miller, N. B. (1992). A primer for soft modeling. University of Akron Press.
\item Chin, W. W. (1998). The partial least squares approach to structural equation modeling. Modern methods for business research, 295(2), 295-336.
\item Hair, J. F., Ringle, C. M., & Sarstedt, M. (2011). PLS-SEM: Indeed a silver bullet. Journal of Marketing theory and Practice, 19(2), 139-152.
diff --git a/man/normalize.Rd b/man/normalize.Rd
index 2db7b016a..46752ca99 100644
--- a/man/normalize.Rd
+++ b/man/normalize.Rd
@@ -59,7 +59,7 @@ the range 0 - 1. This is a special case of \code{\link[=change_scale]{change_sca
normalize(c(0, 1, 5, -5, -2))
normalize(c(0, 1, 5, -5, -2), include_bounds = FALSE)
-head(normalize(iris))
+head(normalize(trees))
}
\references{
\itemize{
diff --git a/man/odds_to_probs.Rd b/man/odds_to_probs.Rd
index 73efdbf0c..6ba00f6b5 100644
--- a/man/odds_to_probs.Rd
+++ b/man/odds_to_probs.Rd
@@ -36,6 +36,9 @@ from transformation.}
\item{probs}{Probability values to convert.}
}
+\value{
+Converted index.
+}
\description{
Convert between Odds and Probabilities
}
diff --git a/man/oddsratio_to_riskratio.Rd b/man/oddsratio_to_riskratio.Rd
index d8a7a4dca..656fc571b 100644
--- a/man/oddsratio_to_riskratio.Rd
+++ b/man/oddsratio_to_riskratio.Rd
@@ -16,6 +16,9 @@ riskratio_to_oddsratio(RR, p0, log = FALSE)
\item{log}{Take in or output the log of the ratio (such as in logistic models).}
}
+\value{
+Converted index.
+}
\description{
Convert between Odds ratios and Risk ratios
}
diff --git a/man/phi.Rd b/man/phi.Rd
index cfd1f6d09..0e9cf23ec 100644
--- a/man/phi.Rd
+++ b/man/phi.Rd
@@ -40,7 +40,9 @@ for \code{cohens_g()}.}
\item{log}{Take in or output the log of the ratio (such as in logistic models).}
}
\value{
-A data frame with the effect size(s), and confidence interval(s).
+A data frame with the effect size (\code{Cramers_v}, \code{phi} (possibly with
+the suffix \verb{_adjusted}), \code{Odds_ratio}, \code{Risk_ratio} (possibly with the
+prefix \code{log_}), or \code{Cohens_g}) and its CIs (\code{CI_low} and \code{CI_high}).
}
\description{
Compute Cramer's \emph{V}, phi (\eqn{\phi}), Cohen's \emph{w} (an alias of phi), Odds
@@ -152,7 +154,7 @@ cohens_g(Performance)
}
\references{
\itemize{
-\item Cohen, J. (1988). Statistical power analysis for the behavioural sciences.
+\item Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd Ed.). New York: Routledge.
\item Katz, D. J. S. M., Baptista, J., Azen, S. P., & Pike, M. C. (1978). Obtaining confidence intervals for the risk ratio in cohort studies. Biometrics, 469-474.
\item Szumilas, M. (2010). Explaining odds ratios. Journal of the Canadian academy of child and adolescent psychiatry, 19(3), 227.
}
diff --git a/man/ranktransform.Rd b/man/ranktransform.Rd
index 85ebd1fd5..9e3ffe63e 100644
--- a/man/ranktransform.Rd
+++ b/man/ranktransform.Rd
@@ -55,7 +55,8 @@ Transform numeric values with the integers of their rank (i.e., 1st smallest, 2n
ranktransform(c(0, 1, 5, -5, -2))
ranktransform(c(0, 1, 5, -5, -2), sign = TRUE)
-head(ranktransform(iris))
+head(ranktransform(trees))
+
}
\seealso{
Other transform utilities:
diff --git a/man/standardize.Rd b/man/standardize.Rd
index 95804783d..2a8ffaf8e 100644
--- a/man/standardize.Rd
+++ b/man/standardize.Rd
@@ -155,10 +155,10 @@ parameter is the OR of a change of 1 SD in the predictor, etc.)
\examples{
# Data frames
-summary(standardize(iris))
+summary(standardize(swiss))
# Models
-model <- lm(Sepal.Length ~ Species * Petal.Width, data = iris)
+model <- lm(Infant.Mortality ~ Education * Fertility, data = swiss)
coef(standardize(model))
}
\seealso{
diff --git a/man/standardize_info.Rd b/man/standardize_info.Rd
index 5042a4f82..cdda9d084 100644
--- a/man/standardize_info.Rd
+++ b/man/standardize_info.Rd
@@ -30,11 +30,21 @@ outcome) (Gelman, 2008).}
\item{...}{Arguments passed to or from other methods.}
}
+\value{
+A data frame with information on each parameter (see
+\link[parameters:parameters_type]{parameters::parameters_type}), and various standardization coefficients
+for the post-hoc methods (see \code{\link[=standardize_parameters]{standardize_parameters()}}) for the predictor
+and the response.
+}
\description{
This function extracts information, such as the deviations (SD or MAD) from parent variables, that are necessary for post-hoc standardization of parameters. This function gives a window on how standardized are obtained, i.e., by what they are devided. The "basic" method of standardization uses
}
\examples{
-model <- lm(Sepal.Width ~ Sepal.Length * Species, data = iris)
+model <- lm(mpg ~ ., data = mtcars)
+standardize_info(model)
+standardize_info(model, robust = TRUE)
+standardize_info(model, two_sd = TRUE)
+
}
\seealso{
Other standardize:
diff --git a/man/standardize_parameters.Rd b/man/standardize_parameters.Rd
index deee5dda8..5cadf7e3b 100644
--- a/man/standardize_parameters.Rd
+++ b/man/standardize_parameters.Rd
@@ -59,9 +59,9 @@ outcome) (Gelman, 2008).}
}}
}
\value{
-A data frame with the standardized parameters and their CIs.
-
-Standardized parameters table.
+A data frame with the standardized parameters (\verb{Std_*}, depending on
+the model type) and their CIs (\code{CI_low} and \code{CI_high}). Where applicable,
+standard errors (SEs) are returned as an attribute (\code{attr(x, "standard_error")}).
}
\description{
Compute standardized model parameters (coefficients).
@@ -137,9 +137,8 @@ parameter is the OR of a change of 1 SD in the predictor, etc.)
\examples{
library(effectsize)
-data(iris)
-model <- lm(Sepal.Length ~ Species * Petal.Width, data = iris)
+model <- lm(len ~ supp * dose, data = ToothGrowth)
standardize_parameters(model, method = "refit")
\donttest{
standardize_parameters(model, method = "posthoc")
@@ -166,10 +165,10 @@ if (require("lme4")) {
\dontrun{
if (require("rstanarm")) {
- model <- stan_glm(Sepal.Length ~ Species + Petal.Width, data = iris, refresh = 0)
- # standardize_posteriors(model, method = "refit")
- # standardize_posteriors(model, method = "posthoc")
- # standardize_posteriors(model, method = "smart")
+ model <- stan_glm(rating ~ critical + privileges, data = attitude, refresh = 0)
+ standardize_posteriors(model, method = "refit")
+ standardize_posteriors(model, method = "posthoc")
+ standardize_posteriors(model, method = "smart")
head(standardize_posteriors(model, method = "basic"))
}
}
diff --git a/man/t_to_r.Rd b/man/t_to_r.Rd
index 60be194a8..fe411b739 100644
--- a/man/t_to_r.Rd
+++ b/man/t_to_r.Rd
@@ -24,7 +24,8 @@ F_to_r(f, df, df_error, ci = 0.95, ...)
\arguments{
\item{t, f, z}{The t, the F or the z statistics.}
-\item{paired}{Should the estimate accout for the t-value being testing the difference between dependant means?}
+\item{paired}{Should the estimate accout for the t-value being testing the
+difference between dependant means?}
\item{ci}{Confidence Interval (CI) level}
@@ -34,15 +35,19 @@ F_to_r(f, df, df_error, ci = 0.95, ...)
\item{n}{The number of observations (the sample size).}
-\item{df, df_error}{Degrees of freedom of numerator or of the error estimate (i.e., the residuals).}
+\item{df, df_error}{Degrees of freedom of numerator or of the error estimate
+(i.e., the residuals).}
}
\value{
-A data frame with the effect size(s) between 0-1, and confidence interval(s)
+A data frame with the effect size(s)(\code{r} or \code{d}), and their CIs
+(\code{CI_low} and \code{CI_high}).
}
\description{
-These functions are convenience functions to convert t, z and F test statistics to Cohen's d and
-\strong{partial} r. These are useful in cases where the data required to compute these are not easily
-available or their computation is not straightforward (e.g., in liner mixed models, contrasts, etc.).
+These functions are convenience functions to convert t, z and F test
+statistics to Cohen's d and \strong{partial} r. These are useful in cases where
+the data required to compute these are not easily available or their
+computation is not straightforward (e.g., in liner mixed models, contrasts,
+etc.).
\cr
See \href{https://easystats.github.io/effectsize/articles/from_test_statistics.html}{Effect Size from Test Statistics vignette.}
}
@@ -84,7 +89,7 @@ t_to_d(t = res$statistic, res$parameter, paired = TRUE)
t_to_r(t = res$statistic, res$parameter)
\donttest{
## Linear Regression
-model <- lm(Sepal.Length ~ Sepal.Width + Petal.Length, data = iris)
+model <- lm(rating ~ complaints + critical, data = attitude)
library(parameters)
(param_tab <- parameters(model))
@@ -94,7 +99,7 @@ if (require(see)) plot(rs)
# How does this compare to actual partial correlations?
if (require("correlation")) {
- correlation::correlation(iris[, 1:3], partial = TRUE)[1:2, c(2, 3, 7, 8)]
+ correlation::correlation(attitude[, c(1, 2, 6)], partial = TRUE)[1:2, c(2, 3, 7, 8)]
}
## Use with emmeans based contrasts (see also t_to_eta2)
diff --git a/paper/paper.bib b/paper/paper.bib
index ded177cac..cb7a2e3e9 100644
--- a/paper/paper.bib
+++ b/paper/paper.bib
@@ -124,10 +124,10 @@ @manual{kelley2020MBESS
}
@book{cohen1988statistical,
- title={Statistical power analysis for the behavioral sciences, 2nd edn. {\'A}/L},
+ title={Statistical power analysis for the behavioral sciences, 2nd ed.},
author={Cohen, J},
year={1988},
- publisher={Erbaum Press, Hillsdale, NJ, USA}
+ publisher={New York: Routledge}
}
@article{hedges1985statistical,
@@ -142,4 +142,41 @@ @book{hedges2014statistical
author={Hedges, Larry V and Olkin, Ingram},
year={2014},
publisher={Academic press}
+}
+
+@article{bollen1989structural,
+ title={Structural equations with latent variables Wiley},
+ author={Bollen, Kenneth A},
+ journal={New York},
+ year={1989}
+}
+
+@book{cramer1946mathematical,
+ title={Mathematical Methods of Statistics},
+ author={Cram{\'e}r, Harald},
+ year={1946},
+ publisher={Princeton: Princeton University Press}
+}
+
+@article{kelley1935unbiased,
+ title={An unbiased correlation ratio measure},
+ author={Kelley, Truman L},
+ journal={Proceedings of the National Academy of Sciences of the United States of America},
+ volume={21},
+ number={9},
+ pages={554},
+ year={1935},
+ publisher={National Academy of Sciences}
+}
+
+
+@article{friedman1982simplified,
+ title={Simplified determinations of statistical power, magnitude of effect and research sample sizes},
+ author={Friedman, Herbert},
+ journal={Educational and Psychological Measurement},
+ volume={42},
+ number={2},
+ pages={521--526},
+ year={1982},
+ publisher={Sage Publications Sage CA: Thousand Oaks, CA}
}
\ No newline at end of file
diff --git a/paper/paper.md b/paper/paper.md
index 0473217b8..f12d60fe6 100644
--- a/paper/paper.md
+++ b/paper/paper.md
@@ -35,14 +35,15 @@ affiliations:
# Aims of the Package
-In both theoretical and applied research, it is often of interest to assess the strength of an observed association. This is typically done to allow the judgment of the magnitude of an effect (especially when units of measurement are not meaningful), to facilitate comparing between predictors' importance within a given model, or both. Though some indices of effect size, such as the correlation coefficient (itself a standardized covariance coefficient) are readily available, other measures are often harder to obtain. **effectsize** is an R package [@rcore] that fills this important gap, providing utilities for easily estimating a wide variety of standardized effect sizes (i.e., effect sizes that are not tied to the units of measurement of the variables of interest) and their confidence intervals (CIs), from a variety of statistical models. **effectsize** provides easy-to-use functions, with full documentation and explanation of the various effect sizes offered, and is also used by developers of other R packages as the back-end for effect size computation, such as **parameters** [@ludecke2020extracting], **ggstatsplot** [@patil2020ggstatsplot], **gtsummary** [@sjoberg2020gtsummary] and more.
+In both theoretical and applied research, it is often of interest to assess the strength of an observed association. This is typically done to allow the judgment of the magnitude of an effect [especially when units of measurement are not meaningful, e.g. in the use of estimated latent variables; @bollen1989structural], to facilitate comparing between predictors' importance within a given model, or both. Though some indices of effect size, such as the correlation coefficient (itself a standardized covariance coefficient) are readily available, other measures are often harder to obtain. **effectsize** is an R package [@rcore] that fills this important gap, providing utilities for easily estimating a wide variety of standardized effect sizes (i.e., effect sizes that are not tied to the units of measurement of the variables of interest) and their confidence intervals (CIs), from a variety of statistical models. **effectsize** provides easy-to-use functions, with full documentation and explanation of the various effect sizes offered, and is also used by developers of other R packages as the back-end for effect size computation, such as **parameters** [@ludecke2020extracting], **ggstatsplot** [@patil2020ggstatsplot], **gtsummary** [@sjoberg2020gtsummary] and more.
# Comparison to Other Packages
**effectsize**'s functionality is in part comparable to packages like **lm.beta** [@behrendt2014lmbeta], **MOTE** [@buchanan2019MOTE] or **MBESS** [@kelley2020MBESS]. Yet, there are some notable differences, e.g.:
- **lm.beta** provides standardized regression coefficients for linear models, based on post-hoc model matrix standardization. However, the functionality is available only for a limited number of models (models inheriting from the `lm` class), whereas **effectsize** provides support for many types of models, including (generalized) linear mixed models, Bayesian models, and more. Additionally, in additional to post-hoc model matrix standardization, **effectsize** offers other methods of standardization (see below).
-- Both **MOTE** and **MBESS** provide functions for computing effect sizes such as Cohen's *d* and effect sizes for ANOVAs, and their confidence intervals. However, both require manual input of *F*- or *t*-statistics, *degrees of freedom*, and *Sums of Squares* for the computation the effect sizes, whereas **effectsize** can automatically extract this information from the provided models, thus allowing for better ease-of-use as well as reducing any potential for error.
+- Both **MOTE** and **MBESS** provide functions for computing effect sizes such as Cohen's *d* and effect sizes for ANOVAs [@cohen1988statistical], and their confidence intervals. However, both require manual input of *F*- or *t*-statistics, *degrees of freedom*, and *Sums of Squares* for the computation the effect sizes, whereas **effectsize** can automatically extract this information from the provided models, thus allowing for better ease-of-use as well as reducing any potential for error.
+- Finally, in **base R**, the function `scale()` can be used to standardize vectors, matrices and data frame, which can be used to standardize data prior to model fitting. The coefficients of a linear model fit on such data are in effect standardized regression coefficients. **effectsize** expands an this, allowing for robust standardization (using the median and the MAD, instead of the mean and SD), post-hoc parameter standardization, and more.
# Examples of Features
@@ -59,11 +60,14 @@ cohens_d(mpg ~ am, data = mtcars)
#> Cohen's d | 95% CI
#> --------------------------
#> -1.48 | [-2.27, -0.67]
+#>
+#> - Estimated using pooled SD.
+
```
### Contingency Tables
-Pearson's $\phi$ (`phi()`) and Cramér's *V* (`cramers_v()`) can be used to estimate the strength of association between two categorical variables, while Cohen's *g* (`cohens_g()`) estimates the deviance between paired categorical variables.
+Pearson's $\phi$ (`phi()`) and Cramér's *V* (`cramers_v()`) can be used to estimate the strength of association between two categorical variables [@cramer1946mathematical], while Cohen's *g* (`cohens_g()`) estimates the deviance between paired categorical variables [@cohen1988statistical].
``` r
M <- rbind(c(150, 130, 35, 55),
@@ -101,7 +105,7 @@ standardize_parameters(model)
#> am | 0.17 | [-0.04, 0.39]
#> cyl:am | -0.19 | [-0.41, 0.02]
#>
-#> # Standardization method: Refit
+#> # Standardization method: refit
```
Standardized parameters can also be produced for generalized linear models (GLMs; where only the predictors are standardized):
@@ -109,7 +113,7 @@ Standardized parameters can also be produced for generalized linear models (GLMs
``` r
model <- glm(am ~ cyl + hp,
family = "binomial",
- data = mtcars, )
+ data = mtcars)
standardize_parameters(model, exponentiate = TRUE)
#> Parameter | Odds Ratio (std.) | 95% CI
@@ -118,14 +122,14 @@ standardize_parameters(model, exponentiate = TRUE)
#> cyl | 0.05 | [0.00, 0.29]
#> hp | 6.70 | [1.32, 61.54]
#>
-#> # Standardization method: Refit
+#> # Standardization method: refit
```
`standardize_parameters()` provides several standardization methods, such as robust standardization, or *pseudo*-standardized coefficients for (generalized) linear mixed models [@hoffman2015longitudinal]. A full review of these methods can be found in the [*Parameter and Model Standardization* vignette](https://easystats.github.io/effectsize/articles/standardize_parameters.html).
## Effect Sizes for ANOVAs
-Unlike standardized parameters, the effect sizes reported in the context of ANOVAs (analysis of variance) or ANOVA-like tables represent the amount of variance explained by each of the model's terms, where each term can be represented by one or more parameters. `eta_squared()` can produce such popular effect sizes as Eta-squared ($\eta^2$), its partial version ($\eta^2_p$), as well as the generalized $\eta^2_G$ [@olejnik2003generalized]:
+Unlike standardized parameters, the effect sizes reported in the context of ANOVAs (analysis of variance) or ANOVA-like tables represent the amount of variance explained by each of the model's terms, where each term can be represented by one or more parameters. `eta_squared()` can produce such popular effect sizes as Eta-squared ($\eta^2$), its partial version ($\eta^2_p$), as well as the generalized $\eta^2_G$ [@cohen1988statistical; @olejnik2003generalized]:
``` r
@@ -154,13 +158,13 @@ eta_squared(model, generalized = "Time")
#> Chick:Time | Diet:Time | 0.03 | [0.00, 0.00]
```
-**effectsize** also offers the unbiased estimates of $\epsilon^2_p$ (`epsilon_squared()`) and $\omega^2_p$ (`omega_squared()`). For more details about the various effect size measures and their applications, see the [*Effect sizes for ANOVAs* vignette](https://easystats.github.io/effectsize/articles/anovaES.html).
+**effectsize** also offers $\epsilon^2_p$ (`epsilon_squared()`) and $\omega^2_p$ (`omega_squared()`), which are less biased estimates of the variance explained in the population [@kelley1935unbiased; @olejnik2003generalized]. For more details about the various effect size measures and their applications, see the [*Effect sizes for ANOVAs* vignette](https://easystats.github.io/effectsize/articles/anovaES.html).
## Effect Size Conversion
### From Test Statistics
-In many real world applications there are no straightforward ways of obtaining standardized effect sizes. However, it is possible to get approximations of most of the effect size indices (*d*, *r*, $\eta^2_p$...) with the use of test statistics. These conversions are based on the idea that test statistics are a function of effect size and sample size (or more often of degrees of freedom). Thus it is possible to reverse-engineer indices of effect size from test statistics (*F*, *t*, $\chi^2$, and *z*).
+In many real world applications there are no straightforward ways of obtaining standardized effect sizes. However, it is possible to get approximations of most of the effect size indices (*d*, *r*, $\eta^2_p$...) with the use of test statistics [@friedman1982simplified]. These conversions are based on the idea that test statistics are a function of effect size and sample size (or more often of degrees of freedom). Thus it is possible to reverse-engineer indices of effect size from test statistics (*F*, *t*, $\chi^2$, and *z*).
``` r
F_to_eta2(f = c(40.72, 33.77),
diff --git a/vignettes/bibliography.bib b/vignettes/bibliography.bib
index 9ea400f2e..6e02ee31b 100644
--- a/vignettes/bibliography.bib
+++ b/vignettes/bibliography.bib
@@ -249,11 +249,11 @@ @book{falk1992primer
-@article{cohen1988statistical,
- title={Statistical power analysis for the social sciences},
- author={Cohen, Jacob},
+@book{cohen1988statistical,
+ title={Statistical power analysis for the behavioral sciences, 2nd ed.},
+ author={Cohen, J},
year={1988},
- publisher={Hillsdale, NJ: Erlbaum}
+ publisher={New York: Routledge}
}
diff --git a/vignettes/convert.Rmd b/vignettes/convert.Rmd
index b2f1915a0..8251c835f 100644
--- a/vignettes/convert.Rmd
+++ b/vignettes/convert.Rmd
@@ -39,17 +39,20 @@ The `effectsize` package contains function to convert among indices of effect si
The most basic conversion is between *r* values, a measure of standardized association between two continuous measures, and *d* values (such as Cohen's *d*), a measure of standardized differences between two groups / conditions.
-Let's look at the following data:
+Let's simulate some data:
-```{r, echo=FALSE}
+```{r}
set.seed(1)
data <- bayestestR::simulate_difference(n = 10,
d = 0.2,
names = c("Group", "Outcome"))
-data$Group <- as.numeric(data$Group)
+```
+
+```{r, echo=FALSE}
print(data, digits = 3)
```
+
We can compute Cohen's *d* between the two groups:
```{r}
@@ -58,8 +61,8 @@ cohens_d(Outcome ~ Group, data = data)
But we can also treat the 2-level `group` variable as a numeric variable, and compute Pearon's *r*:
-```{r}
-correlation::correlation(data)
+```{r, warning=FALSE}
+correlation::correlation(data)[2,]
```
diff --git a/vignettes/from_test_statistics.Rmd b/vignettes/from_test_statistics.Rmd
index f0e9507d1..ca7b48c7d 100644
--- a/vignettes/from_test_statistics.Rmd
+++ b/vignettes/from_test_statistics.Rmd
@@ -125,7 +125,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}
-model_parameters(fit_lmm, df_method = "satterthwaite")
+parameters::model_parameters(fit_lmm, df_method = "satterthwaite")
t_to_eta2(6.77, df_error = 17)
```
@@ -148,7 +148,7 @@ Similar to $\eta^2_p$, $r$ is a signal to noise ratio, and is in fact equal to $
### For Slopes
```{r}
-model_parameters(fit_lmm, df_method = "satterthwaite")
+parameters::model_parameters(fit_lmm, df_method = "satterthwaite")
t_to_r(6.77, df_error = 17)
```
@@ -157,18 +157,18 @@ In a fixed-effect linear model, this returns the **partial** correlation. Compar
```{r}
-fit_lm <- lm(Sepal.Length ~ Sepal.Width + Petal.Length, data = iris)
+fit_lm <- lm(rating ~ complaints + critical, data = attitude)
-model_parameters(fit_lm)
+parameters::model_parameters(fit_lm)
-t_to_r(t = c(8.59, 27.57),
- df_error = 147)
+t_to_r(t = c(7.46, 0.01),
+ df_error = 27)
```
to:
```{r, eval=require(correlation, quietly = TRUE)}
-correlation::correlation(iris[,1:3], partial = TRUE)[1:2, c(1:3,7:8)]
+correlation::correlation(attitude[, c(1, 2, 6)], partial = TRUE)[1:2, c(2, 3, 7, 8)]
```
### In Contrast Analysis
diff --git a/vignettes/standardize_parameters.Rmd b/vignettes/standardize_parameters.Rmd
index 601a55ff1..31b33a04d 100644
--- a/vignettes/standardize_parameters.Rmd
+++ b/vignettes/standardize_parameters.Rmd
@@ -54,7 +54,7 @@ Critically, **parameters standardization is not a trivial process**. Different t
```{r}
library(effectsize)
-m <- lm(Sepal.Length ~ Petal.Length, data = iris)
+m <- lm(rating ~ complaints, data = attitude)
standardize_parameters(m)
```
@@ -62,11 +62,9 @@ standardize_parameters(m)
Standardizing the coefficient of this *simple* linear regression gives a value of `0.87`, but did you know that for a simple regression this is actually the **same as a correlation**? Thus, you can eventually apply some (*in*)famous interpretation guidelines (e.g., Cohen's rules of thumb).
```{r}
-library(parameters)
+r <- cor.test(attitude$rating, attitude$complaints)
-r <- cor.test(iris$Sepal.Length, iris$Petal.Length)
-
-model_parameters(r)
+effectsize(r)
```
@@ -165,7 +163,7 @@ However, not all hope is lost yet - we can still try and recover the partial cor
```{r}
-params <- model_parameters(mod)
+params <- parameters::model_parameters(mod)
t_to_r(params$t[-1], df_error = params$df_error[-1])
```
@@ -184,7 +182,7 @@ hardlyworking$age_g <- cut(hardlyworking$age,
mod <- lm(salary ~ xtra_hours + n_comps + age_g + seniority,
data = hardlyworking)
-model_parameters(mod)
+parameters::model_parameters(mod)
```
It seems like the best or most important predictor is `n_comps` as it has the coefficient. However, it is hard to compare among predictors, as they are on different scales. To address this issue, we must have all the predictors on the same scale - usually in the arbitrary unit of *standard deviations*.
@@ -217,7 +215,7 @@ standardize_parameters(mod, method = "refit", two_sd = TRUE)
mod_z <- standardize(mod, two_sd = FALSE, robust = FALSE)
mod_z
-model_parameters(mod_z)
+parameters::model_parameters(mod_z)
```
@@ -258,8 +256,7 @@ Linear mixed models (LMM/HLM/MLM) offer an additional conundrum to standardizati
The solution: standardize according to level of the predictor [@hoffman2015longitudinal, page 342]! Level 1 parameters are standardized according to variance *withing* groups, while level 2 parameters are standardized according to variance *between* groups. The resulting standardized coefficient are also called *pseudo*-standardized coefficients.[^Note that like method `"basic"`, these are based on the model matrix.]
```{r, eval=knitr::opts_chunk$get("eval") && require(lme4) && require(lmerTest)}
-library(lme4)
-m <- lmer(mpg ~ cyl + am + vs + (1|cyl), mtcars)
+m <- lme4::lmer(mpg ~ cyl + am + vs + (1|cyl), mtcars)
standardize_parameters(m, method = "pseudo", df_method = "satterthwaite")