spc_i: SPC I

Description Usage Arguments Value Examples

View source: R/spc_i.R

Description

Calculates limits for an SPC-I chart

Usage

1
2
3
4
5
6
7
8
spc_i(
  x = seq_along(y),
  y = numeric(),
  centre = NULL,
  limits = 3,
  exclude = rep(FALSE, length(y)),
  freeze = NULL
)

Arguments

x

numeric vector to order y by, defaults to an incrementing sequence (assuming the provided order of y is correct)

y

numeric vector that we want to calculate control limits for

centre

the centre of y, defaults to the mean of y

limits

the multiplier used to calculate limits, defaults to +/- 3

exclude

a logical vector the same length of y, indicating points to exclude from control limit calculations

freeze

a number indicating after how many points to freeze control limit calculations after

Value

an spc_i object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
set.seed(123)
y <- rnorm(10)
spc_i(y = y)

x <- sample(1:10)
spc_i(x, y)

spc_i(x, y, centre = 3)

spc_i(x, y, exclude = sample(c(TRUE, FALSE),
                             size = length(y),
                             prob = c(0.3, 0.7),
                             replace = TRUE))

tomjemmett/NHSRspc documentation built on Dec. 31, 2020, 8:44 a.m.