bernoulli_RL_cdf {success} | R Documentation |
Cumulative distribution function (cdf) of Run Length for Bernoulli CUSUM
Description
Calculate the cdf of the Run Length of the Bernoulli CUSUM,
starting from initial value between 0 and h
, using Markov Chain methodology.
Usage
bernoulli_RL_cdf(h, x, n_grid, glmmod, theta, theta_true, p0, p1,
smooth_prob = FALSE, exact = TRUE)
Arguments
h |
Control limit for the Bernoulli CUSUM |
x |
Quantile at which to evaluate the cdf. |
n_grid |
Number of state spaces used to discretize the outcome space (when |
glmmod |
Generalized linear regression model used for risk-adjustment as produced by
the function
|
theta |
The
|
theta_true |
The true log odds ratio |
p0 |
The baseline failure probability at |
p1 |
The alternative hypothesis failure probability at |
smooth_prob |
Should the probability distribution of failure under the null distribution be smoothed?
Useful for small samples. Can only be TRUE when |
exact |
Should the cdf be determined exactly (TRUE), or approximately
(FALSE)? The approximation works well for large |
Details
Let K
denote the run length of the Bernoulli CUSUM with control limit h
, then
this function can be used to evaluate P(K \leq x)
.
The formula on page 543 of Brook & Evans (1972)
is used if exact = TRUE
. When exact = FALSE
, formula (3.9) on
page 545 is used instead, approximating the transition matrix using its
Jordan canonical form. This can save computation time considerably, but is
not appropriate for small values of x
.
Value
A list containing:
-
Fr_0
: A numeric value indicating the probability of the run length being smaller thanx
. -
Fr
: Adata.frame
containing the cumulative distribution function of the run length depending on the state in which the process starts(E_0, E_1, \ldots, E_{n_{grid}-1})
start_val
:Starting value of the CUSUM, corresponding to the discretized state spaces
E_{i}
;P(K <= x)
:Value of the cdf at
x
for the CUSUM with initial valuestart_val
;
-
R
: A transition probabilitymatrix
containing the transition probabilities between statesE_0, \ldots, E_{t-1}
.R_{i,j}
is the transition probability from state i to state j.
The value of ARL_0
will be printed to the console.
References
Brook, D., & Evans, D. A. (1972). An Approach to the Probability Distribution of CUSUM Run Length. Biometrika, 59(3), 539-549. doi:10.2307/2334805
Steiner, S. H., Cook, R. J., Farewell, V. T., & Treasure, T. (2000). Monitoring surgical performance using risk-adjusted cumulative sum charts. Biostatistics, 1(4), 441-452. doi:10.1093/biostatistics/1.4.441
Examples
#Determine a risk-adjustment model using a generalized linear model.
#Outcome (failure within 100 days) is regressed on the available covariates:
glmmodber <- glm((survtime <= 100) & (censorid == 1)~ age + sex + BMI,
data = surgerydat, family = binomial(link = "logit"))
#Determine probability of run length being less than 600
prob600 <- bernoulli_RL_cdf(h = 2.5, x = 600, n_grid = 200, glmmod = glmmodber, theta = log(2))