# Load required packages and data
library(dplyr)
data(survey_data)
# One-way ANCOVA: income by education, controlling for age
survey_data %>%
ancova(dv = income, between = c(education), covariate = c(age))
# Two-way ANCOVA with weights
survey_data %>%
ancova(dv = income, between = c(gender, education),
covariate = c(age), weights = sampling_weight)
# Multiple covariates
survey_data %>%
ancova(dv = income, between = c(education),
covariate = c(age, political_orientation))
# --- Three-layer output ---
result <- ancova(survey_data, dv = income, between = c(education),
covariate = c(age))
result # compact overview
summary(result) # full detailed output with all sections
summary(result, marginal_means = FALSE) # hide estimated marginal means
Run the code above in your browser using DataLab