SNSchart Package

Luis Benavides

2021-04-05

Install the package SNSchart hosted in github.

install_github("LuisBenavides/SNSchart")

Load the package

library("SNSchart")

Using Sequential Normal Scores to Detect a Change in Location (Shewhart Scheme)

Example 3.1.1.

Get dataset from Example 8.2 by Qiu (2013) (see Example 3.1.1 from Conover, Tercero, and Cordero-Franco (2019))

X = SNSchart::example82$X
X.id = SNSchart::example82$X.id

Table with the dataset using dataframe of (first 10 rows).

X X.id
-0.623 1
-1.068 1
0.605 1
-0.002 1
-0.807 1
-0.105 2
-0.037 2
-0.595 2
1.222 2
-0.545 2

Get the sns of the dataset

s = SNSchart::SNS(X=X,X.id=X.id)

to plot it

plot(s)

CUSUM Variation to Detect a Change in Location

Example 3.2.1.

Get dataset from Example 8.4 by Qiu (2013) (see Example 3.2.1 from Conover, Tercero, and Cordero-Franco (2019))

X = SNSchart::example84$X
X.id = SNSchart::example84$X.id

Table with the dataset using dataframe of (first 10 rows).

X X.id
-0.393 1
-0.685 1
0.360 1
0.148 1
0.867 1
-0.552 2
-0.462 2
-0.979 2
-0.580 2
-0.008 2

Get the sns of the dataset using a CUSUM scheme

s = SNSchart::SNS(X=X,X.id=X.id, chart="CUSUM", chart.par=c(0.5, 4.389, 3)) 

to plot it

plot(s)

EWMA Variation to Detect a Change in Location

Example 3.3.1.

Load package and get dataset from Example 8.4 by Qiu (2013) (Example 3.2.1 from Conover, Tercero, and Cordero-Franco (2019))

X = SNSchart::example84$X
X.id = SNSchart::example84$X.id

Table with the dataset using dataframe of (first 10 rows).

X X.id
-0.393 1
-0.685 1
0.360 1
0.148 1
0.867 1
-0.552 2
-0.462 2
-0.979 2
-0.580 2
-0.008 2

Get the sns of the dataset using a EWMA scheme

s = SNSchart::SNS(X=X,X.id=X.id, chart="EWMA", chart.par=c(0.01, 2.0171))

to plot it

plot(s)

Sequential Normal Scores with a Reference Data Set (Phase 1)

Example 3.5.1.

Load package and get dataset from Example 8.7 by Qiu (2013) (Example 3.5.1 from Conover, Tercero, and Cordero-Franco (2019))

X = SNSchart::example87$X
X.id = SNSchart::example87$X.id
Y = SNSchart::example87$Y

Table with the dataset using dataframe of (first 10 rows).

X X.id Y
-0.034 1 -0.333
-0.103 2 -0.039
0.463 3 0.071
0.193 4 -0.303
0.723 5 -0.712
1.362 6 0.294
-0.366 7 -0.421
-0.610 8 -0.241
0.012 9 0.740
0.269 10 0.534

Get the sns of the dataset using a EWMA scheme

s = SNSchart::SNS(X=X,X.id=X.id, Y=Y, chart="EWMA", chart.par=c(0.01, 2.0171))

to plot it

plot(s)

Detecting a Change in Both Location and Scale (SNS Method)

Example 4.3.1

Load package and get dataset from Example 4.9 by Qiu (2013) (Example 4.3.1 from Conover, Tercero, and Cordero-Franco (2019))

X = example49$X2
X.id = example49$X.id
Y = example49$Y2

Table with the dataset using dataframe of (first 10 rows).

X1 X2 Y1 Y2 X.id
0.5993625 -0.7822084 0.0187462 -0.7618043 1
0.6654434 -0.4997350 -0.1842525 0.4193754 1
2.3679540 2.3102095 -1.3713305 -1.0399434 1
3.1377671 -1.7294545 -0.5991677 0.7115740 1
1.5058193 -1.7333567 0.2945451 -0.6332130 1
1.7863424 -4.6420341 0.3897943 0.5631747 2
0.0977881 1.2176603 -1.2080762 0.6609867 2
1.5328970 2.3000121 -0.3636760 -1.6580509 2
0.3541057 -2.3991953 -1.6266727 1.0281680 2
1.2909875 -3.1600015 -0.2564784 1.1279536 2

Get the SNS^2 of the dataset using a Shewhart scheme. In the example the reference sample is fixed therefore .

s = SNSchart::SNS(X=X,X.id=X.id, Y=Y, chart="Shewhart", scoring="Z-SQ",isFixed = TRUE)

to plot it. Only the plot of the monitoring sample is presented.

plot(s)

Multivariate Sequential Normal Scores to Detect a Change in Location

Example 6.1.1.

Get dataset from Example 9.1 by Qiu (2013) (see Example 6.1.1 from Conover, Tercero, and Cordero-Franco (2019)).

X = SNSchart::example91[,1:2]
X.id = SNSchart::example91$X.id

Table with the dataset using dataframe of (first 10 rows).

X1 X2 X.id
-0.692 -1.230 1
0.165 0.267 1
-0.153 -0.325 1
0.289 -1.325 1
0.140 0.211 1
0.188 -0.236 1
0.072 2.337 1
0.685 0.614 1
-1.245 -1.013 1
-0.153 0.189 1

Get the multivariate sequential normal scores

msns = SNSchart::MSNS(X, X.id)

and plot it

plot(msns)

Multivariate Sequential Normal Scores to Detect a Change in Location

Example 6.2.1.

Get dataset from Example 9.3 by Qiu (2013) (see Example 6.2.1 from Conover, Tercero, and Cordero-Franco (2019)).

X = SNSchart::example93[,1:2]
X.id = SNSchart::example93$X.id

Table with the dataset using dataframe of (first 10 rows).

X1 X2 X.id
-1.197 -1.060 1
-0.536 -0.447 1
1.302 1.826 1
-0.449 0.933 1
-2.569 -2.584 1
-0.805 -0.594 1
-0.584 -0.069 1
-1.635 -2.966 1
1.679 -1.278 1
-0.122 0.274 1

Get the multivariate sequential normal scores. Null distribution considered is the statistic.

msns = SNSchart::MSNS(X, X.id, null.dist = "F")

and plot it

plot(msns)

References

Conover, W. J., Victor G. Tercero, and Alvaro E. Cordero-Franco. 2019. “An Approach to Statistical Process Control That Is New, Nonparametric, Simple, and Powerful.” arXiv Preprint arXiv:1901.04443.
Qiu, Peihua. 2013. Introduction to Statistical Process Control. Chapman; Hall/CRC.