简体   繁体   English

对 R 进行 Tukey 测试

[英]conducting a Tukey test on R

I'm trying to a Tukey test on the data (bmt), (KMsurv) and focusing on the variables t2 and d3 only.我正在尝试对数据 (bmt)、(KMsurv) 进行 Tukey 测试,并仅关注变量 t2 和 d3。 t2: the disease free survival time (time to relapse, death or end of study) d3: indicator variable for disease free. t2:无病生存时间(复发、死亡或研究结束的时间) d3:无病的指标变量。 d3 = 1 if dead or relapsed, or d3 = 0 if alive or disease free.如果死亡或复发,则 d3 = 1,如果活着或没有疾病,则 d3 = 0。 The data can be obtained using the KMsurv package.可以使用 KMsurv 包获取数据。 The patients have been grouped into risk categories or groups, represented by the variable g in the data set.患者已被分组为风险类别或组,由数据集中的变量 g 表示。

    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.我已经安装了包multcomp但我不确定这个包是否是必要的。

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:如果你真的想,然后做一个 Tukey 测试,那么命令将是:

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.但这忽略了事件(变量 d3),所以我不会太在意结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM