I'm trying to a Tukey test on the data (bmt), (KMsurv) and focusing on the variables t2 and d3 only. t2: the disease free survival time (time to relapse, death or end of study) d3: indicator variable for disease free. d3 = 1 if dead or relapsed, or d3 = 0 if alive or disease free. The data can be obtained using the KMsurv package. The patients have been grouped into risk categories or groups, represented by the variable g in the data set.
g = 1; ALL (acute lymphoblastic leukemia) 38 patients
g = 2; AML low risk (acute myeloctic leukemia) 54 patients
g = 3; AML high risk (acute myeloctic leukemia) 45 patients
library(KMsurv)
data(bmt)
bmt
library(survival)
# run the ANOVA and print out the ANOVA table:
anova1 <- aov( group ~ t2+d3, data = bmt )
summary(anova1)
TukeyHSD(anova1)
But there is an error message appears
Error in TukeyHSD.aov(anova1) :no factors in the fitted model In addition: Warning messages: 1: In replications(paste("~", xx), data = mf) : non-factors ignored: t2 2: In replications(paste("~", xx), data = mf) : non-factors ignored: d3
I have installed the package multcomp
but I'm not sure if this package is necessary.
How can I fix that error?
I don't see the need to perform an ANOVA here since your outcome is relapse-free survival. If you really want to, and then do a Tukey test, then the command would be:
anova1 <- aov(t2 ~ factor(group), data = bmt)
summary(anova1)
Df Sum Sq Mean Sq F value Pr(>F)
factor(group) 2 7186442 3593221 7.115 0.00116 **
Residuals 134 67675770 505043
TukeyHSD(anova1)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = t2 ~ factor(group), data = bmt)
$`factor(group)`
diff lwr upr p adj
2-1 456.35673 99.72036 812.9931 0.0081370
3-1 -22.13216 -393.20690 348.9426 0.9890452
3-2 -478.48889 -818.45440 -138.5234 0.0031404
But that ignores the event (variable d3), so I wouldn't take much notice of the results.