[R] bootstrapped cox regression (rms package)
Eric Claus
clausericd at gmail.com
Fri Nov 30 19:32:21 CET 2012
Hi Frank,
My apologies for not posting the entire script - I have repasted it below.
library(rms)
library(foreign)
temp=read.spss('coxdata.sav', to.data.frame=T)
formula=Surv(months, recidivate) ~ fac1 + fac2 + fac3 + fac4 + fac5 + fac6 +
fac7 + fac8
fit=cph(formula, data=temp, x=T, y=T)
val.out=validate(fit, method="boot", B=9999, bw=F, type="residual",
sls=0.05, aics=0,force=NULL, estimates=TRUE, pr=FALSE)
out=bootcov(fit, B=9999, pr=F, coef.reps=T, loglik=F)
anova(out)
Factor Chi-Square d.f. P
fac1 0.27 1 0.6055
fac2 0.20 1 0.6514
fac3 0.01 1 0.9338
fac4 0.05 1 0.8311
fac5 1.06 1 0.3036
fac6 0.33 1 0.5647
fac7 0.81 1 0.3670
fac8 0.30 1 0.5832
TOTAL 1.48 8 0.9930
for (i in 1:8) {
print(quantile(out$boot.Coef[,i], c(.025, .975)))
}
2.5% 97.5%
-9.236751 20.772061
2.5% 97.5%
-8.841030 3.094755
2.5% 97.5%
-1.834436 2.161983
2.5% 97.5%
-0.1800666 0.0871867
2.5% 97.5%
-3.2129636 0.4783566
2.5% 97.5%
-0.04157389 0.07130994
2.5% 97.5%
-0.6415962 0.1001843
2.5% 97.5%
-0.01529467 0.21055259
Again, the SPSS output I am trying to match is here:
variable low CI high CI p-value
fac1 -8.474 20.020 .456
fac2 -8.206 3.093 .524
fac3 -1.829 2.087 .900
fac4 -.173 .083 .749
fac5 -2.945 .450 .143
fac6 -.035 .070 .306
fac7 -.626 .092 .189
fac8 -.017 .203 .247
In looking through the SPSS syntax, my colleague is using SIMPLE resampling,
which is doing sampling with replacement from the original data set. 9999
bootstrap replications are being used, the same as what I have used in the
bootcov command. The piece of the SPSS output that is not clear is the
generation of p-values from the distribution of parameter estimates; spss
appears to be testing the parameter estimate from the original cox
regression, but the method of testing that parameter is not clear.
Eric
--
View this message in context: http://r.789695.n4.nabble.com/bootstrapped-cox-regression-rms-package-tp4651306p4651474.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list