racusum: Risk-adjusted CUSUM Charts

Description Usage Arguments Examples

View source: R/racusum.R

Description

Calculate risk-adjusted CUSUM charts for performance data

Usage

1
2
3
racusum(patient_risks, patient_outcomes, limit, weights = NULL,
  odds_multiplier = 2, reset = TRUE, limit_method = c("constant",
  "dynamic"))

Arguments

patient_risks

Double. Vector of patient risk scores (individual risk of adverse event)

patient_outcomes

Integer. Vector of binary patient outcomes (0,1)

limit

Double. Control limit for signalling performance change

weights

Double. Optional vector of weights, if empty, standard CUSUM weights are calculated with weights_t

odds_multiplier

Double. Odds multiplier of adverse event under the alternative hypothesis (<1 looks for decreases)

reset

Logical. Reset the CUSUM after a signal to 0; defaults to TRUE

limit_method

"constant" or "dynamic"

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Patients risks are usually known from Phase I.
# If not, these risk scores can be simulated.

# define possible patient risk scores
risks <- c(0.001, 0.01, 0.1, 0.002, 0.02, 0.2)

# sample risk population of size n = 100
set.seed(2046)
patient_risks <- sample(x = risks, size = 100, replace = TRUE)

# control limit can be obtained with racusum_limit_sim(),
# here it is set to an arbitrary value (2.96),
# or dynamic control limits with racusum_limit_dpcl()

##### RA-CUSUM of in-control process
# simulate patient outcome for performace as expected
set.seed(2046)
patient_outcomes <- as.logical(rbinom(
  n = 100,
  size = 1,
  prob = patient_risks
))

racusum(patient_risks,
  patient_outcomes,
  limit = 2.96
)

#### RA-CUSUM of out-of-control process
# simulate patient outcome for deviating performance

set.seed(2046)
patient_outcomes <- as.logical(rbinom(n = 100, size = 1, prob = patient_risks * 2))
#'
racusum(patient_risks,
  patient_outcomes,
  limit = 2.96
)

Example output

      t     p         ct signal limit
1     1 0.100 0.00000000      0     0
2     2 0.002 0.00000000      0     0
3     3 0.002 0.00000000      0     0
4     4 0.001 0.00000000      0     0
5     5 0.010 0.00000000      0     0
6     6 0.010 0.00000000      0     0
7     7 0.001 0.00000000      0     0
8     8 0.002 0.00000000      0     0
9     9 0.100 0.59783700      0     0
10   10 0.200 0.41551544      0     0
11   11 0.010 0.40556511      0     0
12   12 0.001 0.40456561      0     0
13   13 0.010 0.39461528      0     0
14   14 0.010 0.38466495      0     0
15   15 0.100 0.28935477      0     0
16   16 0.010 0.27940444      0     0
17   17 0.010 0.26945411      0     0
18   18 0.001 0.26845461      0     0
19   19 0.001 0.26745511      0     0
20   20 0.010 0.25750478      0     0
21   21 0.100 0.16219460      0     0
22   22 0.020 0.14239197      0     0
23   23 0.001 0.14139247      0     0
24   24 0.010 0.13144214      0     0
25   25 0.020 0.11163951      0     0
26   26 0.020 0.09183689      0     0
27   27 0.200 0.00000000      0     0
28   28 0.020 0.00000000      0     0
29   29 0.200 0.51082562      0     0
30   30 0.200 0.32850407      0     0
31   31 0.010 0.31855374      0     0
32   32 0.010 0.30860341      0     0
33   33 0.200 0.81942903      0     0
34   34 0.020 0.79962640      0     0
35   35 0.002 0.79762840      0     0
36   36 0.002 0.79563040      0     0
37   37 0.001 0.79463090      0     0
38   38 0.002 0.79263289      0     0
39   39 0.010 0.78268256      0     0
40   40 0.010 0.77273223      0     0
41   41 0.020 0.75292960      0     0
42   42 0.001 0.75193010      0     0
43   43 0.200 0.56960855      0     0
44   44 0.100 0.47429837      0     0
45   45 0.100 0.37898819      0     0
46   46 0.010 0.36903786      0     0
47   47 0.010 0.35908753      0     0
48   48 0.002 0.35708952      0     0
49   49 0.200 0.17476797      0     0
50   50 0.020 0.15496534      0     0
51   51 0.010 0.14501501      0     0
52   52 0.001 0.14401551      0     0
53   53 0.010 0.13406518      0     0
54   54 0.001 0.13306568      0     0
55   55 0.002 0.13106767      0     0
56   56 0.002 0.12906967      0     0
57   57 0.020 0.10926704      0     0
58   58 0.100 0.01395686      0     0
59   59 0.001 0.01295736      0     0
60   60 0.020 0.00000000      0     0
61   61 0.200 0.00000000      0     0
62   62 0.002 0.00000000      0     0
63   63 0.002 0.00000000      0     0
64   64 0.002 0.00000000      0     0
65   65 0.010 0.00000000      0     0
66   66 0.100 0.00000000      0     0
67   67 0.020 0.00000000      0     0
68   68 0.100 0.00000000      0     0
69   69 0.020 0.00000000      0     0
70   70 0.001 0.00000000      0     0
71   71 0.020 0.00000000      0     0
72   72 0.100 0.00000000      0     0
73   73 0.002 0.00000000      0     0
74   74 0.020 0.00000000      0     0
75   75 0.010 0.00000000      0     0
76   76 0.001 0.00000000      0     0
77   77 0.002 0.00000000      0     0
78   78 0.010 0.00000000      0     0
79   79 0.200 0.00000000      0     0
80   80 0.100 0.00000000      0     0
81   81 0.100 0.00000000      0     0
82   82 0.001 0.00000000      0     0
83   83 0.100 0.00000000      0     0
84   84 0.002 0.00000000      0     0
85   85 0.002 0.00000000      0     0
86   86 0.020 0.00000000      0     0
87   87 0.100 0.00000000      0     0
88   88 0.200 0.51082562      0     0
89   89 0.200 0.32850407      0     0
90   90 0.020 0.30870144      0     0
91   91 0.001 0.30770194      0     0
92   92 0.200 0.81852756      0     0
93   93 0.001 0.81752806      0     0
94   94 0.020 0.79772544      0     0
95   95 0.001 0.79672594      0     0
96   96 0.100 0.70141576      0     0
97   97 0.002 0.69941775      0     0
98   98 0.200 0.51709620      0     0
99   99 0.002 0.51509819      0     0
100 100 0.100 0.41978801      0     0
      t     p         ct signal limit
