[R] Martingale residuals warning

Isaac Singini iluwinga at yahoo.com
Wed Aug 3 21:07:06 CEST 2016


Dear AllI am new to R,  I am struggling to figure out and resolve warning.I have fitted a joint model for survival and longitudinal data using the "JM" library using the syntax below.
# Longitudinal submodellmeFit.p1_constr <- lme(sqrtcd4wk ~ cd4tpt  + pred:cd4tpt, data = cd4long_constr,                  random = ~cd4tpt|id1, na.action = na.omit) 
# Survival submodel for constrictionsurvFit.p1Constr <- coxph(Surv(surv6mon_constr, var6mon_constr) ~ pred, data = surv_full_constr, x = TRUE)

# Joint model for constrictionjointFit.p1Constr <- jointModel(lmeFit.p1_constr, survFit.p1Constr, timeVar = "cd4tpt",                          method = "piecewise-PH-aGH")summary(jointFit.p1Constr)
I am able to get my desired results i.e. estimates and 95% C.I. I am however not able to calculate  Martingale residuals from the event process submodel using the following syntax despite being able to calculate Cox-Snell residuals using the following syntax
resMartT <- residuals(jointFit.p1Constr, process = "Event", type = "Martingale")
#resMartT<-resid(survFit.p1Constr,type='martingale')fitSubY <- fitted(jointFit.p1Constr, process = "Longitudinal", type = "EventTime")plot(fitSubY, resMartT, xlab = "Fitted Values", ylab = "Residuals",main = "Martingale Residuals vs Fitted Values")
I get a warning : Warning message: In events - fits :  longer object length is not a multiple of shorter object length
# Cox-Snell residualsresCST <- residuals(jointFit.p1Constr, process = "Event", type = "CoxSnell")
sfit <- survfit(Surv(resCST, var6mon_constr) ~ 1, data = surv_full_constr)plot(sfit, mark.time = FALSE, conf.int = TRUE, lty = 1:2, xlab = "Cox-Snell Residuals", ylab = "Survival Probability",      main = "Survival Function of Cox-Snell Residuals")curve(exp(-x), from = 0, to = max(surv_full_constr$var6mon_constr), add = TRUE, col = "red", lwd = 2)
I will appreciate any assistance rendered

ThanksIsaac


	[[alternative HTML version deleted]]



More information about the R-help mailing list