我现在正在使用“ Amelia”和“ SurvIDINRI”软件包,以便估算丢失的数据,然后进行IDI和NRI分析。 我可以得出以下5个推算分析的结果(m = 5),但我不知道如何使用Amelia软件包来组合这些结果。有人可以帮助我吗?
response.url
dat1 <- read.csv("/Users/###/Desktop/dat1.csv")
library(Amelia)
x = data.frame
m = 5
dat1 <- subset(dat1, select=c("time","status","age","copd","nn","dm","bb","ras"))
dat1.out <- amelia(x = dat1, m = 5)
library(survIDINRI)
for(i in 1:m){
idinri <- dat1.out$imputations[[i]]
D = subset(idinri, select=c("time","status","age","copd","nn","dm","bb","ras"))
D$status = as.numeric(D$status==1)
D=D[!is.na(apply(D, 1, mean)),]; dim(D)
mydata = D
t0 = 365
indata1 = mydata;
indata0 = mydata[,c(-3)]; n=nrow(D);
covs1 <- as.matrix(indata1[,c(-1,-2)])
covs0 <- as.matrix(indata0[,c(-1,-2)])
x <- IDI.INF(mydata[,1:2],covs0,covs1,t0,npert=200)
IDI.INF.OUT(x);
}