qc_rules: Quality Control (QC) Rules

qc_rulesR Documentation

Quality Control (QC) Rules

Description

These rules are used for quality control (QC). Default values are set for Nelson's QC rules, but they also support Westgard, AIAG, Montgomery and Healthcare QC rules.

Usage

qc_rule1(x, m = mean(x), s = sd(x))

qc_rule2(x, m = mean(x), threshold = 9)

qc_rule3(x, threshold = 6)

qc_rule4(x, m = mean(x), threshold = 14, direction_mean = FALSE)

qc_rule5(x, m = mean(x), s = sd(x), threshold = 3)

qc_rule6(x, m = mean(x), s = sd(x), threshold = 5)

qc_rule7(x, m = mean(x), s = sd(x), threshold = 15)

qc_rule8(x, m = mean(x), s = sd(x), threshold = 8)

qc_rule_text(rule, threshold)

qc_test(x, m = mean(x), s = sd(x), guideline = "Nelson")

Arguments

x

vector with values

m

mean

s

standard deviation

threshold

minimal number of sequential values before rule is triggered (defaults to Nelson's)

direction_mean

a logical to indicate whether n observations in a row must be tested for alternating in direction of the mean

rule

number of the rule

guideline

guideline of QC rules set, must be "Nelson", "Westgard", "AIAG", "Montgomery", or "Healthcare"

Rules list

Rule Rule explanation: Nelson Westgard AIAG Montg. HC
#1 One point is more than 3 standard deviations from the mean 1 1 1 1 1
#2 n (or more) points in a row are on the same side of the mean 9 9 7 8 8
#3 n (or more) points in a row are continually incr. or decr. 6 - 6 6 6
#4 n (or more) points in a row alternate in direction, incr. then decr. 14 - 14 14 -
#5 n - 1 out of n points in a row are >2 sd from the mean 3 3 3 3 3
#6 n - 1 out of n points in a row are >1 sd from the mean 5 5 5 5 -
#7 >=n points in a row are within 1 sd of the mean 15 - 15 15 15
#8 >=n points in a row outside 1 sd of the mean, in both directions 8 - 8 8 -

Montg.: Montgomery, HC: Healthcare

Source

Nelson LS. The Shewhart Control Chart—Tests for Special Causes. Journal of Quality Technology. Informa UK Limited; 1984 Oct;16(4):237–9. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/00224065.1984.11978921")}.

Examples

x <- qc_test(rnorm(250))
x

# turn into data.frame, e.g. for export
head(as.data.frame(x))

## Not run: 

library(plot2)
plot2(x, subtitle = "Workflow 'example123'")


## End(Not run)

certe-medical-epidemiology/certestats documentation built on Nov. 9, 2024, 8:15 p.m.