cgr_cusum | R Documentation |
This function performs the CGR-CUSUM procedure
described in Gomon et al. (in review). For detection purposes, it suffices
to determine the value of the chart at the times of failure. This can be
achieved by leaving ctimes
unspecified.
The function 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
cgr_cusum(data, coxphmod, cbaseh, ctimes, h, stoptime, C, pb = FALSE, ncores = 1, cmethod = "memory", dependencies, detection = "upper")
data |
A
and optionally additional covariates used for risk-adjustment. |
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 |
pb |
(optional): A boolean indicating whether a progress bar should
be shown. Default is |
ncores |
number of cores to use to parallelize the computation of the
CGR-CUSUM chart. If ncores = 1 (default), no parallelization is done. You
can use |
cmethod |
Method to calculate chart values. One of the following:
|
dependencies |
(optional): When |
detection |
Should an |
The CGR-CUSUM can be used to test for a change of unknown positive fixed size θ in the subject-specific hazard rate from h_i(t) to h_i(t) exp(θ) starting from some unknown subject ν. The starting time of the first subject who had an increase in failure rate as well as the estimated increase in the hazard rate are shown in the output. The CGR-CUSUM is determined as
max{1<=ν<=n} (θ_{>=ν}(t)N_{>=ν}(t)) - (exp(θ_{>=ν}(t))-1) Λ_{>=ν}(t)),
where
N_{>=ν}(t) = ∑_{i>=ν} N_i(t),
with N_i(t) the counting process for the failure at time t of subject i and
Λ_{>=ν}(t) = ∑_{i>=ν}Λ_i(t),
where Λ_i(t) is the cumulative intensity of subject i at time t.
An object of class "cgrcusum" containing:
CGR
: a data.frame
with named columns:
time
:times at which chart is constructed;
value
:value of the chart at corresponding times;
exp_theta_t
:value of MLE e^(θ_t);
S_nu
time from which patients are considered for constructing the chart.
call
: the call used to obtain output;
stopind
: indicator for whether the chart was stopped by
the control limit;
h
: Specified value for the control limit.
Daniel Gomon
plot.cgrcusum
, runlength.cgrcusum
Other quality control charts:
bernoulli_cusum()
,
bk_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 cgr <- cgr_cusum(data = tdat, coxphmod = tcoxmod, cbaseh = tcbaseh, pb = TRUE) #Alternatively, cbaseh can be left empty when specifying coxphmod through coxph() #cgr <- cgr_cusum(data = tdat, coxphmod = tcoxmod, pb = TRUE) #plot the CGR-CUSUM plot(cgr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.