post-hoc testįrom ANCOVA, we know that genotypes yield are statistically significant whilst controlling the effect of height, but ANCOVA does not tell which genotypes are significantly different from each other. The B genotype has the highest yield (31.7) whilst controlling the effect of height. EMMs are adjusted means for each genotype. Perform one-way ANCOVA anova_test(data = df, formula = yield ~ height + genotype, type = 3, detailed = TRUE) # type 3 SS should be used in ANCOVAġ 13.4 A 24.7 0.263 26 24.2 25.3 Emmeans testĢ 13.4 B 31.7 0.373 26 31.0 32.5 Emmeans testģ 13.4 C 21.9 0.397 26 21.1 22.7 Emmeans testĮmmeans gives the estimated marginal means (EMMs) which is also known as least-squares means. P3 <- ggplot(df, aes(x = genotype, y = height, fill = genotype)) + geom_boxplot(outlier.shape = NA) + geom_jitter(width = 0.2) + theme(legend.position="top") P2 <- ggplot(df, aes(x = genotype, y = yield, col = genotype)) + geom_boxplot(outlier.shape = NA) + geom_jitter(width = 0.2) + theme(legend.position="top") P1 <- ggplot(df, aes(height, yield, colour = genotype)) + geom_point(size = 3) + theme(legend.position="top") # summary statistics for dependent variable yieldĭf %>% group_by(genotype) %>% get_summary_stats(yield, type="common") Get summary statistics based on dependent variable and covariate, library(rstatix) Summary statistics and visualization of dataset
Linearity assumption: At each level of categorical independent variable, the covariate should be linearly related to the dependent variable.In addition, ANCOVA needs to meet the following assumptions,
ANCOVA follows similar assumptions as in ANOVA for the independence of observations, normality, and homogeneity of variances