This function tries to return the best effect-size measure for the provided input model. See details.
# S3 method for BFBayesFactor
effectsize(model, type = NULL, verbose = TRUE, test = NULL, ...)effectsize(model, ...)
# S3 method for aov
effectsize(model, type = NULL, ...)
# S3 method for htest
effectsize(model, type = NULL, verbose = TRUE, ...)
An object of class htest
, or a statistical model. See details.
The effect size of interest. See details.
Toggle off warnings.
The indices of effect existence to compute. Character (vector) or
list with one or more of these options: "p_direction"
(or "pd"
),
"rope"
, "p_map"
, "equivalence_test"
(or "equitest"
),
"bayesfactor"
(or "bf"
) or "all"
to compute all tests.
For each "test", the corresponding bayestestR function is called
(e.g. rope()
or p_direction()
) and its results
included in the summary output.
Arguments passed to or from other methods. See details.
A data frame with the effect size (depending on input) and and its
CIs (CI_low
and CI_high
).
For an object of class htest
, data is extracted via insight::get_data()
, and passed to the relevant function according to:
A t-test depending on type
: "cohens_d"
(default), "hedges_g"
, or "cles"
.
A Chi-squared tests of independence or goodness-of-fit, depending on type
: "cramers_v"
(default), "phi"
, "cohens_w"
, "pearsons_c"
, "cohens_h"
, "oddsratio"
, or "riskratio"
.
A One-way ANOVA test, depending on type
: "eta"
(default), "omega"
or "epsilon"
-squared, "f"
, or "f2"
.
A McNemar test returns Cohen's g.
A Wilcoxon test depending on type
: returns "rank_biserial
" correlation (default) or "cles"
.
A Kruskal-Wallis test returns rank Epsilon squared.
A Friedman test returns Kendall's W.
(Where applicable, ci
and alternative
are taken from the htest
if not otherwise provided.)
For an object of class BFBayesFactor
, using bayestestR::describe_posterior()
,
A t-test depending on type
: "cohens_d"(default) or
"cles"`.
A correlation test returns r.
A contingency table test, depending on type
: "cramers_v"
(default), "phi"
, "cohens_w"
, "pearsons_c"
, "cohens_h"
, "oddsratio"
, or "riskratio"
.
A proportion test returns p.
Objects of class anova
, aov
, or aovlist
, depending on type
: "eta"
(default), "omega"
or "epsilon"
-squared, "f"
, or "f2"
.
Other objects are passed to standardize_parameters()
.
For statistical models it is recommended to directly use the listed functions, for the full range of options they provide.
Other effect size indices:
cles()
,
cohens_d()
,
eta_squared()
,
phi()
,
rank_biserial()
,
standardize_parameters()
# NOT RUN {
## Hypothesis Testing
## ------------------
contingency_table <- as.table(rbind(c(762, 327, 468), c(484, 239, 477), c(484, 239, 477)))
Xsq <- chisq.test(contingency_table)
effectsize(Xsq)
effectsize(Xsq, type = "phi")
Tt <- t.test(1:10, y = c(7:20), alternative = "less")
effectsize(Tt)
Aov <- oneway.test(extra ~ group, data = sleep, var.equal = TRUE)
effectsize(Aov)
effectsize(Aov, type = "omega")
Wt <- wilcox.test(1:10, 7:20, mu = -3, alternative = "less")
effectsize(Wt)
effectsize(Wt, type = "cles")
## Bayesian Hypothesis Testing
## ---------------------------
# }
# NOT RUN {
if (require(BayesFactor)) {
bf_prop <- proportionBF(3, 7, p = 0.3)
effectsize(bf_prop)
bf_corr <- correlationBF(attitude$rating, attitude$complaints)
effectsize(bf_corr)
data(raceDolls)
bf_xtab <- contingencyTableBF(raceDolls, sampleType = "poisson", fixedMargin = "cols")
effectsize(bf_xtab)
effectsize(bf_xtab, type = "oddsratio")
bf_ttest <- ttestBF(sleep$extra[sleep$group==1],
sleep$extra[sleep$group==2],
paired = TRUE, mu = -1)
effectsize(bf_ttest)
}
# }
# NOT RUN {
## Models and Anova Tables
## -----------------------
fit <- lm(mpg ~ factor(cyl) * wt + hp, data = mtcars)
effectsize(fit)
anova_table <- anova(fit)
effectsize(anova_table)
effectsize(anova_table, type = "epsilon")
# }
Run the code above in your browser using DataLab