# The following example is derived from the "bn2_data"
# dataset, included in the MOTE library.
# Is there a difference in athletic spending budget for different sports?
# Does that spending interact with the change in coaching staff?
# This data includes (fake) athletic budgets for baseball,
# basketball, football, soccer, and volleyball teams
# with new and old coaches to determine if there are differences in
# spending across coaches and sports.
# You would calculate one omega value for each F-statistic.
# Here's an example for the interaction using reported ANOVA values.
omega_partial_ss_bn(dfm = 4, dfe = 990,
msm = 338057.9 / 4,
mse = 32833499 / 990,
ssm = 338057.9,
n = 1000, a = .05)
# Backwards-compatible dotted name (deprecated)
omega.partial.SS.bn(dfm = 4, dfe = 990,
msm = 338057.9 / 4,
mse = 32833499 / 990,
ssm = 338057.9,
n = 1000, a = .05)
# The same analysis can be fit with stats::lm and car::Anova(type = 3).
# This example shows how to obtain the ANOVA table and plug its values
# into omega.partial.SS.bn without relying on ezANOVA.
if (requireNamespace("car", quietly = TRUE)) {
mod <- stats::lm(money ~ coach * type, data = bn2_data)
# Type I table (for residual SS and df)
aov_type1 <- stats::anova(mod)
# Type III SS table for the effects
aov_type3 <- car::Anova(mod, type = 3)
# Extract dfs and sums of squares for the interaction coach:type
dfm_int <- aov_type3["coach:type", "Df"]
ssm_int <- aov_type3["coach:type", "Sum Sq"]
msm_int <- ssm_int / dfm_int
dfe <- aov_type1["Residuals", "Df"]
sse <- aov_type1["Residuals", "Sum Sq"]
mse <- sse / dfe
omega_partial_ss_bn(dfm = dfm_int,
dfe = dfe,
msm = msm_int,
mse = mse,
ssm = ssm_int,
n = nrow(bn2_data),
a = .05)
}
Run the code above in your browser using DataLab