Learn R Programming

MOTE (version 1.2.2)

r_effect: r-family effect size wrapper

Description

This function provides a unified interface for computing r- and variance-based effect sizes (e.g., correlations and coefficients of determination) from different input summaries. It is analogous to the d_effect() wrapper for standardized mean difference effect sizes.

Usage

r_effect(
  d = NULL,
  n1 = NULL,
  n2 = NULL,
  r = NULL,
  n = NULL,
  x2 = NULL,
  c = NULL,
  dfm = NULL,
  dfe = NULL,
  msm = NULL,
  mse = NULL,
  mss = NULL,
  sst = NULL,
  ssm = NULL,
  ssm2 = NULL,
  sss = NULL,
  sse = NULL,
  sse1 = NULL,
  sse2 = NULL,
  sse3 = NULL,
  j = NULL,
  f_value = NULL,
  a = 0.05,
  design,
  ...
)

Value

A list whose structure depends on the selected design. For `design = "d_to_r"`, the returned object is the same as from [d_to_r()].

Arguments

d

Cohen's d value for the contrast of interest (used when `design = "d_to_r"`).

n1

Sample size for group one (used when `design = "d_to_r"`).

n2

Sample size for group two (used when `design = "d_to_r"`).

r

Sample Pearson correlation coefficient (used when `design = "r_correl"`), or the number of rows in the contingency table (used when `design = "v_chi_sq"`).

n

Sample size for the correlation (used when `design = "r_correl"`), the total sample size for the chi-square test (used when `design = "v_chi_sq"`), or the total sample size for the ANOVA (used when `design = "omega_f"` or `design = "omega_partial_ss_bn"`).

x2

Chi-square test statistic for the contingency table (used when `design = "v_chi_sq"`).

c

Number of columns in the contingency table (used when `design = "v_chi_sq"`).

dfm

Degrees of freedom for the model term (used when `design = "epsilon_full_ss"`, `design = "eta_f"`, `design = "omega_f"`, `design = "omega_full_ss"`, `design = "omega_partial_ss_bn"`, `design = "eta_full_ss"`, `design = "eta_partial_ss"`, `design = "ges_partial_ss_mix"`, `design = "ges_partial_ss_rm"`, `design = "omega_partial_ss_rm"`, or `design = "omega_g_ss_rm"`).

dfe

Degrees of freedom for the error term (used when `design = "epsilon_full_ss"`, `design = "eta_f"`, `design = "omega_f"`, `design = "omega_full_ss"`, `design = "omega_partial_ss_bn"`, `design = "eta_full_ss"`, `design = "eta_partial_ss"`, `design = "ges_partial_ss_mix"`, `design = "ges_partial_ss_rm"`, `design = "omega_partial_ss_rm"`, or `design = "omega_g_ss_rm"`).

msm

Mean square for the model (used when `design = "epsilon_full_ss"`, `design = "omega_full_ss"`, `design = "omega_partial_ss_bn"`, or `design = "omega_partial_ss_rm"`).

mse

Mean square for the error (used when `design = "epsilon_full_ss"`, `design = "omega_full_ss"`, `design = "omega_partial_ss_bn"`, or `design = "omega_partial_ss_rm"`).

mss

Mean square for the subject or between-subjects term (used when `design = "omega_partial_ss_rm"`).

sst

Total sum of squares for the outcome (used when `design = "epsilon_full_ss"`, `design = "omega_full_ss"`, or `design = "omega_g_ss_rm"`).

ssm

Sum of squares for the model term (used when `design = "eta_full_ss"`, `design = "eta_partial_ss"`, `design = "ges_partial_ss_mix"`, `design = "ges_partial_ss_rm"`, `design = "omega_partial_ss_bn"`, `design = "omega_partial_ss_rm"`, or `design = "omega_g_ss_rm"`).

ssm2

Sum of squares for a second model or component term (used when `design = "omega_g_ss_rm"`).

sss

Sum of squares for the subject or between-subjects term (used when `design = "ges_partial_ss_mix"`, `design = "ges_partial_ss_rm"`, or `design = "omega_partial_ss_rm"`).

sse

Sum of squares for the error term (used when `design = "eta_partial_ss"`, `design = "ges_partial_ss_mix"`, or `design = "omega_partial_ss_rm"`).

sse1

Sum of squares for the first error term (used when `design = "ges_partial_ss_rm"`).

sse2

