library("psych350lab")
library(psych350data)
# Mixed factorial ANOVA: clark_grp (BG) x two repeated measures (WG)
# For example, rt_critics_score measured under two conditions
mg_results <- anova_factmg_answers(
data = superman,
dv_vars = c("rt_critics_score", "rt_audience_score"),
bg_iv = "clark_grp",
wg_name = "Rating Source",
wg_labels = c("Critics", "Audience"),
bg_labels = c("Under 6ft", "6ft or taller")
)Mixed Groups Factorial (2x2) ANOVA
Description
Performs a 2x2 mixed factorial ANOVA using the jmv package, with one between-groups factor and one within-groups factor. Returns within-subjects effects (WG main effect, BG x WG interaction), between-subjects effects (BG main effect), descriptive statistics for all cells, and estimated marginal means. All numeric values stored unrounded.
Usage
anova_factmg_answers(
data,
dv_vars,
bg_iv,
wg_name = "Measure",
wg_labels = NULL,
bg_labels = NULL,
bg_levels = NULL
)
Arguments
data
|
A data frame in wide format (one row per subject). |
dv_vars
|
Character vector of length 2. Names of the DV columns (one per WG condition). |
bg_iv
|
Character string. Name of the between-groups IV column. |
wg_name
|
Character string. Label for the within-groups factor (default: "Measure"). |
wg_labels
|
Character vector or NULL. Display labels for the WG conditions. Must be same length as dv_vars. Defaults to dv_vars.
|
bg_labels
|
Character vector or NULL. Display labels for BG levels. |
bg_levels
|
Numeric or character vector or NULL. Explicit ordering of BG factor levels. |
Value
A list with elements (all numeric values unrounded):
- WithinSubjects
-
List with
MainEffect_WG,Interaction, andError, each containingF,p_value,df,ss,msas applicable. - BetweenSubjects
-
List with
MainEffect_BGandError, each containingF,p_value,df,ss,msas applicable. - Descriptives
-
Tibble with cell-level descriptive statistics including
bg_level,wg_level,mean,sd,n,sem,bg_label,wg_label. - EMMs
-
List with
BGandWGtibbles of estimated marginal means. - FactorInfo
-
List with
wg_name,wg_labels,dv_vars,bg_levels,bg_labels,n_obs,group_ns.