我想知道我的船尾模型有多好。它使用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 )