effectsize.BFBayesFactor {effectsize} | R Documentation |
Effect Sizes
Description
This function tries to return the best effect-size measure for the provided input model. See details.
Usage
## S3 method for class 'BFBayesFactor'
effectsize(model, type = NULL, ci = 0.95, test = NULL, verbose = TRUE, ...)
effectsize(model, ...)
## S3 method for class 'aov'
effectsize(model, type = NULL, ...)
## S3 method for class 'htest'
effectsize(model, type = NULL, verbose = TRUE, ...)
Arguments
model |
An object of class |
type |
The effect size of interest. See details. |
ci |
Value or vector of probability of the CI (between 0 and 1)
to be estimated. Default to |
test |
The indices of effect existence to compute. Character (vector) or
list with one or more of these options: |
verbose |
Toggle off warnings. |
... |
Arguments passed to or from other methods. See details. |
Details
For an object of class
htest
, data is extracted viainsight::get_data()
, and passed to the relevant function according to:A t-test depending on
type
:"cohens_d"
(default),"hedges_g"
, or one of"p_superiority"
,"u1"
,"u2"
,"u3"
,"overlap"
.For a Paired t-test: depending on
type
:"rm_rm"
,"rm_av"
,"rm_b"
,"rm_d"
,"rm_z"
.
A Chi-squared tests of independence or Fisher's Exact Test, depending on
type
:"cramers_v"
(default),"tschuprows_t"
,"phi"
,"cohens_w"
,"pearsons_c"
,"cohens_h"
,"oddsratio"
,"riskratio"
,"arr"
, or"nnt"
.A Chi-squared tests of goodness-of-fit, depending on
type
:"fei"
(default)"cohens_w"
,"pearsons_c"
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 one of"p_superiority"
,"vda"
,"u2"
,"u3"
,"overlap"
.A Kruskal-Wallis test depending on
type
:"epsilon"
(default) or"eta"
.A Friedman test returns Kendall's W. (Where applicable,
ci
andalternative
are taken from thehtest
if not otherwise provided.)
For an object of class
BFBayesFactor
, usingbayestestR::describe_posterior()
,A t-test depending on
type
:"cohens_d"
(default) or one of"p_superiority"
,"u1"
,"u2"
,"u3"
,"overlap"
.A correlation test returns r.
A contingency table test, depending on
type
:"cramers_v"
(default),"phi"
,"tschuprows_t"
,"cohens_w"
,"pearsons_c"
,"cohens_h"
,"oddsratio"
, or"riskratio"
,"arr"
, or"nnt"
.A proportion test returns p.
Objects of class
anova
,aov
,aovlist
orafex_aov
, depending ontype
:"eta"
(default),"omega"
or"epsilon"
-squared,"f"
, or"f2"
.Other objects are passed to
parameters::standardize_parameters()
.
For statistical models it is recommended to directly use the listed functions, for the full range of options they provide.
Value
A data frame with the effect size (depending on input) and and its
CIs (CI_low
and CI_high
).
Plotting with see
The see
package contains relevant plotting functions. See the plotting vignette in the see
package.
See Also
vignette(package = "effectsize")
Examples
## Hypothesis Testing
## ------------------
data("Music_preferences")
Xsq <- chisq.test(Music_preferences)
effectsize(Xsq)
effectsize(Xsq, type = "cohens_w")
Tt <- t.test(1:10, y = c(7:20), alternative = "less")
effectsize(Tt)
Tt <- t.test(
x = c(1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30),
y = c(0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29),
paired = TRUE
)
effectsize(Tt, type = "rm_b")
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", exact = FALSE)
effectsize(Wt)
effectsize(Wt, type = "u2")
## Models and Anova Tables
## -----------------------
fit <- lm(mpg ~ factor(cyl) * wt + hp, data = mtcars)
effectsize(fit, method = "basic")
anova_table <- anova(fit)
effectsize(anova_table)
effectsize(anova_table, type = "epsilon")
## Bayesian Hypothesis Testing
## ---------------------------
bf_prop <- BayesFactor::proportionBF(3, 7, p = 0.3)
effectsize(bf_prop)
bf_corr <- BayesFactor::correlationBF(attitude$rating, attitude$complaints)
effectsize(bf_corr)
data(RCT_table)
bf_xtab <- BayesFactor::contingencyTableBF(RCT_table, sampleType = "poisson", fixedMargin = "cols")
effectsize(bf_xtab)
effectsize(bf_xtab, type = "oddsratio")
effectsize(bf_xtab, type = "arr")
bf_ttest <- BayesFactor::ttestBF(sleep$extra[sleep$group == 1],
sleep$extra[sleep$group == 2],
paired = TRUE, mu = -1
)
effectsize(bf_ttest)