Learn R Programming

vlad (version 0.2.0)

eocusum_arloc_h_sim: Compute alarm threshold of Out of Control EO-CUSUM control charts using simulation

Description

Compute alarm threshold (Out of Control ARL) of EO-CUSUM control charts using simulation.

Usage

eocusum_arloc_h_sim(L0, k, df, coeff, coeff2, m = 100, QS = 1,
  side = "low", nc = 1, jmax = 4, verbose = FALSE)

Arguments

L0

Double. Prespecified in-control Average Run Length.

k

Double. Reference value of the CUSUM control chart. Either 0 or a positive value. Can be determined with function optimal_k.

df

Data Frame. First column are Parsonnet Score values within a range of 0 to 100 representing the preoperative patient risk. The second column are binary (0/1) outcome values of each operation.

coeff

Numeric Vector. Estimated coefficients \(\alpha\) and \(\beta\) from the binary logistic regression model.

coeff2

Numeric Vector. Estimated coefficients \(\alpha\) and \(\beta\) from the binary logistic regression model of a resampled dataset.

m

Integer. Number of simulation runs.

QS

Double. Defines the performance of a surgeon with the odds ratio ratio of death Q.

side

Character. Default is "low" to calculate ARL for the upper arm of the V-mask. If side = "up", calculate the lower arm of the V-mask.

nc

Integer. Number of cores.

jmax

Integer. Number of digits for grid search.

verbose

Logical. If TRUE verbose output is included, if FALSE a quiet calculation of h is done.

Value

Returns a single value which is the control limit h for a given ARL.

Details

The function eocusum_arloc_h_sim determines the control limit for given in-control ARL (L0) by applying a multi-stage search procedure which includes secant rule and the parallel version of eocusum_arloc_sim using mclapply.

References

Wittenberg P, Gan FF, Knoth S (2018). A simple signaling rule for variable life-adjusted display derived from an equivalent risk-adjusted CUSUM chart. Statistics in Medicine, 37(16), pp 2455--2473.

Examples

Run this code
# NOT RUN {
data("cardiacsurgery", package = "spcadjust")
library("dplyr")

## preprocess data to 30 day mortality and subset phase I/II
cardiacsurgery <- cardiacsurgery %>% rename(s = Parsonnet) %>%
  mutate(y = ifelse(status == 1 & time <= 30, 1, 0),
         phase = factor(ifelse(date < 2*365, "I", "II")))

s5000 <- sample_n(cardiacsurgery, size = 5000, replace = TRUE)
df1 <- select(cardiacsurgery, s, y)
df2 <- select(s5000, s, y)

## estimate coefficients from logit model
coeff1 <- round(coef(glm(y ~ s, data = df1, family = "binomial")), 3)
coeff2 <- round(coef(glm(y ~ s, data = df2, family = "binomial")), 3)

## Number of simulation runs
m <- 10^3
## Number of cores
nc <- parallel::detectCores()

## Lower CUSUM (detecting deterioration)
## k = 0
eocusum_arloc_h_sim(L0 = 370, df = df1, k = 0, m = m, side = "low", coeff = coeff1, coeff2 =
coeff2, nc = nc)
## use function optimal_k() to determine k = kopt
kopt <- optimal_k(QA = 2, df = S2I, coeff = coeff1, yemp = FALSE)
eocusum_arloc_h_sim(L0 = 370, df = df1, k = kopt, m = m, side = "low", coeff = coeff1, coeff2 =
coeff2, nc = nc)

## Upper CUSUM (detecting improvement)
## k = 0
eocusum_arloc_h_sim(L0 = 370, df = df1, k = 0, m = m, side = "up", coeff = coeff1, coeff2 =
coeff2, nc = nc)
## use function optimal_k() to determine k = kopt
kopt <- optimal_k(QA = 1/2, df = S2I, coeff = coeff1, yemp = FALSE)
eocusum_arloc_h_sim(L0 = 370, df = df1, k = kopt, m = m, side = "up", coeff = coeff1, coeff2 =
 coeff2, nc = nc)
# }

Run the code above in your browser using DataLab