SNS: Sequential Normal Scores

Description Usage Arguments Value Comments See Also Examples

View source: R/UnivariateSequentialNormalScores.R

Description

Transform a vector X into SNS using initial observations Y if available SNS follow the order of X.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
SNS(
  X,
  X.id,
  Y = NULL,
  theta = NULL,
  Ftheta = NULL,
  scoring = "Z",
  Chi2corrector = "None",
  alignment = "unadjusted",
  constant = NULL,
  absolute = FALSE,
  chart = "Shewhart",
  chart.par = c(3),
  snsRaw = FALSE,
  isFixed = FALSE,
  omit.id = NULL,
  auto.omit.alarm = TRUE
)

Arguments

X

vector. New observations to obtain the N¡normal scores.

X.id

vector. The id of the vector X.

Y

vector. If Y is not defined (no previous observation available, NULL), NS is relative to X. Default NULL.

theta

scalar. Value corresponig with the Ftheta quantile.

Ftheta

scalar. Quantile of the data distribution. The values that take are between (0,1).

scoring

character string. If "Z" (normal scores) (default). If "Z-SQ" (normal scores squared).

Chi2corrector

character string. Only when scoring is Z-SQ. Select from

  • "approx: Z^2*(m + 1 + 1.3)/(m+1).

  • "exact": Z^2/mean(Z).

  • "none": Z^2.

If "approx" () (default). If "exact" (normal scores squared).

alignment

character string. Aligment of the data X and Y. Select from

  • "unadjusted": nothing is sustracte from X and Y (default).

  • "overallmean": overall mean is sustracted from X and Y.

  • "overallmedian": overall median is sustracted from X and Y.

  • "samplemean": mean from corresponding group (X and Y) is sustracted from its corresponing vector.

  • "samplemedian": median from corresponding group (X and Y) is sustracted from its corresponing vector.

  • "referencemean": mean from Y is subtracted from X and Y.

  • "referencemedian": median from Y is subtracted from X and Y.

  • "constantvalue": a constant value is subtracted from X and Y.

constant

scalar. Only used when the alignment is selected "constantvalue". Default NULL.

absolute

logical. If TRUE, the absolute aligned values are obtained. (Default FALSE)

chart

character string. Selected type of chart. Three options are available: Shewhart, CUSUM, EWMA

chart.par

vector. The size depends on the selected chart:

Shewhart scheme:

is c(k), where k comes from UCL = mu + kσ, LCL = mu - kσ.

CUSUM scheme:

is c(k, h, t) where k is the reference value and h is the control limit, and t is the type of the chart (1:positive, 2:negative, 3:two sides)

EWMA scheme:

is c(lambda, L), where lambda is the smoothing constant and L multiplies standard deviation to get the control limit

snsRaw

logical. If TRUE return also the sns for each observation in vector X.

isFixed

logical. If TRUE the reference sample does not update, otherwise the reference sample is updated whenever the batch is in control.

omit.id

vector. Elements of the vector are the id which are omitted in the analysis.

auto.omit.alarm

logical. Determine if OC signals are added (or not) to reference sample. By default is set to TRUE.

Value

Multiple output. Select by output$

Comments

If ties occur, average ranks are used.

See Also

NS for normal scores

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
39
# EXAMPLE CONDITIONAL WITH REFERENCE SAMPLE
Y <- c(10, 20, 30, 40, 50, 60, 70, 80, 90, 100)
X <- c(30, 35, 45)
theta <- 40
Ftheta <- 0.5
sample.id <- c("a", "b", "c")
SNS(X = X, X.id = sample.id, Y = Y, theta = theta, Ftheta = Ftheta)

# EXAMPLE CONDITIONAL WITH REFERENCE SAMPLE
Y <- c(10, 20, 30, 40, 50, 60, 70, 80, 90, 100)
X <- c(30, 35, 45)
theta <- 40
Ftheta <- 0.5
sample.id <- c("a", "b", "c")
SNS(X = X, X.id = sample.id, Y = Y, theta = theta, Ftheta = Ftheta)

# EXAMPLE UNCONDITIONAL WITH REFERENCE SAMPLE
Y <- c(10, 20, 30, 40, 50, 60, 70, 80, 90, 100)
X <- c(30, 35, 45)
theta <- NULL
Ftheta <- NULL
sample.id <- c("a", "b", "c")
SNS(X = X, X.id = sample.id, Y = Y, theta = theta, Ftheta = Ftheta)

# EXAMPLE CONDITIONAL WITHOUT REFERENCE SAMPLE
Y <- NULL # c(10,20,30,40,50,60,70,80,90,100)
X <- c(30, 35, 45)
theta <- 40
Ftheta <- 0.5
sample.id <- c("a", "b", "c")
SNS(X = X, X.id = sample.id, Y = Y, theta = theta, Ftheta = Ftheta)

# EXAMPLE UNCONDITIONAL WITHOUT REFERENCE SAMPLE
Y <- NULL
X <- c(30, 35, 45)
theta <- NULL
Ftheta <- NULL
sample.id <- c("a", "b", "c")
SNS(X = X, X.id = sample.id, Y = Y, theta = theta, Ftheta = Ftheta)

LuisBenavides/SNS documentation built on April 11, 2021, 3:50 p.m.