# 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.
# Example using reported ANOVA table values directly
eta_partial_ss(dfm = 4, dfe = 990,
ssm = 338057.9, sse = 32833499,
f_value = 2.548, a = .05)
# Example computing Type III SS with code (requires the "car" package)
if (requireNamespace("car", quietly = TRUE)) {
# Fit the model using stats::lm
mod <- stats::lm(money ~ coach * type, data = bn2_data)
# Type III table for the effects
aov_type3 <- car::Anova(mod, type = 3)
# Extract DF, SS, and F for the interaction (coach:type)
dfm_int <- aov_type3["coach:type", "Df"]
ssm_int <- aov_type3["coach:type", "Sum Sq"]
F_int <- aov_type3["coach:type", "F value"]
# Residual DF and SS from the standard ANOVA table
aov_type1 <- stats::anova(mod)
dfe <- aov_type1["Residuals", "Df"]
sse <- aov_type1["Residuals", "Sum Sq"]
# Calculate partial eta-squared for the interaction using Type III SS
eta_partial_ss(dfm = dfm_int, dfe = dfe,
ssm = ssm_int, sse = sse,
f_value = F_int, a = .05)
#'
# Backwards-compatible dotted name (deprecated)
eta.partial.SS(dfm = 4, dfe = 990,
ssm = 338057.9, sse = 32833499,
Fvalue = 2.548, a = .05)
}
Run the code above in your browser using DataLab