Hi everyone,
I am quite new to R language and I have been stuck on this issue for a week now.
I have simple dataset with these variables:
- 2 independent - Group (factor variable with levels 0, 1, 2 or "Healthy", "Mild", "Advanced") and BMI_SDS (the covariate; numeric, continuous variable)
- 9 dependent - Principal component scores 1-9, all numeric
I am asking a simple question - Do the PC scores depend on Diagnosis Group and BMI? Do Diagnosis Groups differ from each other? And what role does BMI play in it?
In other words, I want to see if I can adjust for different BMIs across the Groups and still see a differentiation between the diagnosis Groups.
Now, performing the MANCOVA is simple enough, I used this code:
mancova_model <- manova( as.matrix(mancova_data[, pc_names]) ~ BMI_SDS * Group,
data = mancova_data)
Both Group and BMI_SDS are significant, while the interaction Group*BMI_SDS is NOT:
> summary(mancova_model, test = "Pillai")
Df Pillai approx F num Df den Df Pr(>F)
BMI_SDS 1 0.45941 13.7864 9 146 6.971e-16 ***
Group 2 0.29124 2.7839 18 294 0.0001782 ***
BMI_SDS:Group 2 0.16308 1.4501 18 294 0.1073350
Residuals 154
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
All I need now is looking at the pairwise comparisons 0-1, 0-2 and 1-2.
Is there a simple function or a combination of functions that would do this pairwise MANCOVA for me? Everything I have found is either ANOVA or ANCOVA (emmeans_test) or MANOVA (mvpaircomp) or MANCOVA where the covariate is a factor variable (emmeans), but NOTHING for MANCOVA where the covariate (BMI_SDS here) is numeric.
I thought that as long as the interaction is not significant, the pairwise comparison should be easy, but apperently not. Or maybe I am just dumb and the answer is obvious, but I really cannot find anything. I tried asking ChatGPT as a last resort and it gave me an answer, but it was 20 rows of code where I had no idea what was happening and I don't want to use that.
Could anyone help me wth this issue? I would be so grateful.