Retsilisitsoe Moholisa
2013-Feb-15 15:53 UTC
[R] Ho w Do I Get Cox Model Convergence After Multiple Imputation
Due to missing data with some of my predictor variables I first do multiple imputation as follows: library(foreign) library(Amelia) library(norm) set.seed(666) M=10 impdat <- NVP[,c("X_t0","X_t","nvp","adstatus","t0rwfa","ageatran","whostage","t0rhfa","vlsupp","t0rwfh","t0rvl","t0rcd4pc","postrantb","resistance","id")] round(apply(apply(impdat,c(1,2),is.na),2,mean),digits=3) # percentage of missing values myimp <- amelia(impdat, m=M, p2s=0, noms=c("postrantb","vlsupp","whostage","resistance"),cs=c("id"),ts=c("X_t0"),bounds=matrix(c(3,0,70, 4,0,100, 11,0,400, 12,0,50 ),ncol=3,nrow=4,byrow=T),logs="nvp",polytime=3,splinetime=3,empri=1000,incheck=TRUE,tolerance=0.001) The I do cox model as follows # Categorization of relevant variables for(i in 1:10){ myimp$imputations[[i]] <- cbind(myimp$imputations[[i]],cut(myimp$imputations[[i]]$t0rvl,breaks=c(-1,50,400,1000000000))) colnames(myimp$imputations[[i]])[15]<-c("vlcat") myimp$imputations[[i]] <- cbind(myimp$imputations[[i]],cut(myimp$imputations[[i]]$t0rcd4pc,breaks=c(-1,25,1000000000))) colnames(myimp$imputations[[i]])[16]<-c("cd4pccat") myimp$imputations[[i]] <- cbind(myimp$imputations[[i]],cut(myimp$imputations[[i]]$ageatran,breaks=c(-1,36,1000000000))) colnames(myimp$imputations[[i]])[17]<-c("agecat") myimp$imputations[[i]] <- cbind(myimp$imputations[[i]],cut(myimp$imputations[[i]]$t0rwfa,breaks=c(-1000,-3,-2,10))) colnames(myimp$imputations[[i]])[18]<-c("wfacat") myimp$imputations[[i]] <-cbind(myimp$imputations[[i]],cut(myimp$imputations[[i]]$t0rwfh,breaks=c(-1000,-3,-2,10)) colnames(myimp$imputations[[i]])[19]<-c("wfhcat") myimp$imputations[[i]] <- cbind(myimp$imputations[[i]],cut(myimp$imputations[[i]]$t0rhfa,breaks=c(-1000,-3,-2,10))) colnames(myimp$imputations[[i]])[20]<-c("hfacat") myimp$imputations[[i]] <- cbind(myimp$imputations[[i]],cut(myimp$imputations[[i]]$nvp,breaks=c(-1,1,1000000000))) colnames(myimp$imputations[[i]])[21]<-c("nvpcat1") myimp$imputations[[i]] <- cbind(myimp$imputations[[i]],cut(myimp$imputations[[i]]$nvp,breaks=c(-1,4,1000000000))) colnames(myimp$imputations[[i]])[22]<-c("nvpcat10")} head(myimp$imputations[[1]]) ###### Then I perform cox regression as follows m2_1<-coxph(Surv(X_t0,X_t, vlsupp) ~ nvp + as.factor(cd4pccat) + as.factor(vlcat) + as.factor(agecat) + as.factor(whostage) + as.factor(hfacat) + as.factor(wfacat) + as.factor(wfhcat) + as.factor(resistance) + as.factor(postrantb) + cluster(id),data=myimp$imputations[[1]],method="breslow",robust=TRUE) summary(m2_1) The I get the following eWarning message: In fitter(X, Y, strats, offset, init, control, weights = weights, : Ran out of iterations and did not converge I have tried to increase the maximum number of iterations,however I still get the same warning message. I have also looked at change my initial estimates but I get the following error Error in fitter(X, Y, strats, offset, init, control, weights = weights, : Wrong length for inital values Does anybody know have any suggestions as to I can get the model to converge Kind Regards -- Retsilisitsoe Moholisa, MSc Medical Biochemistry PhD Student in Pharmacometrics Pharmacometrics Lab Department of Clinical Pharmacology Faculty of Health Sciences University of Cape Town Tel:021-404 7719 Cell:0712801254 [[alternative HTML version deleted]]