forked from sydneykpaul/spc_healthcare_with_R_HTML
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path07_ConfusionBetweenCharts.Rmd
130 lines (110 loc) · 8.63 KB
/
07_ConfusionBetweenCharts.Rmd
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
---
title: "07_ConfusionBetweenCharts"
output: pdf_document
---
# (PART) Part III {-}
# Run Charts vs. Control Charts {#common_confusion}
We have created two useful reference tables that explore the difference between run and control charts. The first elaborates on when to use each chart. The second is how to interpret each chart. More details on specific controls charts can be found in the the chapter [A Guide to Control Charts](#guide_controlCharts).
## Which should I use: a run chart or a control chart? {#run_or_control_chart}
Always create a run chart first. Create a control chart only if you meet the necessary conditions, particularly that of monitoring a *stable* process.
In both cases, the data points must be independent, that is, the position of one point does not influence the position of another point: there is no (serious) autocorrelation. If the data are autocorrelated, the guidelines for testing run or control charts can be invalid, which can lead to poor decision-making.
<br>
\vspace{12pt}
| Use a run chart if | Use a control chart (only) if |
| ------------------------------------ | ------------------------------------- |
| You may or may not investigate or act when a data point crosses a reference, target, or goal level, or when guidelines suggest a non-random pattern is occurring. | You intend to investigate or act when the process moves outside of control or indicates special cause variation. |
| | |
| You have little control over or cannot control the metric (e.g., ED volume/acuity). | You have the potential to control the process driving the metric (e.g., ED wait times). |
| | |
| You want to monitor the behavior of individual or groups of data points to a reference, target, or goal level. | You want to monitor the "average" of the system's behavior (i.e., the underlying statistical process) and deviations from expectation. |
| | |
| You are monitoring a metric or process that is generally trending or contains seasonality or other cycles of known cause, as long as you are able to adjust for any seasonality as well as able calculate an appropriate median line (e.g., via quantile regression for trending data). | You are monitoring a *stable* statistical process (there is no trend in the time series, or you have made the appropriate corrections to account or adjust for trends or seasonality). |
| | |
| You have no expectations that normal day-to-day operations will affect the central tendency. | You expect that normal day-to-day operations will keep the process stable within the bounds of common-cause variation. |
| | |
| You do not need to account for the inherent natural variation in the system. | You need to understand and account for the inherent natural variation ("noise") in the system. |
| | |
| You have at least 12 data points. (Fewer than 12? Just make a line chart, or use an EWMA chart. Run chart guidelines may not be valid.) | You have 20 or more data points that are in a stable statistical process, or you have performed a power analysis that provides the appropriate *n* for the appropriate time interval(s). |
| | |
| You do not understand one or more of the statistical issues discussed in the control chart column. | You understand the practical trade-offs between the sensitivity and specificity of the control limits relative to your need to investigate or act. |
| | |
| | You know which statistical distribution to use to calculate the control limits to ensure you have the proper mean-variance relationship. |
<br>
\vspace{12pt}
<br>
\vspace{12pt}
## Guidelines for interpreting SPC charts {#guidelines}
``` {r sgnlex, echo = FALSE}
#
# # Example points for signal rules of thumb
# point.signal = c(0.36, -0.25, 1.07, 0.67, -1.07, 0, 0.72, 1.82, -1.50, -0.99)
# point.signal[11] = 4.0 # SCREW WITH THIS VALUE
# point.signal[12:14] = c(-2.3, -1.5, -2.5)
# point.signal[15:19] = c(1.4, 1.8, 1.3, 0.2, 1.6)
# point.signal[20:27] = c(-0.8, -0.9, -0.2, -1.5, -1.2, -0.3, -1.1, -.5)
# point.signal[28:34] = c(-.3, 0, 0.3, 0.4, 1.1, 1.9, 2.2)
#
# subgroup.signal = 1:34
# mean.signal = 0
# median.signal = median(point.signal)
# sigma.signal = rep(1,34)
#
# sig1 = as.character(expression(1~sigma~signal))
# sig2 = as.character(expression(2~sigma~signal))
#
# example_cc = spc.plot(subgroup.signal, point.signal, mean.signal, sigma.signal) +
# geom_curve(x = 0.5, xend = 10.5, y = -0.5, yend = -1.5, linetype = 2) +
# annotate('text', x = 5, y = -2.3, label = 'Normal variation') +
# geom_curve(x = 10, xend = 12, y = 3.2, yend = 3.2, curvature = -1, linetype = 2) +
# annotate('text', x = 9.5, y = 3.4, label = 'Out of control', hjust = 1) +
# geom_curve(x = 11.5, xend = 14.5, y = -2.5, yend = -2.5, linetype = 2) +
# annotate('text', x = 14.5, y = -2.8, parse = TRUE, label = sig2, hjust = 0) +
# geom_curve(x = 14.5, xend = 19.5, y = 1.5, yend = 1.5, curvature = -1, linetype = 2) +
# annotate('text', x = 17, y = 2.8, parse = TRUE, label = sig1) +
# geom_curve(x = 19.5, xend = 27, y = -1, yend = -1, curvature = 0.7, linetype = 2) +
# annotate('text', x = 23, y = -2.3, label = 'Process shift') +
# geom_curve(x = 26.5, xend = 34, y = -0.5, yend = 2.5, curvature = -0.2, linetype = 2) +
# annotate('text', x = 28, y = 1.3, label = 'Trend(?)', angle = 45) +
# theme(panel.grid.major.x = element_blank(), panel.grid.minor.x = element_blank()) +
# scale_y_continuous(breaks = seq(-3,3))
#
# ggsave("images/example_control_chart.png")
#
# # Do we want to make the y-axes the same range and line up?
#
# example_rc = spc.plot(subgroup.signal, point.signal, median.signal, sigma.signal, band.show = FALSE, ucl.show = FALSE, lcl.show = FALSE) +
# geom_curve(x = 10, xend = 12, y = 3.2, yend = 3.2, curvature = -1, linetype = 2) +
# annotate('text', x = 9.5, y = 3.4, label = 'Astronomical data point', hjust = 1) +
# geom_curve(x = 19.5, xend = 27, y = -1, yend = -1, curvature = 0.7, linetype = 2) +
# annotate('text', x = 23, y = -2.3, label = 'Process shift') +
# geom_curve(x = 26.5, xend = 34, y = -0.5, yend = 2.5, curvature = -0.2, linetype = 2) +
# annotate('text', x = 28, y = 1.3, label = 'Trend(?)', angle = 45) +
# annotate('text', x= 33, y = -0.5, label = "Median", color = "gray50") +
# theme(panel.grid.major.x = element_blank(), panel.grid.minor.x = element_blank()) +
# scale_y_continuous(breaks = seq(-3,3))
#
# ggsave("images/example_run_chart.png")
```
| Run chart | Control Chart |
| ----------------------------------- | ------------------------------------- |
| ![](images/example_run_chart.png) | ![](images/example_control_chart.png) |
| **Identifying possible signals of change in run charts** | **Detecting special cause variation in control charts** |
| | |
| *"Astronomical" data point:* a point so different from the rest that anyone would agree that the value is unusual. | *One or more points fall outside the control limit:* if the data are distributed according to the given control chart's assumptions, the probability of seeing a point outside the control limits when the process has not changed is very low. |
| | |
| *Process shift:* $log_2(n) + 3$ data points are all above or all below the median line, where $n$ is the total number of points that do $not$ fall directly on the median line. | *Process shift:* $log_2(n) + 3$ data points are all above or all below the mean line, where $n$ is the total number of points that do $not$ fall directly on the mean(?) line. |
| | |
| *Number of crossings:* Too many or too few median line crossings suggest a pattern inconsistent with natural variation [see Chapter 6.1](#runcharts). | *Number of crossings:* Too many or too few center line crossings suggest a pattern inconsistent with natural variation ([see Chapter 6.1](#runcharts)). |
| | |
| *Trend:* Seven or more consecutive points all increasing or all decreasing (though this can be an ineffective indicator\*). | *Trend:* Seven or more consecutive points all increasing or all decreasing (though this can be an ineffective indicator\*). |
| | |
| *Cycles:* There are obvious cycles that are not linked to known causes such as seasonality. | *Cycles:* There are obvious cycles of any sort. |
| | |
| | *Reduced variation:* Fifteen or more consecutive points all within 1$\sigma$. |
| | |
| | *1$\sigma$ signal:* Four of five consecutive points are more than one standard deviation away from the mean. |
| | |
| | *2$\sigma$ signal:* Two of three consecutive points are more than two standard deviations away from the mean. |
<br>
\vspace{12pt}
\**Note: Although many people use a "trend" test in association with run and control charts, research has shown this test to be ineffective (see [Useful References](#useful)).*