I have 3 groups of different sample sizes with covariance I need to include. I wish to evaluate the value dependence of the groups compared to group 1 (group 2, group 3 values compared to group 1).
I can't do a simple ANCOVA since the data showed to be non-normal (shapiro test).
Sample data:
data <- structure(list(age = c(65.7, 65.7, 68.8, 68.8, 60.9, 60.9, 75,
75, 77, 77, 62.9, 62.9, 69.8, 69.8, 75, 73.3, 59.8, 59.8, 70.6,
70.6, 75.7, 75.7, 61.2, 61.2), value = c(94, 90, 113, 100, 103,
92, 70, 80, 86, 82, 101, 101, 90, 86, 94, 103, 96, 95, 90, 92,
84, 83, 84, 89), Group = structure(c(3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L,
1L, 1L), .Label = c("1", "2", "3"), class = "factor")), row.names = c(1L,
2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 140L, 141L, 142L, 143L,
144L, 145L, 146L, 147L, 215L, 216L, 217L, 218L, 219L, 220L), class = "data.frame")
model1 <- lm(value~age*Group, data=data)
model2 <- lm(value~age+Group, data=data)
anova(model1, model2) results in Pr(>F)= 0.2168, but as age is significant I think model 1 is the right one..
Looking for possible solutions I wonder if I should use
- Evaluation by linear regression, perhaps by center the age and:
coeftest(model, vcov = vcovHC(model, type="HC1"))
- emmeans_test() with covariate=age
- emmeans and contrast (gives different results than emmeans_test):
emm <- emmeans(model,~Group|age)
contrast(emm, method="tukey", adjust="none")
- The age is very significant. Perhaps I should cut() and create age_groups factors and analyze them by that?
Which option would be the best in my case?
emmeans_test
function, at least not in the emmeans package. So I am not sure what you did. If you ran emmeans, and then ran test on those results, then that tests each estimated marginal mean against zero, it does not test comparisons among the means. $\endgroup$emmeans_test
is a function from the rstatix package said to: "Perform pairwise comparisons between groups using the estimated marginal means. Pipe-friendly wrapper arround the functions emmans() +contrast
from the emmeans package..." So should I stick to the evaluation bycoeftest
? $\endgroup$emm_test
's output seems (to my eye) cluttered, and they show both unadjusted and Tukey'adjusted P values. In yourcontrast
call,"tukey"
as the second argument is just a synonym for"pairwise"
; that's not specifying the adjustment method. I'd have usedpairs(emm, adjust = "tukey")
andpairs(emm, adjust = "none")
$\endgroup$