1     1 0.100 0.00000000      0     0
2     2 0.002 0.00000000      0     0
3     3 0.002 0.00000000      0     0
4     4 0.001 0.00000000      0     0
5     5 0.010 0.00000000      0     0
6     6 0.010 0.00000000      0     0
7     7 0.001 0.00000000      0     0
8     8 0.002 0.00000000      0     0
9     9 0.100 0.59783700      0     0
10   10 0.200 0.41551544      0     0
11   11 0.010 0.40556511      0     0
12   12 0.001 0.40456561      0     0
13   13 0.010 0.39461528      0     0
14   14 0.010 0.38466495      0     0
15   15 0.100 0.28935477      0     0
16   16 0.010 0.27940444      0     0
17   17 0.010 0.26945411      0     0
18   18 0.001 0.26845461      0     0
19   19 0.001 0.26745511      0     0
20   20 0.010 0.25750478      0     0
21   21 0.100 0.16219460      0     0
22   22 0.020 0.14239197      0     0
23   23 0.001 0.14139247      0     0
24   24 0.010 0.13144214      0     0
25   25 0.020 0.11163951      0     0
26   26 0.020 0.09183689      0     0
27   27 0.200 0.00000000      0     0
28   28 0.020 0.00000000      0     0
29   29 0.200 0.51082562      0     0
30   30 0.200 0.32850407      0     0
31   31 0.010 0.31855374      0     0
32   32 0.010 0.30860341      0     0
33   33 0.200 0.81942903      0     0
34   34 0.020 0.79962640      0     0
35   35 0.002 0.79762840      0     0
36   36 0.002 0.79563040      0     0
37   37 0.001 0.79463090      0     0
38   38 0.002 0.79263289      0     0
39   39 0.010 0.78268256      0     0
40   40 0.010 0.77273223      0     0
41   41 0.020 0.75292960      0     0
42   42 0.001 0.75193010      0     0
43   43 0.200 0.56960855      0     0
44   44 0.100 0.47429837      0     0
45   45 0.100 0.37898819      0     0
46   46 0.010 0.36903786      0     0
47   47 0.010 0.35908753      0     0
48   48 0.002 0.35708952      0     0
49   49 0.200 0.17476797      0     0
50   50 0.020 0.15496534      0     0
51   51 0.010 0.14501501      0     0
52   52 0.001 0.14401551      0     0
53   53 0.010 0.13406518      0     0
54   54 0.001 0.13306568      0     0
55   55 0.002 0.13106767      0     0
56   56 0.002 0.12906967      0     0
57   57 0.020 0.10926704      0     0
58   58 0.100 0.01395686      0     0
59   59 0.001 0.01295736      0     0
60   60 0.020 0.00000000      0     0
61   61 0.200 0.00000000      0     0
62   62 0.002 0.00000000      0     0
63   63 0.002 0.00000000      0     0
64   64 0.002 0.00000000      0     0
65   65 0.010 0.00000000      0     0
66   66 0.100 0.00000000      0     0
67   67 0.020 0.00000000      0     0
68   68 0.100 0.59783700      0     0
69   69 0.020 1.27118155      0     0
70   70 0.001 1.27018205      0     0
71   71 0.020 1.25037943      0     0
72   72 0.100 1.15506925      0     0
73   73 0.002 1.15307124      0     0
74   74 0.020 1.13326862      0     0
75   75 0.010 1.12331829      0     0
76   76 0.001 1.12231879      0     0
77   77 0.002 1.12032078      0     0
78   78 0.010 1.11037045      0     0
79   79 0.200 0.92804890      0     0
80   80 0.100 0.83273872      0     0
81   81 0.100 0.73742854      0     0
82   82 0.001 0.73642904      0     0
83   83 0.100 0.64111886      0     0
84   84 0.002 0.63912085      0     0
85   85 0.002 0.63712285      0     0
86   86 0.020 0.61732022      0     0
87   87 0.100 0.52201004      0     0
88   88 0.200 1.03283567      0     0
89   89 0.200 0.85051411      0     0
90   90 0.020 0.83071148      0     0
91   91 0.001 0.82971198      0     0
92   92 0.200 1.34053761      0     0
93   93 0.001 1.33953811      0     0
94   94 0.020 1.31973548      0     0
95   95 0.001 1.31873598      0     0
96   96 0.100 1.22342580      0     0
97   97 0.002 1.22142780      0     0
98   98 0.200 1.03910624      0     0
99   99 0.002 1.03710824      0     0
100 100 0.100 1.63494524      0     0

cusum documentation built on Oct. 2, 2019, 5:03 p.m.