[R] censboot function for bootstrapping Cox proportional Hazard Model
GeertSim
geert.simkens at catharinaziekenhuis.nl
Sun May 31 23:10:06 CEST 2015
Dear all,
I developed a cox regression model with three independent factors to predict
overall survival in a specific group of patients. I would like to adjust
this model for overoptimism with the censboot function of the boot package.
I would like to use bootstrapping to adjust the regression coefficients of
this model. However, I am unable to complete all the arguments of the
censboot function after searching for several hours. The error I am not able
to fix in the formula is:
> censboot(coxpredictors, mod.coxregr.hub, R=10, sim="ordinary")
Error in censboot(coxpredictors, mod.coxregr.hub, R = 10, sim = "ordinary")
:
incorrect number of subscripts on matrix
I assume it has something to do with the strata argument, but I am not sure
how to fix that. Furthermore, is "ordinary" simulation the correct type for
this kind of analysis? I hope someone can help me to complete the formula so
I can perform my bootstrap analysis. You can find my entire script below.
Many thanks in advance.
Best regards,
Geert Simkens
> library(Hmisc)
> library(survival)
> library(foreign)
> library(boot)
> library(car)
> library(pROC)
> load("~/coxmodel.Rda")
> attach(coxpredictors)
>
> summary(coxpredictors)
FollowUpMonths Event PCI10 N2
Symptoms
Min. : 0.1314 Min. :0.0000 Min. :0.0000 Min. :0.000 Min.
:0.0000
1st Qu.:11.3676 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:0.000 1st
Qu.:1.0000
Median :19.6797 Median :0.0000 Median :0.0000 Median :0.000 Median
:1.0000
Mean :23.4967 Mean :0.4472 Mean :0.3668 Mean :0.402 Mean
:0.8241
3rd Qu.:32.2135 3rd Qu.:1.0000 3rd Qu.:1.0000 3rd Qu.:1.000 3rd
Qu.:1.0000
Max. :87.1622 Max. :1.0000 Max. :1.0000 Max. :1.000 Max.
:1.0000
>
> time <- FollowUpMonths
> event <- Event
> X <- cbind(PCI10, N2, Symptoms)
> summary(time)
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.1314 11.3700 19.6800 23.5000 32.2100 87.1600
>
> # cox regression model with dataname first
> mod.coxregr.hub = function(coxpredictors)
+ {
+ coxph(Surv(time,event == 1) ~ X, method="breslow", model=TRUE)
+ }
>
> # cox regression model
> coxmodel = coxph(Surv(time,event == 1) ~ X, method="breslow", model=TRUE)
>
> summary(coxmodel)
Call:
coxph(formula = Surv(time, event == 1) ~ X, model = TRUE, method =
"breslow")
n= 199, number of events= 89
coef exp(coef) se(coef) z Pr(>|z|)
XPCI10 1.3179 3.7356 0.2198 5.996 2.02e-09 ***
XN2 0.5587 1.7485 0.2165 2.580 0.00987 **
XSymptoms 0.8102 2.2483 0.3787 2.139 0.03241 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
exp(coef) exp(-coef) lower .95 upper .95
XPCI10 3.736 0.2677 2.428 5.747
XN2 1.748 0.5719 1.144 2.673
XSymptoms 2.248 0.4448 1.070 4.723
Concordance= 0.703 (se = 0.033 )
Rsquare= 0.216 (max possible= 0.982 )
Likelihood ratio test= 48.42 on 3 df, p=1.73e-10
Wald test = 48.11 on 3 df, p=2.02e-10
Score (logrank) test = 52.96 on 3 df, p=1.867e-11
>
> # bootstrapping formula
> censboot(coxpredictors, mod.coxregr.hub, R=10, sim="ordinary")
Error in censboot(coxpredictors, mod.coxregr.hub, R = 10, sim = "ordinary")
:
incorrect number of subscripts on matrix
>
>
--
View this message in context: http://r.789695.n4.nabble.com/censboot-function-for-bootstrapping-Cox-proportional-Hazard-Model-tp4707989.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list