我想绘制列线图以进行竞争风险分析。并且我使用普通的线性回归技巧来预测竞争风险回归中的线性预测器,但是,我不知道如何从crr()函数中获取线性预测器。我有以下代码。
library(cmprsk)
library(rms)
set.seed(10)
ftime <- rexp(200)
fstatus <- sample(0:2,200,replace=TRUE)
cov <- matrix(runif(600),nrow=200)
dimnames(cov)[[2]] <- c('x1','x2','x3')
z <- crr(ftime,fstatus,cov)
z.p <- predict(z,cov)
n=60#suppose I want to predict the probability of event at time 60(an order)
df<-data.frame(y=z.p[n,-1],cov)
ddist <- datadist(df)
options(datadist='ddist')
lmod<-ols(y~rcs(x1)+rcs(x2)+rcs(x3),data=df)#y is not linear predictor of crr fitting, this ols modeling can be wrong. the R^2 will not be 1.
nom<-nomogram(lmod)
plot(nom,lplabel=paste("prob. of incidence T",round(z.p[n,1],2),sep="="))