# NOT RUN {
mv.surv <- Surv(martinvanberg$formdur, event = rep(1, nrow(martinvanberg)))
mv.cox <- coxph(mv.surv ~ postel + prevdef + cont + ident + rgovm +
pgovno + tpgovno + minority, method = "breslow", data = martinvanberg)
ed <- coxed.gam(mv.cox)
summary(ed$gam.data)
summary(ed$gam.model)
ed$exp.dur
#Plotting the GAM fit
# }
# NOT RUN {
require(ggplot2)
ggplot(ed$gam.data, aes(x=rank.xb, y=y)) +
geom_point() +
geom_line(aes(x=rank.xb, y=gam_fit)) +
geom_ribbon(aes(ymin=gam_fit_95lb, ymax=gam_fit_95ub), alpha=.5) +
xlab("Cox model LP rank (smallest to largest)") +
ylab("Duration")
# }
# NOT RUN {
#Running coxed.gam() on a bootstrap sample and with new coefficients
bsample <- sample(1:nrow(martinvanberg), nrow(martinvanberg), replace=TRUE)
newcoefs <- rnorm(8)
ed2 <- coxed.gam(mv.cox, b.ind=bsample, coef=newcoefs)
# }
Run the code above in your browser using DataLab