我正在尝试绘制带有间隔检查器数据的生存曲线。尽管我不确定是否正确编码了事件,例如是否应该使用1,但我已经能够使用间隔检查器数据成功绘制了生存曲线(如下所示)。
这是我用来生成生存曲线的代码。
simafit <- survfit(Surv(Time1, Time2, Event, type = c('interval')) ~
Treatment, data = sima)
ggsurvplot(simafit, conf.int = TRUE,
legend.labs=c("Control","Drought","Water+"), ggtheme = theme_bw(),
legend.title = "Treatment", title ="Sidalcea malviflora", palette =
c("gray47","orangered","deepskyblue"),xlim=c(0,838), ylim=c(0,1), xlab="Days
Since Planting")+scale_x_continuous(expand = c(0, 0)) +
scale_y_continuous(expand = c(0, 0))
接下来,我尝试使用survreg
函数测试处理之间的差异并获取p值。
这是我的代码:
survreg(Surv(Time1d, Time2d, Event, type = c('interval')) ~ Treatment,
dist="weibull", data = sima)
但我不断收到错误消息:
Error in survreg(Surv(Time1d, Time2d, Event, type = c("interval")) ~ Treatment, :
Invalid survival times for this distribution
我最初尝试使用Time1和Time2,但是后来我看到0在函数中不起作用,所以我做了一个额外的副本进行测试。我尝试过以多种不同的方式显示数据,但找不到与survreg
一起使用的数据,但此格式与ggsurvplot
一起使用时效果很好,但是两个函数的格式可能需要不同?
感谢您的帮助。
以下是数据:
Plot ID Subplot Treatment Column Row Species Time1 Time2 Event Time1d Time2d
PS1 1 shelter A 7 SIMA Inf 0 0 1 1
PS1 2 shelter C 2 SIMA Inf 0 0 1 1
PS1 3 shelter D 2 SIMA Inf 0 0 1 1
PS2 1 shelter A 7 SIMA Inf 0 0 1 1
PS2 2 shelter C 2 SIMA Inf 0 0 1 1
PS2 3 shelter D 2 SIMA Inf 0 0 1 1
PS3 1 shelter A 7 SIMA Inf 0 0 1 1
PS3 2 shelter C 2 SIMA Inf 0 0 1 1
PS3 3 shelter D 2 SIMA Inf 0 0 1 1
PS4 1 shelter A 7 SIMA Inf 0 0 1 1
PS4 2 shelter C 2 SIMA Inf 0 0 1 1
PS4 3 shelter D 2 SIMA Inf 0 0 1 1
PS5 1 shelter A 7 SIMA Inf 0 0 1 1
PS5 2 shelter C 2 SIMA Inf 0 0 1 1
PS5 3 shelter D 2 SIMA Inf 0 0 1 1
PC1 1 control A 7 SIMA Inf 0 0 1 1
PC1 2 control C 2 SIMA Inf 0 0 1 1
PC1 3 control D 2 SIMA Inf 0 0 1 1
PC2 1 control A 7 SIMA Inf 0 0 1 1
PC2 2 control C 2 SIMA Inf 0 0 1 1
PC2 3 control D 2 SIMA Inf 0 0 1 1
PC3 1 control A 7 SIMA Inf 0 0 1 1
PC3 2 control C 2 SIMA Inf 0 0 1 1
PC3 3 control D 2 SIMA Inf 0 0 1 1
PC4 1 control A 7 SIMA Inf 0 0 1 1
PC4 2 control C 2 SIMA Inf 0 0 1 1
PC4 3 control D 2 SIMA Inf 0 0 1 1
PC5 1 control A 7 SIMA Inf 0 0 1 1
PC5 2 control C 2 SIMA Inf 0 0 1 1
PC5 3 control D 2 SIMA Inf 0 0 1 1
PW1 1 watered A 7 SIMA Inf 0 0 1 1
PW1 2 watered C 2 SIMA Inf 0 0 1 1
PW1 3 watered D 2 SIMA Inf 0 0 1 1
PW2 1 watered A 7 SIMA Inf 0 0 1 1
PW2 2 watered C 2 SIMA Inf 0 0 1 1
PW2 3 watered D 2 SIMA Inf 0 0 1 1
PW3 1 watered A 7 SIMA Inf 0 0 1 1
PW3 2 watered C 2 SIMA Inf 0 0 1 1
PW3 3 watered D 2 SIMA Inf 0 0 1 1
PW4 1 watered A 7 SIMA Inf 0 0 1 1
PW4 2 watered C 2 SIMA Inf 0 0 1 1
PW4 3 watered D 2 SIMA Inf 0 0 1 1
PW5 1 watered A 7 SIMA Inf 0 0 1 1
PW5 2 watered C 2 SIMA Inf 0 0 1 1
PW5 3 watered D 2 SIMA Inf 0 0 1 1
PS1 1 shelter A 7 SIMA 0 26 0 1 26
PS1 2 shelter C 2 SIMA 0 26 0 1 26
PS1 3 shelter D 2 SIMA 0 26 0 1 26
PS2 1 shelter A 7 SIMA 0 26 0 1 26
PS2 2 shelter C 2 SIMA 0 26 0 1 26
PS2 3 shelter D 2 SIMA 0 26 0 1 26
PS3 1 shelter A 7 SIMA 0 26 0 1 26
PS3 2 shelter C 2 SIMA 0 26 0 1 26
PS3 3 shelter D 2 SIMA 0 26 0 1 26
PS4 1 shelter A 7 SIMA 0 26 0 1 26
PS4 2 shelter C 2 SIMA 0 26 0 1 26
PS4 3 shelter D 2 SIMA 0 26 0 1 26
PS5 1 shelter A 7 SIMA 0 26 0 1 26
PS5 2 shelter C 2 SIMA 0 26 0 1 26
PS5 3 shelter D 2 SIMA 0 26 0 1 26
PC1 1 control A 7 SIMA 0 26 0 1 26
PC1 2 control C 2 SIMA 0 26 0 1 26
PC1 3 control D 2 SIMA 0 26 0 1 26
PC2 1 control A 7 SIMA 0 26 0 1 26
PC2 2 control C 2 SIMA 0 26 0 1 26
PC2 3 control D 2 SIMA 0 26 0 1 26
PC3 1 control A 7 SIMA 0 26 0 1 26
PC3 2 control C 2 SIMA 0 26 0 1 26
PC3 3 control D 2 SIMA 0 26 0 1 26
PC4 1 control A 7 SIMA 0 26 0 1 26
PC4 2 control C 2 SIMA 0 26 0 1 26
PC4 3 control D 2 SIMA 0 26 0 1 26
PC5 1 control A 7 SIMA 0 26 1 1 26
PC5 2 control C 2 SIMA 0 26 0 1 26
PC5 3 control D 2 SIMA 0 26 0 1 26
PW1 1 watered A 7 SIMA 0 26 0 1 26
PW1 2 watered C 2 SIMA 0 26 0 1 26
PW1 3 watered D 2 SIMA 0 26 0 1 26
PW2 1 watered A 7 SIMA 0 26 0 1 26
PW2 2 watered C 2 SIMA 0 26 0 1 26
PW2 3 watered D 2 SIMA 0 26 0 1 26
PW3 1 watered A 7 SIMA 0 26 0 1 26
PW3 2 watered C 2 SIMA 0 26 0 1 26
PW3 3 watered D 2 SIMA 0 26 0 1 26
PW4 1 watered A 7 SIMA 0 26 0 1 26
PW4 2 watered C 2 SIMA 0 26 0 1 26
PW4 3 watered D 2 SIMA 0 26 0 1 26
PW5 1 watered A 7 SIMA 0 26 0 1 26
PW5 2 watered C 2 SIMA 0 26 0 1 26
PW5 3 watered D 2 SIMA 0 26 0 1 26
PS1 1 shelter A 7 SIMA 26 92 0 26 92
PS1 2 shelter C 2 SIMA 26 92 0 26 92
PS1 3 shelter D 2 SIMA 26 92 0 26 92
PS2 1 shelter A 7 SIMA 26 92 0 26 92
PS2 2 shelter C 2 SIMA 26 92 0 26 92
PS2 3 shelter D 2 SIMA 26 92 0 26 92
PS3 1 shelter A 7 SIMA 26 92 0 26 92
PS3 2 shelter C 2 SIMA 26 92 0 26 92
PS3 3 shelter D 2 SIMA 26 92 0 26 92
PS4 1 shelter A 7 SIMA 26 92 0 26 92
PS4 2 shelter C 2 SIMA 26 92 0 26 92
PS4 3 shelter D 2 SIMA 26 92 0 26 92
PS5 1 shelter A 7 SIMA 26 92 0 26 92
PS5 2 shelter C 2 SIMA 26 92 0 26 92
PS5 3 shelter D 2 SIMA 26 92 0 26 92
PC1 1 control A 7 SIMA 26 92 0 26 92
PC1 2 control C 2 SIMA 26 92 0 26 92
PC1 3 control D 2 SIMA 26 92 0 26 92
PC2 1 control A 7 SIMA 26 92 0 26 92
PC2 2 control C 2 SIMA 26 92 0 26 92
PC2 3 control D 2 SIMA 26 92 0 26 92
PC3 1 control A 7 SIMA 26 92 0 26 92
PC3 2 control C 2 SIMA 26 92 0 26 92
PC4 1 control A 7 SIMA 26 92 0 26 92
PC4 2 control C 2 SIMA 26 92 0 26 92
PC4 3 control D 2 SIMA 26 92 0 26 92
PC5 1 control A 7 SIMA 26 92 3 26 92
PC5 2 control C 2 SIMA 26 92 0 26 92
PC5 3 control D 2 SIMA 26 92 0 26 92
PW1 1 watered A 7 SIMA 26 92 0 26 92
PW1 2 watered C 2 SIMA 26 92 0 26 92
PW1 3 watered D 2 SIMA 26 92 0 26 92
PW2 1 watered A 7 SIMA 26 92 0 26 92
PW2 2 watered C 2 SIMA 26 92 0 26 92
PW2 3 watered D 2 SIMA 26 92 0 26 92
PW3 1 watered A 7 SIMA 26 92 0 26 92
PW3 2 watered C 2 SIMA 26 92 0 26 92
PW3 3 watered D 2 SIMA 26 92 0 26 92
PW4 1 watered A 7 SIMA 26 92 0 26 92
PW4 2 watered C 2 SIMA 26 92 0 26 92
PW4 3 watered D 2 SIMA 26 92 0 26 92
PW5 1 watered A 7 SIMA 26 92 0 26 92
PW5 2 watered C 2 SIMA 26 92 0 26 92
PW5 3 watered D 2 SIMA 26 92 0 26 92
PS1 1 shelter A 7 SIMA 92 120 0 92 120
PS1 2 shelter C 2 SIMA 92 120 0 92 120
PS1 3 shelter D 2 SIMA 92 120 0 92 120
PS2 1 shelter A 7 SIMA 92 120 0 92 120
PS2 2 shelter C 2 SIMA 92 120 0 92 120
PS2 3 shelter D 2 SIMA 92 120 0 92 120
PS3 1 shelter A 7 SIMA 92 120 0 92 120
PS3 2 shelter C 2 SIMA 92 120 0 92 120
PS3 3 shelter D 2 SIMA 92 120 0 92 120
PS4 1 shelter A 7 SIMA 92 120 0 92 120
PS4 2 shelter C 2 SIMA 92 120 0 92 120
PS4 3 shelter D 2 SIMA 92 120 0 92 120
PS5 1 shelter A 7 SIMA 92 120 0 92 120
PS5 2 shelter C 2 SIMA 92 120 0 92 120
PS5 3 shelter D 2 SIMA 92 120 0 92 120
PC1 1 control A 7 SIMA 92 120 0 92 120
PC1 2 control C 2 SIMA 92 120 0 92 120
PC1 3 control D 2 SIMA 92 120 0 92 120
PC2 1 control A 7 SIMA 92 120 0 92 120
PC2 2 control C 2 SIMA 92 120 0 92 120
PC2 3 control D 2 SIMA 92 120 0 92 120
PC3 1 control A 7 SIMA 92 120 0 92 120
PC3 2 control C 2 SIMA 92 120 0 92 120
PC3 3 control D 2 SIMA 92 120 0 92 120
PC4 1 control A 7 SIMA 92 120 0 92 120
PC4 2 control C 2 SIMA 92 120 1 92 120
PC4 3 control D 2 SIMA 92 120 1 92 120
PC5 1 control A 7 SIMA 92 120 2 92 120
PC5 2 control C 2 SIMA 92 120 0 92 120
PC5 3 control D 2 SIMA 92 120 0 92 120
PW1 1 watered A 7 SIMA 92 120 0 92 120
PW1 2 watered C 2 SIMA 92 120 0 92 120
PW1 3 watered D 2 SIMA 92 120 0 92 120
PW2 1 watered A 7 SIMA 92 120 0 92 120
PW2 2 watered C 2 SIMA 92 120 0 92 120
PW2 3 watered D 2 SIMA 92 120 0 92 120
PW3 1 watered A 7 SIMA 92 120 0 92 120
PW3 2 watered C 2 SIMA 92 120 1 92 120
PW3 3 watered D 2 SIMA 92 120 0 92 120
PW4 1 watered A 7 SIMA 92 120 1 92 120
PW4 2 watered C 2 SIMA 92 120 0 92 120
PW4 3 watered D 2 SIMA 92 120 0 92 120
PW5 1 watered A 7 SIMA 92 120 0 92 120
PW5 2 watered C 2 SIMA 92 120 0 92 120
PW5 3 watered D 2 SIMA 92 120 0 92 120
PS1 1 shelter A 7 SIMA 120 152 0 120 152
PS1 2 shelter C 2 SIMA 120 152 0 120 152
PS1 3 shelter D 2 SIMA 120 152 0 120 152
PS2 1 shelter A 7 SIMA 120 152 0 120 152
PS2 2 shelter C 2 SIMA 120 152 0 120 152
PS2 3 shelter D 2 SIMA 120 152 0 120 152
PS3 1 shelter A 7 SIMA 120 152 0 120 152
PS3 2 shelter C 2 SIMA 120 152 1 120 152
PS3 3 shelter D 2 SIMA 120 152 0 120 152
PS4 1 shelter A 7 SIMA 120 152 0 120 152
PS4 2 shelter C 2 SIMA 120 152 0 120 152
PS4 3 shelter D 2 SIMA 120 152 0 120 152
PS5 1 shelter A 7 SIMA 120 152 1 120 152
PS5 2 shelter C 2 SIMA 120 152 0 120 152
PS5 3 shelter D 2 SIMA 120 152 0 120 152
PC1 1 control A 7 SIMA 120 152 0 120 152
PC1 2 control C 2 SIMA 120 152 0 120 152
PC1 3 control D 2 SIMA 120 152 0 120 152
PC2 1 control A 7 SIMA 120 152 0 120 152
PC2 2 control C 2 SIMA 120 152 0 120 152
PC2 3 control D 2 SIMA 120 152 0 120 152
PC3 1 control A 7 SIMA 120 152 1 120 152
PC3 2 control C 2 SIMA 120 152 1 120 152
PC3 3 control D 2 SIMA 120 152 1 120 152
PC4 1 control A 7 SIMA 120 152 1 120 152
PC4 2 control C 2 SIMA 120 152 3 120 152
PC4 3 control D 2 SIMA 120 152 3 120 152
PC5 1 control A 7 SIMA 120 152 2 120 152
PC5 2 control C 2 SIMA 120 152 1 120 152
PC5 3 control D 2 SIMA 120 152 0 120 152
PW1 1 watered A 7 SIMA 120 152 0 120 152
PW1 2 watered C 2 SIMA 120 152 0 120 152
PW1 3 watered D 2 SIMA 120 152 0 120 152
PW2 1 watered A 7 SIMA 120 152 0 120 152
PW2 2 watered C 2 SIMA 120 152 0 120 152
PW2 3 watered D 2 SIMA 120 152 0 120 152
PW3 1 watered A 7 SIMA 120 152 1 120 152
PW3 2 watered C 2 SIMA 120 152 3 120 152
PW3 3 watered D 2 SIMA 120 152 1 120 152
PW4 1 watered A 7 SIMA 120 152 3 120 152
PW4 2 watered C 2 SIMA 120 152 0 120 152
PW4 3 watered D 2 SIMA 120 152 1 120 152
PW5 1 watered A 7 SIMA 120 152 0 120 152
PW5 2 watered C 2 SIMA 120 152 0 120 152
PW5 3 watered D 2 SIMA 120 152 0 120 152
PS1 1 shelter A 7 SIMA 152 535 0 152 535
PS1 2 shelter C 2 SIMA 152 535 0 152 535
PS1 3 shelter D 2 SIMA 152 535 0 152 535
PS2 1 shelter A 7 SIMA 152 535 0 152 535
PS2 2 shelter C 2 SIMA 152 535 0 152 535
PS2 3 shelter D 2 SIMA 152 535 0 152 535
PS3 1 shelter A 7 SIMA 152 535 0 152 535
PS3 2 shelter C 2 SIMA 152 535 3 152 535
PS3 3 shelter D 2 SIMA 152 535 0 152 535
PS4 1 shelter A 7 SIMA 152 535 0 152 535
PS4 2 shelter C 2 SIMA 152 535 1 152 535
PS4 3 shelter D 2 SIMA 152 535 0 152 535
PS5 1 shelter A 7 SIMA 152 535 0 152 535
PS5 2 shelter C 2 SIMA 152 535 1 152 535
PS5 3 shelter D 2 SIMA 152 535 1 152 535
PC1 1 control A 7 SIMA 152 535 1 152 535
PC1 2 control C 2 SIMA 152 535 0 152 535
PC1 3 control D 2 SIMA 152 535 1 152 535
PC2 1 control A 7 SIMA 152 535 0 152 535
PC2 2 control C 2 SIMA 152 535 0 152 535
PC2 3 control D 2 SIMA 152 535 1 152 535
PC3 1 control A 7 SIMA 152 535 3 152 535
PC3 2 control C 2 SIMA 152 535 0 152 535
PC3 3 control D 2 SIMA 152 535 0 152 535
PC4 1 control A 7 SIMA 152 535 3 152 535
PC4 2 control C 2 SIMA 152 535 2 152 535
PC4 3 control D 2 SIMA 152 535 2 152 535
PC5 1 control A 7 SIMA 152 535 2 152 535
PC5 2 control C 2 SIMA 152 535 3 152 535
PC5 3 control D 2 SIMA 152 535 0 152 535
PW1 1 watered A 7 SIMA 152 535 0 152 535
PW1 2 watered C 2 SIMA 152 535 0 152 535
PW1 3 watered D 2 SIMA 152 535 0 152 535
PW2 1 watered A 7 SIMA 152 535 0 152 535
PW2 2 watered C 2 SIMA 152 535 0 152 535
PW2 3 watered D 2 SIMA 152 535 0 152 535
PW3 1 watered A 7 SIMA 152 535 3 152 535
PW3 2 watered C 2 SIMA 152 535 2 152 535
PW3 3 watered D 2 SIMA 152 535 3 152 535
PW4 1 watered A 7 SIMA 152 535 2 152 535
PW4 2 watered C 2 SIMA 152 535 0 152 535
PW4 3 watered D 2 SIMA 152 535 3 152 535
PW5 1 watered A 7 SIMA 152 535 0 152 535
PW5 2 watered C 2 SIMA 152 535 1 152 535
PW5 3 watered D 2 SIMA 152 535 0 152 535
PS1 1 shelter A 7 SIMA 535 829 0 535 829
PS1 2 shelter C 2 SIMA 535 829 1 535 829
PS1 3 shelter D 2 SIMA 535 829 0 535 829
PS2 1 shelter A 7 SIMA 535 829 0 535 829
PS2 2 shelter C 2 SIMA 535 829 0 535 829
PS2 3 shelter D 2 SIMA 535 829 0 535 829
PS3 1 shelter A 7 SIMA 535 829 0 535 829
PS3 2 shelter C 2 SIMA 535 829 0 535 829
PS3 3 shelter D 2 SIMA 535 829 0 535 829
PS4 1 shelter A 7 SIMA 535 829 0 535 829
PS4 2 shelter C 2 SIMA 535 829 3 535 829
PS4 3 shelter D 2 SIMA 535 829 0 535 829
PS5 1 shelter A 7 SIMA 535 829 0 535 829
PS5 2 shelter C 2 SIMA 535 829 0 535 829
PS5 3 shelter D 2 SIMA 535 829 0 535 829
PC1 1 control A 7 SIMA 535 829 3 535 829
PC1 2 control C 2 SIMA 535 829 0 535 829
PC1 3 control D 2 SIMA 535 829 3 535 829
PC2 1 control A 7 SIMA 535 829 0 535 829
PC2 2 control C 2 SIMA 535 829 1 535 829
PC2 3 control D 2 SIMA 535 829 3 535 829
PC3 1 control A 7 SIMA 535 829 2 535 829
PC3 2 control C 2 SIMA 535 829 0 535 829
PC3 3 control D 2 SIMA 535 829 0 535 829
PC4 1 control A 7 SIMA 535 829 2 535 829
PC4 2 control C 2 SIMA 535 829 2 535 829
PC4 3 control D 2 SIMA 535 829 2 535 829
PC5 1 control A 7 SIMA 535 829 2 535 829
PC5 2 control C 2 SIMA 535 829 2 535 829
PC5 3 control D 2 SIMA 535 829 1 535 829
PW1 1 watered A 7 SIMA 535 829 1 535 829
PW1 2 watered C 2 SIMA 535 829 0 535 829
PW1 3 watered D 2 SIMA 535 829 0 535 829
PW2 1 watered A 7 SIMA 535 829 0 535 829
PW2 2 watered C 2 SIMA 535 829 0 535 829
PW2 3 watered D 2 SIMA 535 829 1 535 829
PW3 1 watered A 7 SIMA 535 829 0 535 829
PW3 2 watered C 2 SIMA 535 829 2 535 829
PW3 3 watered D 2 SIMA 535 829 0 535 829
PW4 1 watered A 7 SIMA 535 829 2 535 829
PW4 2 watered C 2 SIMA 535 829 1 535 829
PW4 3 watered D 2 SIMA 535 829 2 535 829
PW5 1 watered A 7 SIMA 535 829 1 535 829
PW5 2 watered C 2 SIMA 535 829 0 535 829
PW5 3 watered D 2 SIMA 535 829 0 535 829
PS1 1 shelter A 7 SIMA 829 Inf 0 829 Inf
PS1 2 shelter C 2 SIMA 829 Inf 3 829 Inf
PS1 3 shelter D 2 SIMA 829 Inf 0 829 Inf
PS2 1 shelter A 7 SIMA 829 Inf 0 829 Inf
PS2 2 shelter C 2 SIMA 829 Inf 0 829 Inf
PS2 3 shelter D 2 SIMA 829 Inf 0 829 Inf
PS3 1 shelter A 7 SIMA 829 Inf 0 829 Inf
PS3 2 shelter C 2 SIMA 829 Inf 0 829 Inf
PS3 3 shelter D 2 SIMA 829 Inf 0 829 Inf
PS4 1 shelter A 7 SIMA 829 Inf 0 829 Inf
PS4 2 shelter C 2 SIMA 829 Inf 2 829 Inf
PS4 3 shelter D 2 SIMA 829 Inf 0 829 Inf
PS5 1 shelter A 7 SIMA 829 Inf 0 829 Inf
PS5 2 shelter C 2 SIMA 829 Inf 0 829 Inf
PS5 3 shelter D 2 SIMA 829 Inf 0 829 Inf
PC1 1 control A 7 SIMA 829 Inf 2 829 Inf
PC1 2 control C 2 SIMA 829 Inf 0 829 Inf
PC1 3 control D 2 SIMA 829 Inf 2 829 Inf
PC2 1 control A 7 SIMA 829 Inf 0 829 Inf
PC2 2 control C 2 SIMA 829 Inf 3 829 Inf
PC2 3 control D 2 SIMA 829 Inf 2 829 Inf
PC3 1 control A 7 SIMA 829 Inf 2 829 Inf
PC3 2 control C 2 SIMA 829 Inf 0 829 Inf
PC3 3 control D 2 SIMA 829 Inf 0 829 Inf
PC4 1 control A 7 SIMA 829 Inf 2 829 Inf
PC4 2 control C 2 SIMA 829 Inf 2 829 Inf
PC4 3 control D 2 SIMA 829 Inf 2 829 Inf
PC5 1 control A 7 SIMA 829 Inf 2 829 Inf
PC5 2 control C 2 SIMA 829 Inf 2 829 Inf
PC5 3 control D 2 SIMA 829 Inf 3 829 Inf
PW1 1 watered A 7 SIMA 829 Inf 3 829 Inf
PW1 2 watered C 2 SIMA 829 Inf 0 829 Inf
PW1 3 watered D 2 SIMA 829 Inf 0 829 Inf
PW2 1 watered A 7 SIMA 829 Inf 0 829 Inf
PW2 2 watered C 2 SIMA 829 Inf 0 829 Inf
PW2 3 watered D 2 SIMA 829 Inf 3 829 Inf
PW3 1 watered A 7 SIMA 829 Inf 0 829 Inf
PW3 2 watered C 2 SIMA 829 Inf 2 829 Inf
PW3 3 watered D 2 SIMA 829 Inf 0 829 Inf
PW4 1 watered A 7 SIMA 829 Inf 2 829 Inf
PW4 2 watered C 2 SIMA 829 Inf 3 829 Inf
PW4 3 watered D 2 SIMA 829 Inf 2 829 Inf
PW5 1 watered A 7 SIMA 829 Inf 3 829 Inf
PW5 2 watered C 2 SIMA 829 Inf 0 829 Inf
PW5 3 watered D 2 SIMA 829 Inf 0 829 Inf
根据评论和更多的背景研究,我发现我实际上可以将数据表示为正确的审查数据:
Plot ID Subplot Treatment Column Row Species Time Event
PS1 1 shelter A 7 SIMA 829 0
PS1 2 shelter C 2 SIMA 829 1
PS1 3 shelter D 2 SIMA 829 0
PS2 1 shelter A 7 SIMA 829 0
PS2 2 shelter C 2 SIMA 829 0
PS2 3 shelter D 2 SIMA 829 0
PS3 1 shelter A 7 SIMA 829 0
PS3 2 shelter C 2 SIMA 829 0
PS3 3 shelter D 2 SIMA 829 0
PS4 1 shelter A 7 SIMA 829 0
PS4 2 shelter C 2 SIMA 535 1
PS4 3 shelter D 2 SIMA 829 0
PS5 1 shelter A 7 SIMA 829 0
PS5 2 shelter C 2 SIMA 829 0
PS5 3 shelter D 2 SIMA 829 0
PC1 1 control A 7 SIMA 535 1
PC1 2 control C 2 SIMA 829 0
PC1 3 control D 2 SIMA 535 1
PC2 1 control A 7 SIMA 829 0
PC2 2 control C 2 SIMA 829 1
PC2 3 control D 2 SIMA 535 1
PC3 1 control A 7 SIMA 152 1
PC3 2 control C 2 SIMA 829 0
PC3 3 control D 2 SIMA 829 0
PC4 1 control A 7 SIMA 152 1
PC4 2 control C 2 SIMA 120 1
PC4 3 control D 2 SIMA 120 1
PC5 1 control A 7 SIMA 92 1
PC5 2 control C 2 SIMA 152 1
PC5 3 control D 2 SIMA 829 1
PW1 1 watered A 7 SIMA 829 1
PW1 2 watered C 2 SIMA 829 0
PW1 3 watered D 2 SIMA 829 0
PW2 1 watered A 7 SIMA 829 0
PW2 2 watered C 2 SIMA 829 0
PW2 3 watered D 2 SIMA 829 1
PW3 1 watered A 7 SIMA 829 0
PW3 2 watered C 2 SIMA 120 1
PW3 3 watered D 2 SIMA 829 0
PW4 1 watered A 7 SIMA 120 1
PW4 2 watered C 2 SIMA 829 1
PW4 3 watered D 2 SIMA 152 1
PW5 1 watered A 7 SIMA 829 1
PW5 2 watered C 2 SIMA 535 1
PW5 3 watered D 2 SIMA 829 0
然后我将此代码应用于:
rsimafit <- survfit(Surv(Time, Event, type = c('right')) ~ Treatment, data = rsima)
ggsurvplot(rsimafit, conf.int = TRUE, pval = TRUE, legend.labs=c("Control","Drought","Water+"), ggtheme = theme_bw(), legend.title = "Treatment", title ="Sidalcea malviflora", palette = c("gray47","orangered","deepskyblue"),xlim=c(0,838), ylim=c(0,1), xlab="Days Since Planting")
我得到以下输出:
现在,我最大的问题是决定使用哪种最合适的模型:survdiff
survreg
或coxph
我已经做过一些背景研究,但是我在统计模型或编程方面没有很强的背景-据我所知:
survreg
是参数化的
survdiff
是非参数的
coxph
是半参数的(不确定是什么意思),用于测试多种治疗方法以及它们之间的相互作用。此外,它们都输出相似的p值
我认为所有这些都使用某种类型的对数秩检验来与原假设进行比较,在我看来,原假设是可控制的?此外,我无法确定事后成对比较在这种情况下是否可行或适当。任何输入或指导将不胜感激。我已经阅读了许多其他有关stackoverflow,statsexchange和crossvalidated的示例,但是仍然很困惑。
答案 0 :(得分:1)
survival package中的功能survreg()
适合参数化加速故障时间(AFT)模型。 AFT模型是应用于生存时间(实际上是对数生存时间)的简单线性回归的类似物,并考虑了估计中的审查。由于这些都是参数化模型,因此,实际上,当您使用它们时,您就在假设生存时间的分布。
函数coxph()
适合半参数Cox比例风险模型。这是危害函数的模型,并假定了危害量表中协变量的乘积效应。该模型并未假设您的生存时间有任何特定的分布,但确实做出了比例风险假设(即,风险等级中协变量的影响随时间恒定)。
函数survdiff()
进行对数秩检验和Gehan-Wilcoxon检验(如果将参数rho
设置为1)。这些测试测试特定群体(例如,男性与女性)的生存时间分布是否相等。对数秩检验等效于Cox模型的得分检验,其中您将组变量包括为协变量。