Learn R Programming

vlad (version 0.2.0)

racusum_arloc_h_sim: Compute alarm threshold (Out of Control ARL) of RA-CUSUM control charts using simulation

Description

Compute alarm threshold (Out of Control ARL) of risk-adjusted cumulative sum control charts using simulation.

Usage

racusum_arloc_h_sim(L0, df, coeff, coeff2, R0 = 1, RA = 2, RQ = 1,
  m = 100, nc = 1, jmax = 4, verbose = FALSE)

Arguments

L0

Double. Prespecified in-control Average Run Length.

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.

R0

Double. Odds ratio of death under the null hypotheses.

RA

Double. Odds ratio of death under the alternative hypotheses. Detecting deterioration in performance with increased mortality risk by doubling the odds Ratio RA = 2. Detecting improvement in performance with decreased mortality risk by halving the odds ratio of death RA = 1/2.

RQ

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

m

Integer. Number of simulation runs.

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 in-control ARL.

Details

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

References

Steiner SH, Cook RJ, Farewell VT and Treasure T (2000). Monitoring surgical performance using risk-adjusted cumulative sum charts. Biostatistics, 1(4), pp. 441--452.

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 {
library(vlad)
# Set seed for reproducibility
RNGkind("L'Ecuyer-CMRG")
set.seed(1234)
parallel::mc.reset.stream()
# Datasets
data("cardiacsurgery", package = "spcadjust")
s5000 <- dplyr::sample_n(cardiacsurgery, size = 5000, replace = TRUE)
df1 <- subset(cardiacsurgery, select = c(Parsonnet, status))
df2 <- subset(s5000, select = c(Parsonnet, status))

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

# Number of simulation runs
m <- 10^3

# Deterioration:
# 1. Determine critical value for given ARL
racusum_arloc_h_sim(L0 = 370, df = df1, coeff = coeff1, coeff2 = coeff2, m = m, RA = 2, nc = 6)
# h = 2.030933

# 2. Determine ARL and Standard Error
RLS <- do.call(c, parallel::mclapply(1:m, racusum_arloc_sim, h = 2.035, df = df1, RA = 2,
                                    coeff = coeff1, coeff2 = coeff2, mc.cores = 6))
data.frame(cbind("ARL"=mean(RLS), "ARLSE"=sd(RLS)/sqrt(m)))
# ARL = 371.125; ARLSE = 11.36053

# Improvement:
# 1. Determine critical value for given ARL
racusum_arloc_h_sim(L0 = 370, df = df1, coeff = coeff1, coeff2 = coeff2, m = m, RA = 1/2,
                    nc = 6)
# h = 1.710999
#
# 2. Determine ARL and Standard Error
RLS <- do.call(c, parallel::mclapply(1:m, racusum_arloc_sim, h = 1.760, df = df1, RA = 1/2,
                                     coeff = coeff1, coeff2 = coeff2, mc.cores = 6))
data.frame(cbind("ARL" = mean(RLS), "ARLSE" = sd(RLS)/sqrt(m)))
# ARL = 399.613; ARLSE = 10.7601
# }

Run the code above in your browser using DataLab