View source: R/bernoulli_cusum.R
bernoulli_cusum | R Documentation |
This function can be used to construct a risk-adjusted Bernoulli CUSUM chart for survival data. It requires the specification of one of the following combinations of parameters as arguments to the function:
glmmod
& theta
p0
& theta
p0
& p1
bernoulli_cusum(data, followup, glmmod, theta, p0, p1, h, stoptime, assist,
twosided = FALSE)
data |
A
and optionally additional covariates used for risk-adjustment. |
followup |
The value of the follow-up time to be used to determine event time.
Event time will be equal to |
glmmod |
Generalized linear regression model used for risk-adjustment as produced by
the function
|
theta |
The
|
p0 |
The baseline failure probability at |
p1 |
The alternative hypothesis failure probability at |
h |
(optional): Control limit to be used for the procedure. |
stoptime |
(optional): Time after which the value of the chart should no longer be determined. |
assist |
(optional): Output of the function |
twosided |
(optional): Should a two-sided Bernoulli CUSUM be constructed?
Default is |
The Bernoulli CUSUM chart is given by
S_n = \max(0, S_{n-1} + W_n),
where
W_n = X_n \ln \left( \frac{p_1 (1-p_0)}{p_0(1-p_1)} \right) + \ln \left( \frac{1-p_1}{1-p_0} \right)
and X_n
is the outcome of the n
-th (chronological) subject in the data. In terms of the Odds Ratio:
W_n = X_n \ln \left( e^\theta \right) + \ln \left( \frac{1}{1-p_0 + e^\theta p_0} \right)
For a risk-adjusted procedure (when glmmod
is specified), a patient specific baseline failure probability p_{0i}
is modelled using logistic regression first.
Instead of the standard practice of displaying patient numbering on the
x-axis, the time of outcome is displayed.
An object of class bercusum
containing:
CUSUM
: A data.frame
containing the following named columns:
time
:times at which chart is constructed;
value
:value of the chart at corresponding times;
numobs
:number of observations at corresponding times.
call
: the call used to obtain output;
glmmod
: coefficients of the glm()
used
for risk-adjustment, if specified;
stopind
: indicator for whether the chart was stopped by the
control limit.
Daniel Gomon
plot.bercusum
, runlength.bercusum
#We consider patient outcomes 100 days after their entry into the study.
followup <- 100
#Determine a risk-adjustment model using a generalized linear model.
#Outcome (failure within 100 days) is regressed on the available covariates:
exprfitber <- as.formula("(survtime <= followup) & (censorid == 1)~ age + sex + BMI")
glmmodber <- glm(exprfitber, data = surgerydat, family = binomial(link = "logit"))
#Construct the Bernoulli CUSUM on the 1st hospital in the data set.
bercus <- bernoulli_cusum(data = subset(surgerydat, unit == 1), glmmod = glmmodber,
followup = followup, theta = log(2))
#Plot the Bernoulli CUSUM
plot(bercus)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.