bk_cusum: Continuous time BK-CUSUM

View source: R/bk_cusum.R

bk_cusumR Documentation

Continuous time BK-CUSUM

Description

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

Usage

bk_cusum(data, theta, coxphmod, cbaseh, ctimes, h, stoptime, C,
  twosided = FALSE, pb = FALSE, assist)

Arguments

data

A data.frame with rows representing subjects and the following named columns:

entrytime:

time of entry into study (numeric);

survtime:

time from entry until event (numeric);

censorid:

censoring indicator (0 = right censored, 1 = observed), (integer).

and optionally additional covariates used for risk-adjustment.

theta

The expected log-hazard ratio \theta under the alternative hypothesis. If \theta >= 0, the chart will try to detect an increase in hazard ratio (upper one-sided). If \theta < 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 coxph(). Suggested:
coxph(Surv(survtime, censorid) ~ covariates, data = data).
Alternatively, a list with the following elements:

formula:

a formula() in the form ~ covariates;

coefficients:

a named vector specifying risk adjustment coefficients for covariates. Names must be the same as in formula and colnames of data.

cbaseh

A function that returns the unadjusted 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.

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 entrytime + C.

twosided

(optional): A boolean indicating whether a two-sided CUSUM should be constructed. If TRUE, 2 CUSUM charts are determined. One to check for an increase of e^\theta and one for a decrease of e^{-\theta} in the hazard rate w.r.t. the baseline hazard. Default is FALSE.

pb

(optional): A boolean indicating whether a progress bar should be shown. Default is FALSE.

assist

(optional): Output of the function parameter_assist()

Details

The BK-CUSUM can be used to test the alternative 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 the contributions of 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),

where \theta 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

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

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

Value

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.

Author(s)

Daniel Gomon

References

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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/sim.3216")}

See Also

plot.bkcusum, runlength.bkcusum

Other quality control charts: cgr_cusum(), funnel_plot()

Examples

require(survival)
#Select only the data of the first hospital in the surgerydat data set
tdat <- subset(surgerydat, unit == 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 <- 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)
#plot the BK-CUSUM (exact hazard)
plot(bk)

#Alternatively, cbaseh can be left empty when specifying coxphmod through coxph()
bk_cox <- bk_cusum(data = tdat, theta = log(2), coxphmod = tcoxmod, pb = TRUE)
#plot the BK-CUSUM (estimated hazard from coxph)
plot(bk_cox)

success documentation built on June 22, 2024, 10:19 a.m.