Title: | EWMA-p control charts with correction of measurement error |
---|---|
Description: | The package EATME, refered to EWMA with Adjustments To Measuremeant Error, aims to address measurement error effects when constructing EWMA-p control charts. The method primarily focuses on binary random variables, but it can be applied to any continuous random variables by using sign statistic to transform them to discrete ones. With the correction of measurement error effects, we can obtain the corrected control limits of EWMA-p control chart and reasonably adjusted EWMA-p control charts. |
Authors: | Cheng-Kuan Lin, Li-Pang Chen, Su-Fen Yang |
Maintainer: | Cheng-Kuan Lin <[email protected]> |
License: | GPL-3 |
Version: | 0.1.0 |
Built: | 2025-03-12 03:47:20 UTC |
Source: | https://github.com/kuan-cheng-da/eatme |
Convert continuous random variables in in-control process into discrete random variables with M statistic, where M statistic is the total number of samples satisfying at time
,
where
is the observation for the
sampling period and the
sample in the in-control data,
is the number of the sample size and
is the number of the sampling periods.
is the population mean of continuous in-control data. If
is unknown, it can be estimated by
.
cont_to_disc_M(ICdata, OCdata, mu.p = mean(ICdata))
cont_to_disc_M(ICdata, OCdata, mu.p = mean(ICdata))
ICdata |
The in-control data. |
OCdata |
The out-of-control data. |
mu.p |
Mean of the random variable in the in-control data. |
M0
The M statistic for in-control data.
M1
The M statistic for out-of-control data.
p0
The process proportion for in-control data.
p1
The process proportion for out-of-control data.
n
The number of the sample size.
Yang, S. F., Lin, J. S., & Cheng, S. W. (2011). A new nonparametric EWMA sign control chart. Expert Systems with Applications, 38(5), 6239-6243.
Yang, S. F. & Arnold, B. C. (2014). A simple approach for monitoring business service time variation.The Scientific World Journal, 2014:16.
Yang, S. F. (2016). An improved distribution-free EWMA mean chart. Communications in Statistics-Simulation and Computation, 45(4), 1410-1427.
IC = matrix(rnorm(100,0,1),ncol = 10,byrow = TRUE) OC = matrix(rnorm(100,2,1),ncol = 10,byrow = TRUE) cont_to_disc_M(IC,OC)
IC = matrix(rnorm(100,0,1),ncol = 10,byrow = TRUE) OC = matrix(rnorm(100,2,1),ncol = 10,byrow = TRUE) cont_to_disc_M(IC,OC)
Convert continuous random variables in in-control process to discrete data with V statistic, where V statistic is the total number of sample satisfying at time
,
where
is the observation for the
sampling period and the
sample in the in-control data,
is the number of the sample size and
is the number of the sampling periods.
is population variance of continuous in-control data. If
is unknown, it can be estimated by
and
.
cont_to_disc_V(ICdata, OCdata, var.p = NULL)
cont_to_disc_V(ICdata, OCdata, var.p = NULL)
ICdata |
The in-control data. |
OCdata |
The out-of-control data. |
var.p |
Variance of the random variables in the in-control data. |
V0
The V statistic for in-control data.
V1
The V statistic for out-of-control data.
p0
The process proportion for in-control data.
p1
The process proportion for out-of-control data.
n
The number of the sample size.
Yang, S. F. & Arnold, B. C. (2014). A simple approach for monitoring business service time variation.The Scientific World Journal, 2014:16.
Yang, S. F., & Arnold, B. C. (2016). A new approach for monitoring process variance. Journal of Statistical Computation and Simulation, 86(14), 2749-2765.
IC = matrix(rnorm(100,0,1),ncol = 10,byrow = TRUE) OC = matrix(rnorm(100,0,2),ncol = 10,byrow = TRUE) cont_to_disc_V(IC,OC)
IC = matrix(rnorm(100,0,1),ncol = 10,byrow = TRUE) OC = matrix(rnorm(100,0,2),ncol = 10,byrow = TRUE) cont_to_disc_V(IC,OC)
A conventional exponential weighted moving average (EWMA) charting statistic evaluated by the data.
ewma(data, lambda, EWMA0)
ewma(data, lambda, EWMA0)
data |
An one-dimensional random variable. |
lambda |
An EWMA smooth constant, which is a scalar in [0,1]. |
EWMA0 |
A starting point of EWMA charting statistic. |
A vector of EWMA charting statistics of data
at different t times.
x = rnorm(20,0,1) ewma(x,0.05,0)
x = rnorm(20,0,1) ewma(x,0.05,0)
This function displays one-sided lower EWMA-p chart control charts based on in-control and out-of-control data that are number of defectives. In the presence of measurement error, this function is able to provide suitable charts with corrections of measurement error effects.
EWMA_p_chart_one_LCL( ICdata, OCdata, lambda, n, pi1 = 1, pi2 = pi1, ARL0 = 200, M = 500, error = 10 )
EWMA_p_chart_one_LCL( ICdata, OCdata, lambda, n, pi1 = 1, pi2 = pi1, ARL0 = 200, M = 500, error = 10 )
ICdata |
The in-control data for attributes. |
OCdata |
The out-of-control data for attributes. |
lambda |
An EWMA smooth constant, which is a scalar in [0,1]. |
n |
A sample size in the data. |
pi1 |
The proportion that the observed defectives are the same as unobserved ones. |
pi2 |
The proportion that the observed non-defectives are the same as unobserved ones. |
ARL0 |
A prespecified average run length (ARL) of a control chart in the in-control process. |
M |
The number of simulation times for the Monte Carlo method |
error |
The tolerant for the absolute difference between an iterated ARL value and prespecified |
The first chart is an EWMA-p chart obtained by the in-control data, and the second chart is an EWMA-p chart based in the out-of-control data. In two figures, horizontal solid line represents lower control limit (LCL), black solid dots are detections of in-control data, and red solid dots are detections of out-of-control data.
Chen, L.-P. & Yang, S.-F. (2022). A new p-chart with measurement error correction. arXiv: 2203.03384.
library(qcr) data = orangejuice IC = data[1:30,1] OC = data[31:54,1] EWMA_p_chart_one_LCL(IC,OC,0.05,50,1,1)
library(qcr) data = orangejuice IC = data[1:30,1] OC = data[31:54,1] EWMA_p_chart_one_LCL(IC,OC,0.05,50,1,1)
This function displays one-sided upper EWMA-p chart control charts based on in-control and out-of-control data that are number of defectives. In the presence of measurement error, this function is able to provide suitable charts with corrections of measurement error effects.
EWMA_p_chart_one_UCL( ICdata, OCdata, lambda, n, pi1 = 1, pi2 = pi1, ARL0 = 200, M = 500, error = 10 )
EWMA_p_chart_one_UCL( ICdata, OCdata, lambda, n, pi1 = 1, pi2 = pi1, ARL0 = 200, M = 500, error = 10 )
ICdata |
The in-control data for attributes. |
OCdata |
The out-of-control data for attributes. |
lambda |
An EWMA smooth constant, which is a scalar in [0,1]. |
n |
A sample size in the data. |
pi1 |
The proportion that the observed defectives are the same as unobserved ones. |
pi2 |
The proportion that the observed non-defectives are the same as unobserved ones. |
ARL0 |
A prespecified average run length (ARL) of a control chart in the in-control process. |
M |
The number of simulation times for the Monte Carlo method |
error |
The tolerant for the absolute difference between an iterated ARL value and prespecified |
The first chart is an EWMA-p chart obtained by the in-control data, and the second chart is an EWMA-p chart based in the out-of-control data. In two figures, horizontal solid line represents upper control limit (UCL), black solid dots are detections of in-control data, and red solid dots are detections of out-of-control data.
Chen, L.-P. & Yang, S.-F. (2022). A new p-chart with measurement error correction. arXiv: 2203.03384.
library(qcr) data = orangejuice IC = data[31:54,1] OC = data[1:30,1] EWMA_p_chart_one_UCL(IC,OC,0.05,50,1,1)
library(qcr) data = orangejuice IC = data[31:54,1] OC = data[1:30,1] EWMA_p_chart_one_UCL(IC,OC,0.05,50,1,1)
This function displays two-sided EWMA-p chart control charts based on in-control and out-of-control data that are number of defectives. In the presence of measurement error, this function is able to provide suitable charts with corrections of measurement error effects.
EWMA_p_chart_two( ICdata, OCdata, lambda, n, pi1 = 1, pi2 = pi1, ARL0 = 200, M = 500, error = 10 )
EWMA_p_chart_two( ICdata, OCdata, lambda, n, pi1 = 1, pi2 = pi1, ARL0 = 200, M = 500, error = 10 )
ICdata |
The in-control data for attributes. |
OCdata |
The out-of-control data for attributes. |
lambda |
An EWMA smooth constant, which is a scalar in [0,1]. |
n |
A sample size in the data. |
pi1 |
The proportion that the observed defectives are the same as unobserved ones. |
pi2 |
The proportion that the observed non-defectives are the same as unobserved ones. |
ARL0 |
A prespecified average run length (ARL) of a control chart in the in-control process. |
M |
The number of simulation times for the Monte Carlo method |
error |
The tolerant for the absolute difference between an iterated ARL value and prespecified |
The first chart is an EWMA-p chart obtained by the in-control data, and the second chart is an EWMA-p chart based in the out-of-control data. In two figures, horizontal solid lines represents upper control limit (UCL) and lower control limit (LCL), black solid dots are detections of in-control data, and red solid dots are detections of out-of-control data.
Chen, L.-P. & Yang, S.-F. (2022). A new p-chart with measurement error correction. arXiv: 2203.03384.
library(qcr) data = orangejuice IC = data[31:54,1] OC = data[1:30,1] EWMA_p_chart_two(IC,OC,0.05,50,1,1)
library(qcr) data = orangejuice IC = data[31:54,1] OC = data[1:30,1] EWMA_p_chart_two(IC,OC,0.05,50,1,1)
This function is used to calculate the one-sided lower control limit for EWMA-p charts with the correction of measurement error effects.
If two truly classified probabilities pi1
and pi2
are given by 1, then the corresponding control limit is free of measurement error.
EWMA_p_one_LCL( p, lambda, n, pi1 = 1, pi2 = pi1, ARL0 = 200, M = 500, error = 10 )
EWMA_p_one_LCL( p, lambda, n, pi1 = 1, pi2 = pi1, ARL0 = 200, M = 500, error = 10 )
p |
The proportion of defectives in the in-control process. |
lambda |
An EWMA smooth constant, which is a scalar in [0,1]. |
n |
A sample size in the data. |
pi1 |
The proportion that the observed defectives are the same as unobserved ones. |
pi2 |
The proportion that the observed non-defectives are the same as unobserved ones. |
ARL0 |
A prespecified average run length (ARL) of a control chart in the in-control process. |
M |
The number of simulation times for the Monte Carlo method |
error |
The tolerant for the absolute different between an itevated ARL calue and prespecified |
L2
The coefficient of the lower control limit.
hat_ARL0
The estimated in-control average run length based on given
L2
.
hat_MRL0
The estimated in-control median of run length based on given
L2
.
hat_SDRL0
The estimated in-control standard deviation of run length based on given
L2
.
LCL
The limiting value of the lower control limit with
L2
.
EWMA_p_one_LCL(0.2,0.05,5,1,1)
EWMA_p_one_LCL(0.2,0.05,5,1,1)
This function is used to calculate the one-sided upper control limit for EWMA-p charts with the correction of measurement error effects.
If two truly classified probabilities pi1
and pi2
are given by 1, then the corresponding control limit is free of measurement error.
EWMA_p_one_UCL( p, lambda, n, pi1 = 1, pi2 = pi1, ARL0 = 200, M = 500, error = 10 )
EWMA_p_one_UCL( p, lambda, n, pi1 = 1, pi2 = pi1, ARL0 = 200, M = 500, error = 10 )
p |
The proportion of defectives in the in-control process. |
lambda |
An EWMA smooth constant, which is a scalar in [0,1]. |
n |
A sample size in the data. |
pi1 |
The proportion that the observed defectives are the same as unobserved ones. |
pi2 |
The proportion that the observed non-defectives are the same as unobserved ones. |
ARL0 |
A prespecified average run length (ARL) of a control chart in the in-control process. |
M |
The number of simulation times for the Monte Carlo method |
error |
The tolerant for the absolute different between an itevated ARL calue and prespecified |
L1
The coefficient of the upper control limit.
hat_ARL0
The estimated in-control average run length based on given
L1
.
hat_MRL0
The estimated in-control median of run length based on given
L1
.
hat_SDRL0
The estimated in-control standard deviation of run length based on given
L1
.
UCL
The limiting value of the upper control limit with
L1
.
EWMA_p_one_UCL(0.2,0.05,5,1,1)
EWMA_p_one_UCL(0.2,0.05,5,1,1)
This function is used to calculate the two-sided control limit for EWMA-p charts with the correction of measurement error effects.
If two truly classified probabilities pi1
and pi2
are given by 1, then the corresponding control limit is free of measurement error.
EWMA_p_two(p, lambda, n, pi1 = 1, pi2 = pi1, ARL0 = 200, M = 500, error = 10)
EWMA_p_two(p, lambda, n, pi1 = 1, pi2 = pi1, ARL0 = 200, M = 500, error = 10)
p |
The proportion of defectives in the in-control process. |
lambda |
An EWMA smooth constant, which is a scalar in [0,1]. |
n |
A sample size in the data. |
pi1 |
The proportion that the observed defectives are the same as unobserved ones. |
pi2 |
The proportion that the observed non-defectives are the same as unobserved ones. |
ARL0 |
A prespecified average run length (ARL) of a control chart in the in-control process. |
M |
The number of simulation times for the Monte Carlo method |
error |
The tolerant for the absolute different between an itevated ARL calue and prespecified |
L1
The coefficient of the upper control limit.
L2
The coefficient of the lower control limit.
hat_ARL0
The estimated in-control average run length based on given
L1
and L2
.
hat_MRL0
The estimated in-control median of run length based on given
L1
and L2
.
hat_SDRL0
The estimated in-control standard deviation of run length based on given
L1
and L2
.
UCL
The limiting value of the upper control limit with
L1
.
LCL
The limiting value of the lower control limit with
L2
.
EWMA_p_two(0.2,0.05,5,1,1)
EWMA_p_two(0.2,0.05,5,1,1)
Generate the discrete random variable with measurement error.
ME_data_generate(p, n, m, pi1, pi2 = pi1)
ME_data_generate(p, n, m, pi1, pi2 = pi1)
p |
A probability of the unobserved defectives. |
n |
A number of sample size in the data. |
m |
A number of observation in the data. |
pi1 |
The proportion that the observed defectives are the same as unobserved ones. |
pi2 |
The proportion that the observed non-defectives are the same as unobserved ones. |
real_data
The generated data without measurement error.
obs_data
The generated data with measurement error.
n
A sample size in the generated data.
ME_data_generate(0.7,50,50,0.95)
ME_data_generate(0.7,50,50,0.95)