bkcusum {cgrcusum}R Documentation

Continuous time BK-CUSUM


This function performs the BK-CUSUM procedure based on the Biswas & Kalbfleisch (2008) CUSUM. For detection purposes, it is sufficient to only determine the value of the chart at the times of failure. This can be achieved by leaving ctimes empty.


bkcusum(data, theta, coxphmod, cbaseh, ctimes, h, stoptime, C, pb = FALSE)



data.frame containing the following named columns:

  • entrytime numeric - time of entry into study,

  • survtime numeric - time from entry until event,

  • censorid integer - (optional) censoring indicator (0 = right censored, 1 = observed),

and optionally additional covariates used for risk-adjustment.


expected ln(hazard ratio) \theta


(optional) a cox proportional hazards regression model as produced by the function coxph(). Standard practice:
coxph(Surv(survtime, censorid) ~ covariates, data = data).
Alternatively, a list with:

  • $formula (~ covariates)

  • $coefficients (named vector specifying risk adjustment coefficients for covariates - names must be the same as in $formula and colnames of data).


a function which returns the non risk-adjusted cumulative baseline hazard H_0(t). If cbaseh is missing but coxphmod has been specified as a survival object, this baseline hazard rate will be determined using the provided coxphmod.


(optional) vector of construction times at which the value of the chart should be determined. When not specified, the chart is constructed at all failure times.


(optional) value of the control limit. The chart will only be constructed until the value of the control limit has been reached or surpassed.


(optional) time after which the value of the chart should no longer be determined. Default = max(failure time). Useful when ctimes has not been specified.


(optional) a numeric value indicating how long after entering the study patients should no longer influence the value of the chart. This is equivalent to right-censoring every observation at time entrytime + C.


(optional) boolean indicating whether a progress bar should be shown. Default = FALSE


The BK-CUSUM can be used to test the hypothesis of an instant change of fixed size e^\theta in the subject specific hazard rate from h_i(t) to h_i(t) e^\theta. The parameter C can be used to ignore information provided by subjects C time units after their entry into the study. The BK-CUSUM is constructed as:

G(t) = \max_{0 \leq k \leq t} \left( \theta N(k,t) - \left( e^\theta -1 \right) \Lambda(k,t) \right)

with \theta the ln(expected hazard ratio) and

N(k,t) = N(t) - N(k)

with N(t) the counting process of all failures at time t and

\Lambda(k,t) = \Lambda(t) - \Lambda(k)

the with \Lambda(t) the summed cumulative intensity of all subjects at time t.


An object of class "bkcusum" containing:

There are plot and runlength methods for "bkcusum" objects.


Daniel Gomon


Biswas P. and Kalbfleisch J.D. (2008), A risk-adjusted CUSUM in continuous time based on the Cox Model, doi: 10.1002/sim.3216

See Also

plot.bkcusum, runlength.bkcusum

Other qcchart: bercusum(), cgrcusum(), funnelplot()


tdat <- subset(surgerydat, Hosp_num == 14)
tcbaseh <- function(t) chaz_exp(t, lambda = 0.01)
varsanalysis <- c("age", "sex", "BMI")
exprfit <- as.formula(paste("Surv(survtime, censorid) ~" ,paste(varsanalysis, collapse='+')))
tcoxmod <- coxph(exprfit, data= surgerydat)
#Alternatively, cbaseh can be left empty when specifying coxphmod through coxph()
bk <- bkcusum(data = tdat, theta = log(2), coxphmod = tcoxmod, cbaseh = tcbaseh, pb = TRUE)

[Package cgrcusum version 0.1.0 Index]