# NOT RUN {
d.titanic = Untable(Titanic)
r.glm <- glm(Survived ~ ., data=d.titanic, family=binomial)
Cstat(r.glm)
# default interface
Cstat(x = predict(r.glm, method="response"),
resp = model.response(model.frame(r.glm)))
# calculating bootstrap confidence intervals
FUN <- function(d.set, i) {
r.glm <- glm(Survived ~ ., data=d.set[i,], family=binomial)
Cstat(r.glm)
}
# }
# NOT RUN {
library(boot)
boot.res <- boot(d.titanic, FUN, R=999)
# the percentile confidence intervals
boot.ci(boot.res, type="perc")
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 999 bootstrap replicates
##
## CALL :
## boot.ci(boot.out = res, type = "perc")
##
## Intervals :
## Level Percentile
## 95% ( 0.7308, 0.7808 )
## Calculations and Intervals on Original Scale
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab