如何为具有基础分布的船尾模型计算uno的cindex?

时间:2018-07-03 12:25:11

标签: r survival-analysis

我想知道我的船尾模型有多好。它使用weibull分布(flexAFT)。我知道我可以使用survAUC::UnoC估计Uno的Cindex,但是如果我想将其传递给Surv对象,则此函数需要一个survreg对象作为参数。我如何仍可以估算模型的Uno Cindex?

# get data
data("kidtran")
kidtran = na.omit(kidtran) # remove rows with missing values
n = nrow(kidtran)
kidtran <- kidtran[sample(n),] # shuffle row-wise
kidtran.train = kidtran[1:(n * 0.8),]
kidtran.test = kidtran[(n * 0.8):n,]

# Surv object and prediction
kidtransurv <- Surv(kidtran.train$time, kidtran.train$delta)
predicted <- predict(aftmodel, newdata = kidtran.test)

# regression using underlying distribution
flexAFT.train<-flexsurvreg(kidtransurv~kidtran.train$gender+kidtran.train$race+kidtran.train$age, dist = "weibull")
flexAFT.test<-flexsurvreg(kidtransurv~kidtran.test$gender+kidtran.test$race+kidtran.test$age, dist = "weibull")

# try to find uno`s cindex for the regression models
survAUC::UnoC(Surv.rsp = flexAFT.train, Surv.rsp.new = flexAFT.test, predicted ) 

0 个答案:

没有答案