0

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?

Heidi
  • 25
  • 5
  • Correct the error in your `aov` command first. – Edward Mar 26 '20 at 01:37
  • I'm still having the same error. I got the summary of the Anova, but I think the problem is with variables. Do I have to convert them into factors? Do I have to use data.frame()? – Heidi Mar 26 '20 at 01:53
  • What is your working hypothesis? And why are you performing an ANOVA on survival data? Do you know what you are doing? – Edward Mar 26 '20 at 01:58
  • I have used the function (survdiff) too on the data, so that's why I included the survival. This is the code I used (res<- pairwise_survdiff(Surv(t2, d3) ~ group, bmt, p.adjust.method = "BH", rho = 0) res). – Heidi Mar 26 '20 at 02:07

1 Answers1

2

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.

Edward
  • 10,360
  • 2
  • 11
  • 26
  • Thank you for your help. Do I have to do the same thing with d3? or Is there a way to combine both variables (t2,d3) in one command? – Heidi Mar 26 '20 at 03:13
  • 1
    You cannot incorporate `d3` into the ANOVA. Stick with `pairwise_survdiff()`. – Edward Mar 26 '20 at 04:52
  • Thank you for the clarification. I appreciate your help. – Heidi Mar 26 '20 at 05:27