EvaluateRules: EvaluateRules

Description Usage Arguments Details Value Examples

Description

Evaluates the selected Nelson rules for a given numerical vector.

Usage

1
2
3
EvaluateRules(x, type = "i", whichRules = 1:8, lcl = NA, cl = NA,
  ucl = NA, controlLimitDistance = 3, returnAllSelectedRules = F,
  parRules = NULL)

Arguments

x

Series to be evaluated, numerical vector

type

Type of control chart, either "i" for i-chart (default) or "c" for c-chart

whichRules

Selection of Nelson rules beeing evaluated, vector with numbers from 1 to 8

lcl

Lower control limit, single numeric value (expected as mean - controlLimitDistance * sigma), if missing the function calculates it from data

cl

Central line, single numeric value (expected as mean), if missing the function calculates it from data

ucl

Upper control limit, single numeric value (expected as mean + controlLimitDistance * sigma), if missing the function calculates it from data

controlLimitDistance

Multiple of st.dev to be used to calculate limits, possible values: 1, 2, 3 (default); this parameter affect the interpretation of lcl and ucl parameters

returnAllSelectedRules

Resulting dataframe will contain all selected rules, either True or False, if missing only valid rules returned

parRules

Optional parameters for specific rules, for details see SetParameters

Details

# Only Rules 1-4 relevant for c-chart.
# Check for non negative data for c-chart.
# For controlLimitDistance less than or equal to 2 disable rule 5.
# For controlLimitDistance less than or equal to 1 disable rule 5,6,8.
# For returnAllSelectedRules=TRUE columns of invalid rules for given evaluation are filled with NAs.

Value

Dataframe containing original vector and rules evaluation

Examples

1
2
3
4
5
6
7
8
9
# Evaluate data, use all 8 Nelson rules, limits are specified by user
EvaluateRules(x = rnorm(10), whichRules = 1:8, lcl = 0, cl = 50, ucl = 100)
#Evaluate only rule 1, 3, 5, calculate limits from data using c-chart formula,
#use 2 sigma instead of 3, modify default behaviour of rule by pars variable
#created by function SetParameters()
pars = SetParameters()
EvaluateRules(x = rpois(10, lambda = 15), type = 'c', whichRules = c(1,3,5), lcl = NA, cl = NA,
ucl = NA, controlLimitDistance = 2, parRules = pars)
# pars is object of optional parameters created by SetParameters() function

Example output

              x Rule1 Rule2 Rule3 Rule4 Rule5 Rule6 Rule7 Rule8
1   0.468784146     0     0     0     0     0     0     0     0
2  -1.419549535     1     0     0     0     1     0     0     0
3  -1.045041617     1     0     0     0     1     0     0     0
4  -0.003882725     1     0     0     0     1     1     0     0
5  -0.160671031     1     0     0     0     1     1     0     0
6   1.055723023     0     0     0     0     1     1     0     0
7  -0.469400843     1     0     0     0     1     1     0     0
8   1.337318996     0     0     0     0     1     1     0     1
9   0.174996022     0     1     0     0     1     1     0     1
10 -1.335625939     1     1     0     0     1     1     0     1
    x Rule1 Rule3
1  11     0     0
2  18     0     0
3  24     1     0
4  17     0     0
5  19     0     0
6  14     0     0
7  14     0     0
8   8     0     0
9  15     0     0
10 18     0     0

Rspc documentation built on May 2, 2019, 9:19 a.m.