View source: R/bernoulli_ARL.R
bernoulli_RL_cdf | R Documentation |
Calculate the cdf of the Run Length of the Bernoulli CUSUM,
starting from initial value between 0 and h
, using Markov Chain methodology.
bernoulli_RL_cdf(h, x, n_grid, glmmod, theta, theta_true, p0, p1,
smooth_prob = FALSE, exact = TRUE)
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 |
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
.
A list containing:
Fr_0
: A numeric value indicating the probability of the run
length being smaller than x
.
Fr
: A data.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 value start_val
;
R
: A transition probability matrix
containing the transition
probabilities between states E_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.
Brook, D., & Evans, D. A. (1972). An Approach to the Probability Distribution of CUSUM Run Length. Biometrika, 59(3), 539-549. \Sexpr[results=rd]{tools:::Rd_expr_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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/biostatistics/1.4.441")}
#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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.