bk_cusum | R Documentation |
This function implements the BK-CUSUM procedure based on the
Biswas & Kalbfleisch (2008) CUSUM. To construct the Biswas & Kalbfleisch
(2008) CUSUM, set C = 1
(years) or C = 365
(days).
For detection purposes, it is sufficient
to determine the value of the chart at the times of failure. This can be
achieved by leaving ctimes
unspecified.
The function requires the specification of theta
and
has two vital parameters, at least one of which must be specified:
coxphmod
: Cox proportional hazards model to be used for
risk-adjustment. If cbaseh
is not specified, it will be determined
from coxphmod
numerically.
cbaseh
: The cumulative baseline hazard rate to use for chart
construction. If specified with coxphmod
missing, no risk-adjustment
will be performed
bk_cusum(data, theta, coxphmod, cbaseh, ctimes, h, stoptime, C, twosided = FALSE, pb = FALSE)
data |
A
and optionally additional covariates used for risk-adjustment. |
theta |
The expected log-hazard ratio θ under the alternative hypothesis. If θ >= 0, the chart will try to detect an increase in hazard ratio (upper one-sided). If θ < 0, the chart will look for a decrease in hazard ratio (lower one-sided). |
coxphmod |
A Cox proportional hazards regression model as
produced by
the function
|
cbaseh |
A function that returns the unadjusted cumulative
baseline hazard H_0(t). If |
ctimes |
(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. |
h |
(optional): Value of the control limit. The chart will only be constructed until the value of the control limit has been reached or surpassed. |
stoptime |
(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. |
C |
(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 |
twosided |
(optional): A boolean indicating whether a two-sided CUSUM
should be constructed.
If |
pb |
(optional): A boolean indicating whether a progress bar should
be shown. Default is |
The BK-CUSUM can be used to test the alternative hypothesis of an
instant change of fixed size exp(θ)
in the subject specific hazard rate from h_i(t) to
h_i(t) exp(θ). The parameter C
can be used
to ignore the contributions of subjects, C time units after their entry
into the study.
The BK-CUSUM is constructed as
G(t) = max_{0 <= k <= t} (θ N(k,t) - (e^θ -1) Λ(k,t)),
where θ is the log expected hazard ratio,
N(k,t) = N(t)-N(k)
with N(t) the counting process of all failures at time t, and
Λ(k,t) = Λ(t) - Λ(k)
with Λ(t) the summed cumulative intensity of all subjects at time t.
An object of class bkcusum
containing:
BK
: a data.frame
containing the following named columns:
time
:times at which chart is constructed;
value
:value of the chart at corresponding times.
stopind
: indicator for whether the chart was stopped by
the control limit;
call
: the call used to obtain output;
h
: Specified value for the control limit.
Daniel Gomon
Biswas P. and Kalbfleisch J.D. (2008), A risk-adjusted CUSUM in continuous time based on the Cox Model, Statistics in medicine 27, 3452-3452. doi: 10.1002/sim.3216
plot.bkcusum
, runlength.bkcusum
Other quality control charts:
bernoulli_cusum()
,
cgr_cusum()
,
funnel_plot()
require(survival) #Select only the data of the first hospital in the surgerydat data set tdat <- subset(surgerydat, hosp_num == 1) #We know that the cumulative baseline hazard in the data set is #Exponential(0.01). If you don't know the cumulative baseline, we suggest #leaving the cbaseh argument empty and determining a coxphmod (see help) tcbaseh <- function(t) chaz_exp(t, lambda = 0.01) #Determine a risk-adjustment model using a Cox proportional hazards model. #Outcome (survival) is regressed on the available covariates: exprfit <- as.formula("Surv(survtime, censorid) ~ age + sex + BMI") tcoxmod <- coxph(exprfit, data= surgerydat) #Determine the values of the chart bk <- bk_cusum(data = tdat, theta = log(2), coxphmod = tcoxmod, cbaseh = tcbaseh, pb = TRUE) #Alternatively, cbaseh can be left empty when specifying coxphmod through coxph() #bk <- bk_cusum(data = tdat, theta = log(2), coxphmod = tcoxmod, pb = TRUE) #plot the BK-CUSUM plot(bk)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.