Dumortier, Thomas
2013-Aug-01 08:02 UTC
[R] Issue when using a coxph + summary function in R while using a pspline-transformed covariate
Hello ? I have an issue with obtaining a confidence interval from a coxph object in R while using a spline-transformed covariate. This is a time to event analysis using coxph() from the survival package. In the model below, COVA is a continuous covariate. COVA is time-dependent hence the counting process notation. COVA is transformed via pspline, COVB (FALSE or TRUE) is a fixed covariate. My goal is to get the confidence interval for COVB. With this purpose, I use the summary(?,conf.int=.95) function. I have pasted the code and the console below. The estimation works well. The summary function returns the desired confidence interval in the console, but it returns a NULL object (psp.sum is returned NULL, see below the code and the console) Note that if I do not use pspline, it works !!!!! So it seems that the use of pspline is not compatible with the summary function. This is a problem because I would like to do some simulation and need to retrieve the confidence interval from psp.sum. Can you kindly help? Rgds Tom CODE ? psp<-coxph(Surv(DAY2,DAY2P1,EVTF)~COVB+pspline(COVA, df = 0, caic = T),data=dsn4,method='breslow') psp psp.sum<-summary(psp,conf.int=.95) psp.sum ? CONSOLE 1> psp<-coxph(Surv(DAY2,DAY2P1,EVTF)~COVB+pspline(COVA, df = 0, caic = T),data=dsn4,method='breslow') ? 1> psp Call: coxph(formula = Surv(DAY2, DAY2P1, EVTF) ~ COVB + pspline(COVA, ????df = 0, caic = T), data = dsn4, method = "breslow") ? ??????????????????? ??????coef?? se(coef) se2??? Chisq DF?? p????? COVBTRUE????????????????? -1.625 0.4223?? 0.4198 14.80 1.00 1.2e-04 pspline(COVA, df = 0, caic -0.341 0.0761?? 0.0761 20.04 1.00 7.6e-06 pspline(COVA, df = 0, caic???????????????????????? 1.95 0.83 1.3e-01 ? Iterations: 10 outer, 29 Newton-Raphson ???? Theta= 0.98 Degrees of freedom for terms= 1.0 1.8 Likelihood ratio test=22.3? on 2.81 df, p=4.52e-05? n= 16933 ? 1> psp.sum<-summary(psp,conf.int=.95) Call: coxph(formula = Surv(DAY2, DAY2P1, EVTF) ~ COVB + pspline(COVA, ????df = 0, caic = T), data = dsn4, method = "breslow") ? ? n= 16933, number of events= 35 ? ????????????????????????? coef?? se(coef) se2??? Chisq DF?? p????? COVBTRUE????????????????? -1.625 0.4223?? 0.4198 14.80 1.00 1.2e-04 pspline(COVA, df = 0, caic -0.341 0.0761?? 0.0761 20.04 1.00 7.6e-06 pspline(COVA, df = 0, caic???????????????????????? 1.95 0.83 1.3e-01 ? ????????? exp(coef) exp(-coef) lower .95 upper .95 COVBTRUE??? 0.19690?????? 5.08? 8.61e-02??? 0.4506 ps(COVA)3??? 0.59903?????? 1.67? 3.48e-01??? 1.0301 ps(COVA)4??? 0.35872?????? 2.79? 1.36e-01??? 0.9470 ps(COVA)5??? 0.21394?????? 4.67? 5.82e-02??? 0.7857 ps(COVA)6??? 0.12594?????? 7.94? 2.69e-02??? 0.5898 ps(COVA)7??? 0.07290????? 13.72? 1.31e-02??? 0.4051 ps(COVA)8??? 0.04275????? 23.39? 6.84e-03??? 0.2673 ps(COVA)9??? 0.02647????? 37.78? 3.89e-03??? 0.1802 ps(COVA)10?? 0.01785????? 56.04? 2.45e-03??? 0.1301 ps(COVA)11?? 0.01310????? 76.32? 1.68e-03??? 0.1024 ps(COVA)12?? 0.01019????? 98.11? 1.19e-03??? 0.0870 ps(COVA)13?? 0.00810???? 123.39? 8.32e-04??? 0.0790 ps(COVA)14?? 0.00645???? 154.95? 5.43e-04??? 0.0767 ps(COVA)15?? 0.00512???? 195.45? 3.26e-04??? 0.0803 ps(COVA)16?? 0.00405???? 246.92? 1.80e-04??? 0.0913 ps(COVA)17?? 0.00320???? 312.04? 9.11e-05??? 0.1127 ps(COVA)18?? 0.00254???? 394.32? 4.29e-05??? 0.1499 ps(COVA)19?? 0.00201???? 498.30? 1.89e-05??? 0.2133 ? Iterations: 10 outer, 29 Newton-Raphson ???? Theta= 0.98 Degrees of freedom for terms= 1.0 1.8 Concordance= 0.673? (se = 0.05 ) Rsquare= 0.001?? (max possible= 0.026 ) Likelihood ratio test= 22.3? on 2.81 df,?? p=4.52e-05 Wald test??????????? = 24.6? on 2.81 df,?? p=1.48e-05 ? 1> psp.sum NULL 1> ? ?
David Winsemius
2013-Aug-01 15:59 UTC
[R] Issue when using a coxph + summary function in R while using a pspline-transformed covariate
On Aug 1, 2013, at 1:02 AM, Dumortier, Thomas wrote:> Hello > > I have an issue with obtaining a confidence interval from a coxph object in R while using a spline-transformed covariate. > > This is a time to event analysis using coxph() from the survival package. > In the model below, COVA is a continuous covariate. COVA is time-dependent hence the counting process notation. COVA is transformed via pspline, COVB (FALSE or TRUE) is a fixed covariate. > My goal is to get the confidence interval for COVB. With this purpose, I use the summary(?,conf.int=.95) function. > I have pasted the code and the console below. > > The estimation works well. > The summary function returns the desired confidence interval in the console, but it returns a NULL object (psp.sum is returned NULL, see below the code and the console) > > Note that if I do not use pspline, it works !!!!! > So it seems that the use of pspline is not compatible with the summary function.Not exactly. It's two different functions in reality.> > This is a problem because I would like to do some simulation and need to retrieve the confidence interval from psp.sum. > > Can you kindly help? > > Rgds > Tom > > CODE > > psp<-coxph(Surv(DAY2,DAY2P1,EVTF)~COVB+pspline(COVA, df = 0, caic = T),data=dsn4,method='breslow') > psp > psp.sum<-summary(psp,conf.int=.95) > psp.sum >If you add the line: class(psp) # you will find that it returns [1] "coxph.penal" "coxph" Then looking at the code for survival:::summary.coxph.penal, you will see that the final line is `invisible()`, so Therneau did not intend anything to be returned from a penalized fit. Generally the failure to return an object is a sign that the author thought it was a bad idea. I think the problem comes from the interval nature of the data layout. In the past, Therneau has written that the request for even plotting a survival curve itself is problematic in this situation. http://markmail.org/message/ufmtidvzfcgqdsot?q=list:org%2Er-project%2Er-help+time+dependent+covariates+survival+from:%22Terry+Therneau%22&page=1 -- David.> CONSOLE > > 1> psp<-coxph(Surv(DAY2,DAY2P1,EVTF)~COVB+pspline(COVA, df = 0, caic = T),data=dsn4,method='breslow') > > 1> psp > Call: > coxph(formula = Surv(DAY2, DAY2P1, EVTF) ~ COVB + pspline(COVA, > df = 0, caic = T), data = dsn4, method = "breslow") > > coef se(coef) se2 Chisq DF p > COVBTRUE -1.625 0.4223 0.4198 14.80 1.00 1.2e-04 > pspline(COVA, df = 0, caic -0.341 0.0761 0.0761 20.04 1.00 7.6e-06 > pspline(COVA, df = 0, caic 1.95 0.83 1.3e-01 > > Iterations: 10 outer, 29 Newton-Raphson > Theta= 0.98 > Degrees of freedom for terms= 1.0 1.8 > Likelihood ratio test=22.3 on 2.81 df, p=4.52e-05 n= 16933 > > 1> psp.sum<-summary(psp,conf.int=.95) > Call: > coxph(formula = Surv(DAY2, DAY2P1, EVTF) ~ COVB + pspline(COVA, > df = 0, caic = T), data = dsn4, method = "breslow") > > n= 16933, number of events= 35 > > coef se(coef) se2 Chisq DF p > COVBTRUE -1.625 0.4223 0.4198 14.80 1.00 1.2e-04 > pspline(COVA, df = 0, caic -0.341 0.0761 0.0761 20.04 1.00 7.6e-06 > pspline(COVA, df = 0, caic 1.95 0.83 1.3e-01 > > exp(coef) exp(-coef) lower .95 upper .95 > COVBTRUE 0.19690 5.08 8.61e-02 0.4506 > ps(COVA)3 0.59903 1.67 3.48e-01 1.0301 > ps(COVA)4 0.35872 2.79 1.36e-01 0.9470 > ps(COVA)5 0.21394 4.67 5.82e-02 0.7857 > ps(COVA)6 0.12594 7.94 2.69e-02 0.5898 > ps(COVA)7 0.07290 13.72 1.31e-02 0.4051 > ps(COVA)8 0.04275 23.39 6.84e-03 0.2673 > ps(COVA)9 0.02647 37.78 3.89e-03 0.1802 > ps(COVA)10 0.01785 56.04 2.45e-03 0.1301 > ps(COVA)11 0.01310 76.32 1.68e-03 0.1024 > ps(COVA)12 0.01019 98.11 1.19e-03 0.0870 > ps(COVA)13 0.00810 123.39 8.32e-04 0.0790 > ps(COVA)14 0.00645 154.95 5.43e-04 0.0767 > ps(COVA)15 0.00512 195.45 3.26e-04 0.0803 > ps(COVA)16 0.00405 246.92 1.80e-04 0.0913 > ps(COVA)17 0.00320 312.04 9.11e-05 0.1127 > ps(COVA)18 0.00254 394.32 4.29e-05 0.1499 > ps(COVA)19 0.00201 498.30 1.89e-05 0.2133 > > Iterations: 10 outer, 29 Newton-Raphson > Theta= 0.98 > Degrees of freedom for terms= 1.0 1.8 > Concordance= 0.673 (se = 0.05 ) > Rsquare= 0.001 (max possible= 0.026 ) > Likelihood ratio test= 22.3 on 2.81 df, p=4.52e-05 > Wald test = 24.6 on 2.81 df, p=1.48e-05 > > 1> psp.sum > NULL > 1> > > > ______________________________________________ > R-help at r-project.org mailing list > 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