#Determine the estimated arrival rate for all units in the data
arrival_rate(breast)
#Plot Quality Control charts for unit 11 in the study
library(survival)
phmodbreast <- coxph(Surv(survtime, censorid) ~ . - entrytime - unit ,
data = breast)
glmmodbreast <- glm((survtime <= 36) & (censorid == 1) ~ . - entrytime - unit,
data = breast, family = binomial(link = "logit"))
par(mfrow = c(1, 3))
p1 <- plot(cgr_cusum(data = subset(breast, unit == 11), coxphmod = phmodbreast)) +
ggtitle("CGR-CUSUM")
p2 <- plot(bk_cusum(data = subset(breast, unit == 11), coxphmod = phmodbreast,
theta = log(2))) + ggtitle("BK-CUSUM")
p3 <- plot(bernoulli_cusum(data = subset(breast, unit == 11), followup = 36,
glmmod = glmmodbreast, theta = log(2))) + ggtitle("Bernoulli CUSUM")
p4 <- plot(funnel_plot(data = breast, glmmod = glmmodbreast, followup = 36 )) +
ggtitle("Funnel plot")
if(require("gridExtra")){
grid.arrange(p1, p2, p3, p4, nrow = 2)
}
Run the code above in your browser using DataLab