我正在尝试运行以下代码,但我遇到了这个错误松开(x([i时出错,drop=FALSE]:(下标(逻辑下标太长
library ( survival )
library(KMsurv)
data("tongue")
tongue
Weibull.1<-survreg(Surv(times,censor)~1, data=tongue, subset=(group==1),scale=1,dist="weibull")
Weibull.2<-survreg(Surv(times,censor)~1, data=tongue, subset=(group==2),scale=1,dist="weibull")
如何避免此错误?
我真的不确定你在做什么。数据集中不存在您指定的所有变量。Tongue
只有3个变量,即type
、time
和delta
。如果你改正了这些,你就会得到答案。
survreg(Surv(time, delta) ~ 1,
data = tongue,
subset = ( type == 1),
scale = 1,
dist = "weibull")
Call:
survreg(formula = Surv(time, delta) ~ 1, data = tongue, subset = (type ==
1), dist = "weibull", scale = 1)
Coefficients:
(Intercept)
4.911231
Scale fixed at 1
Loglik(model)= -183.2 Loglik(intercept only)= -183.2
n= 52