Sum of squares for the second error term (used when `design = "ges_partial_ss_rm"`).

sse3

Sum of squares for the third error term (used when `design = "ges_partial_ss_rm"`).

j

Number of levels for the factor (used when `design = "omega_g_ss_rm"`).

f_value

F statistic for the model term (used when `design = "eta_f"`, `design = "eta_full_ss"`, `design = "eta_partial_ss"`, `design = "ges_partial_ss_mix"`, `design = "ges_partial_ss_rm"`, `design = "omega_f"`, or `design = "omega_g_ss_rm"`).

a

Significance level used for confidence intervals. Defaults to 0.05.

design

Character string indicating which r-family effect size design to use. See **Supported designs**.

...

Additional arguments for future methods (currently unused).

Supported designs

- `"d_to_r"` — correlation and R\(^2\) from Cohen's d for independent groups. Supply `d`, `n1`, and `n2`. In this case, `r_effect()` will call [d_to_r()] with the same arguments.

- `"r_correl"` — correlation and R\(^2\) from a sample Pearson correlation. Supply `r` and `n`. In this case, `r_effect()` will call [r_correl()] with the same arguments.

- `"v_chi_sq"` — Cramer's V from a chi-square test of association for an r x c contingency table. Supply `x2`, `n`, `r`, and `c`. In this case, `r_effect()` will call [v_chi_sq()] with the same arguments.

- `"epsilon_full_ss"` — epsilon-squared (\(\epsilon^2\)) from an ANOVA table using model and error mean squares and the total sum of squares. Supply `dfm`, `dfe`, `msm`, `mse`, and `sst`. In this case, `r_effect()` will call [epsilon_full_ss()] with the same arguments.

- `"eta_f"` — eta-squared (\(\eta^2\)) from an ANOVA F statistic and its associated degrees of freedom. Supply `dfm`, `dfe`, and `f_value`. In this case, `r_effect()` will call [eta_f()] with the same arguments.

- `"omega_f"` — omega-squared (\(\omega^2\)) from an ANOVA F statistic, its associated degrees of freedom, and the total sample size. Supply `dfm`, `dfe`, `n`, and `f_value`. In this case, `r_effect()` will call [omega_f()] with the same arguments.

- `"omega_full_ss"` — omega-squared (\(\omega^2\)) from ANOVA sums of squares, using the model mean square, error mean square, and total sum of squares along with the model and error degrees of freedom. Supply `dfm`, `dfe`, `msm`, `mse`, and `sst`. In this case, `r_effect()` will call [omega_full_ss()] with the same arguments.

- `"omega_partial_ss_bn"` — partial omega-squared (\(\omega^2_p\)) for between-subjects designs, using the model mean square, error mean square, model sum of squares, and total sample size along with the model and error degrees of freedom. Supply `dfm`, `dfe`, `msm`, `mse`, `ssm`, and `n`. In this case, `r_effect()` will call [omega_partial_ss_bn()] with the same arguments.

- `"eta_full_ss"` — eta-squared (\(\eta^2\)) from ANOVA sums of squares, using the model sum of squares and total sum of squares along with the model and error degrees of freedom. Supply `dfm`, `dfe`, `ssm`, `sst`, and `f_value`. In this case, `r_effect()` will call [eta_full_ss()] with the same arguments.

- `"eta_partial_ss"` — partial eta-squared (\(\eta^2_p\)) from ANOVA sums of squares, using the model sum of squares and error sum of squares along with the model and error degrees of freedom. Supply `dfm`, `dfe`, `ssm`, `sse`, and `f_value`. In this case, `r_effect()` will call [eta_partial_ss()] with the same arguments.

- `"ges_partial_ss_mix"` — partial generalized eta-squared (\(\eta^2_{G}\)) for mixed designs, using the model sum of squares, between-subjects sum of squares, and error sum of squares along with the model and error degrees of freedom. Supply `dfm`, `dfe`, `ssm`, `sss`, `sse`, and `f_value`. In this case, `r_effect()` will call [ges_partial_ss_mix()] with the same arguments.

- `"ges_partial_ss_rm"` — partial generalized eta-squared (\(\eta^2_{G}\)) for repeated-measures designs, using the model sum of squares, between-subjects sum of squares, and multiple error sums of squares (e.g., for each level or effect) along with the model and error degrees of freedom. Supply `dfm`, `dfe`, `ssm`, `sss`, `sse1`, `sse2`, `sse3`, and `f_value`. In this case, `r_effect()` will call [ges_partial_ss_rm()] with the same arguments.

