[R] Martingale residuals warning
David Winsemius
dwinsemius at comcast.net
Thu Aug 4 01:40:30 CEST 2016
> On Aug 3, 2016, at 12:07 PM, Isaac Singini via R-help <r-help at r-project.org> wrote:
>
> 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
That code comes across as missing almost all carriage returns. Learn to post in plain text (as per the Posting Guide.)
>
> ThanksIsaac
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list