- `"omega_partial_ss_rm"` — partial omega-squared (\(\omega^2_p\)) for repeated-measures designs, using the model, subject, and error sums of squares and their associated mean squares along with the model and error degrees of freedom. Supply `dfm`, `dfe`, `msm`, `mse`, `mss`, `ssm`, `sse`, and `sss`. In this case, `r_effect()` will call [omega_partial_ss_rm()] with the same arguments.

- `"omega_g_ss_rm"` — generalized omega-squared (\(\omega^2_G\)) for repeated-measures or mixed designs, using sums of squares for the model, an additional model/component term, and the total sum of squares, along with the mean square for the subject term and the number of levels for the factor. Supply `dfm`, `dfe`, `ssm`, `ssm2`, `sst`, `mss`, `j`, and `f_value`. In this case, `r_effect()` will call [omega_g_ss_rm()] with the same arguments.

Details

Currently, `r_effect()` supports effect sizes derived from Cohen's d, from correlations, and from ANOVA summaries via several designs (see **Supported designs**). These designs call lower-level functions as [d_to_r()], [r_correl()], [epsilon_full_ss()], [eta_f()], [omega_f()], [omega_full_ss()], [eta_full_ss()], [eta_partial_ss()], [ges_partial_ss_mix()], [ges_partial_ss_rm()], [omega_partial_ss_rm()], and [omega_g_ss_rm()] with the appropriate arguments.

Examples

Run this code
# From Cohen's d for independent groups to r and R^2
r_effect(d = -1.88, n1 = 4, n2 = 4, a = .05, design = "d_to_r")
# From a sample correlation to r and R^2
r_effect(r = -0.8676594, n = 32, a = .05, design = "r_correl")
# From a chi-square test of association to Cramer's V
r_effect(x2 = 2.0496, n = 60, r = 3, c = 3, a = .05, design = "v_chi_sq")
# From F and degrees of freedom to eta^2
r_effect(dfm = 2, dfe = 8, f_value = 5.134, a = .05, design = "eta_f")
# From F, degrees of freedom, and N to omega^2
r_effect(dfm = 2, dfe = 8, n = 11, f_value = 5.134,
a = .05, design = "omega_f")
# From sums of squares to omega^2
r_effect(
  dfm   = 2,
  dfe   = 8,
  msm   = 12.621,
  mse   = 2.548,
  sst   = (25.54 + 19.67),
  a     = .05,
  design = "omega_full_ss"
)
# From sums of squares to partial eta^2
r_effect(
  dfm    = 4,
  dfe    = 990,
  ssm    = 338057.9,
  sse    = 32833499,
  f_value = 2.548,
  a      = .05,
  design = "eta_partial_ss"
)
# From mixed-design sums of squares to partial generalized eta^2
r_effect(
  dfm     = 1,
  dfe     = 156,
  ssm     = 71.07608,
  sss     = 30936.498,
  sse     = 8657.094,
  f_value = 1.280784,
  a       = .05,
  design  = "ges_partial_ss_mix"
)

# From repeated-measures sums of squares to partial generalized eta^2
r_effect(
  dfm     = 1,
  dfe     = 157,
  ssm     = 2442.948,
  sss     = 76988.13,
  sse1    = 5402.567,
  sse2    = 8318.75,
  sse3    = 6074.417,
  f_value = 70.9927,
  a       = .05,
  design  = "ges_partial_ss_rm"
)

# From repeated-measures sums of squares to partial omega^2_p
r_effect(
  dfm   = 1,
  dfe   = 157,
  msm   = 2442.948 / 1,
  mse   = 5402.567 / 157,
  mss   = 76988.130 / 157,
  ssm   = 2442.948,
  sss   = 76988.13,
  sse   = 5402.567,
  a     = .05,
  design = "omega_partial_ss_rm"
)

# From repeated-measures sums of squares to generalized omega^2_G
r_effect(
  dfm     = 1,
  dfe     = 156,
  ssm     = 6842.46829,
  ssm2    = 14336.07886,
  sst     = sum(c(30936.498, 6842.46829,
                  14336.07886, 8657.094, 71.07608)),
  mss     = 30936.498 / 156,
  j       = 2,
  f_value = 34.503746,
  a       = .05,
  design  = "omega_g_ss_rm"
)

Run the code above in your browser using DataLab