Package 'dvqcc'

Title: Dynamic VAR - Based Control Charts for Batch Process Monitoring
Description: A set of control charts for batch processes based on the VAR model. The package contains the implementation of T2.var and W.var control charts based on VAR model coefficients using the couple vectors theory. In each time-instant the VAR coefficients are estimated from a historical in-control dataset and a decision rule is made for online classifying of a new batch data. Those charts allow efficient online monitoring since the very first time-instant. The offline version is available too. In order to evaluate the chart's performance, this package contains functions to generate batch data for offline and online monitoring.See in Danilo Marcondes Filho and Marcio Valk (2020) <doi:10.1016/j.ejor.2019.12.038>.
Authors: Márcio Valk [aut], Danilo Marcondes Filho [aut, cre], Gabriela Cybis [aut]
Maintainer: Danilo Marcondes Filho <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2024-11-27 06:43:17 UTC
Source: CRAN

Help Index


Offline monitoring

Description

Offline T2.var and W.var control charts for monitoring batch processes based on VAR model. This approach is fully described in "Marcondes Filho, D., & Valk, M. (2020). Dynamic VAR Model-Based Control Charts for Batch Process Monitoring. European Journal of Operational Research."

Usage

offlinem(
  data,
  size,
  newdata = NULL,
  confidence.level = 0.99,
  type = "T2.var",
  covvar = "empirical",
  plot = TRUE,
  var.estimates = FALSE
)

Arguments

data

dataframe of reference dataset. For each batch, variables are arranged in lines and columns are time-instants. The different batches are combined in a single dataset through rbind

size

number of variables

newdata

dataframe of one or more new batches for monitoring (each with same number of variables and time instants of data). Different batches are combined in a single dataset through rbind

confidence.level

H0 probability to be consider to define the quantile (default is 0.99)

type

"T2.var" for Hotelling chart (default) and "W.var" for Generalized Variance chart

covvar

"empirical" for sample covariance of coefficients (default) and "theoretical" for estimated theoretical covariance

plot

TRUE shows the charts plots (default TRUE)

var.estimates

TRUE show informations about the VAR modeling phase (default FALSE)

Details

#' The maximum number of variables is five.

All batches must have the same number of time-instants.

The dataset of batches in "data" are considered to be in control

Value

beyond.limits: returns the batches that the T2.var (or W.var) scores are above the control limit

LimT2 (or LimW): T2.var (or W.var) control limit

perc: perc_ref (and perc_new) returns the rate of reference batches (and new batches) above the control limit (perc_ref= g_ref/I and perc_new= g_new/Inew, where I (Inew) is the overall number of reference batches (new batches) and g_ref (g_new) is the number of reference batches (new batches) above the control limit)

arl: arl_ref (and arl_new) returns the mean number of reference batches (and new batches) before a signal is given by the charts (arl_ref=1/perc_ref and arl_new=1/perc_new)

varest: If var.estimates=TRUE, it returns the matrices (vec.phis and vec.phis.new) in which each row contains the estimated VAR(1) phis for each reference batches and new batches, respectively; the matrices (vec.cov.theoretical and vec.cov.empirical) with the theoretical and empirical estimated phis covariances from the reference batches, respectively; the lists (cov.B1 and cov.B1new) of the theoretical estimated phis covariances of the reference and new batches, respectively; the number (I) of reference batches; the number (Inew) of new batches; and the number (n) of time-instants

See Also

simoff

Examples

# Example 1: Monitoring considering two variables and Inew= 10 in control batches

   mydata=simoff()
   T2.var=offlinem(data=mydata$data,size=2)
   T2.var.new=offlinem(data=mydata$data,size=2,newdata=mydata$newdata)
   W.var=offlinem(data=mydata$data,size=2,type="W.var")
   W.var.new=offlinem(data=mydata$data,size=2,type="W.var",newdata=mydata$newdata)


# Example 2: Monitoring considering three variables and Inew=50 out of control batches

   B1=matrix(c(-0.3,0,0.4,0,0.2,0,0,-0.1,0.5),3,byrow=TRUE)
   B1new=matrix(c(0.7,0,0.4,0,0.5,0,0,-0.1,0.5),3,byrow=TRUE)
   mydata2=simoff(n=100,I=100,size=3,Inew=50,B1,varcov=diag(3),B1new)
   T2.var=offlinem(data=mydata2$data,size=3)
   T2.var.new=offlinem(data=mydata2$data,size=3,newdata=mydata2$newdata)
   W.var=offlinem(data=mydata2$data,size=3,type="W.var")
   W.var.new=offlinem(data=mydata2$data,size=3,type="W.var",newdata=mydata2$newdata)

Online monitoring

Description

Online T2.var and W.var control charts for monitoring batch processes based on VAR model. This approach is fully described in "Marcondes Filho, D., & Valk, M. (2020). Dynamic VAR Model-Based Control Charts for Batch Process Monitoring. European Journal of Operational Research."

Usage

onlinem(
  data,
  size,
  newdata,
  Lc = 50,
  Lr = 30,
  confidence.level = 0.99,
  type = "T2.var",
  covvar = "empirical",
  plot = TRUE,
  var.estimates = FALSE
)

Arguments

data

dataframe of reference dataset. For each batch, variables are arranged in lines and columns are time-instants. The different batches are combined in a single dataset through rbind

size

number of variables

newdata

dataframe of one or more new batches for monitoring (each with same number of variables and time instants of data). Different batches are combined in a single dataset through rbind

Lc

length of the coupled vector

Lr

length of random vector (Lr<Lc)

confidence.level

H0 probability to be consider to define the quantile (default is 0.99)

type

"T2.var" for Hotelling chart (default) and "W.var" for Generalized Variance chart

covvar

"empirical" for sample covariance of coefficients (default) and "theoretical" for estimated theoretical covariance

plot

TRUE shows the charts plots (default TRUE)

var.estimates

TRUE show informations about the VAR modeling phase and the elements for setting T2.var / W.var control charts (default FALSE)

Details

The maximum number of variables is five.

All batches must have the same number of time-instants.

This method is based on the use of "coupled vectors (cv)" (for more details, see Marcondes Filho, D., & Valk, M., 2020").

The parameters Lc and Lr define the cv structure.

Considering the new ongoing batch under monitoring:

Lc is the number of elements of cv. (Lc is smaller than the number of time-instants); Lr is the number of elements in cv randomly chosen from the in control batches in the reference dataset; Lc-Lr is the number of elements in cv from the last (Lc-Lr) observations of the new ongoing batch.

Default is Lc= 50 e Lr=30.

The batches in dataset "data" are considered to be in control

Value

beyond.limits: returns the time-instants of each batch that the T2.var (or W.var) score are above the control limit

arl: returns for each new batch the mean number of time-instants before a signal is given by the control chart (arl=n/g, where n is the overall number of time-instants and g is the number of time-instants above the control limit)

time.to.first.detection (TFD): returns for each new batch the first time-instant (the most recently instant) that can be considered as a possible signal of process change. TFD is the first point (t*) above the limit followed by two consecutive points above the control limit

artl: returns the cumulative rate of the overall time-instants (n) until the first three consecutive points are above the control limit. The artl is computed using the first of these three points, that is, artl=t*/n

varest: If var.estimates=TRUE, it returns the Lim_T2 vector (or Lim_W vector) of the T2.var (or W.var) control limits to each time-instant; the T2.var (or W.var) scores for each new batch to each time-instant [(tnew) matrix for the T2.var and (wnew) matrix for the W.var scores]; the number (I) of reference batches; the number (C=size*size) of estimated phis coefficients; the number (Inew) of new batches; the number (n) of time-instants and the (cov) list including the estimated mean covariance from the reference batches to each time-instant

#' @examples

# Example 1: Monitoring considering two variables and Inew=5 in control batches

mydata=simon()

T2.var.on=onlinem(data=mydata$data,size=2,newdata=mydata$newdata) W.var.on=onlinem(data=mydata$data,size=2,type="W.var",newdata=mydata$newdata)

# Example 2: Monitoring considering two variables and Inew=10 in control batches

B1=matrix(c(-0.3, 0.4, 0.4, 0.5), 2, byrow=TRUE) B1new=B1 mydata2=simon(n=100,I=200,size=2,Inew=10,n1=50,B1=B1,varcov=diag(2),B1new=B1new) T2.var.on=onlinem(data=mydata2$data,size=2,newdata=mydata2$newdata, plot=F) W.var.on=onlinem(data=mydata2$data,size=2,type="W.var",newdata=mydata2$newdata, plot=F)

# Example 3: Monitoring considering three variables and Inew=10 out of control batches

B1=matrix(c(-0.3,0,0.4,0,0.2,0,0,-0.1,0.5),3,byrow=TRUE) B1new=matrix(c(0.7,0,0.4,0,0.5,0,0,-0.1,0.5),3,byrow=TRUE) mydata3=simon(n=100,I=200,size=3,Inew=10,n1=50,B1=B1,varcov=diag(3),B1new=B1new) T2.var.on=onlinem(data=mydata3$data,size=3,newdata=mydata3$newdata, plot=F) W.var.on=onlinem(data=mydata3$data,size=3,type="W.var",newdata=mydata3$newdata, plot=F)

See Also

simon


simulating dataset (Offline settings)

Description

Function to simulate datasets based on the VAR(1) model (without intercept). The dataset include in control batches and new batches for offline monitoring

Usage

simoff(
  n = 100,
  I = 100,
  size = 2,
  Inew = 10,
  B1 = matrix(c(-0.3, 0.4, 0.4, 0.5), ncol = size, byrow = TRUE),
  varcov = diag(2),
  B1new = matrix(c(-0.3, 0.4, 0.4, 0.5), ncol = size, byrow = TRUE)
)

Arguments

n

number of time-instants

I

number of in control batch samples

size

number of variables

Inew

number of new batch samples for monitoring

B1

matrix (size x size) containing the VAR(1) coefficients of in control batches

varcov

covariance matrix (size x size) of errors

B1new

matrix (size x size) containing the VAR(1) coefficients of new batches

Value

data A dataframe of reference dataset of I in control batches. For each batch, variables are arranged in lines and columns are time-instants. The different batches are combined in a single dataset of dimension [(I * size) X n]

newdata A dataframe including a dataset of Inew new batches for monitoring (each with same number of variables and time-instants of data). The different batches are combined in a single dataset of dimension [(Inew * size) X n]

See Also

offlinem, simon, onlinem

Examples

# Example 1: Two variables (A default in control simulating dataset)


    mydata=simoff()


# Example 2: Three variables and Inew=50 out of control batches

    B1=matrix(c(-0.3,0,0.4,0,0.2,0,0,-0.1,0.5),3,byrow=TRUE)
    B1new=matrix(c(0.1,0,0.4,0,0.2,0,0,-0.1,0.5),3,byrow=TRUE)
    mydata1=simoff(n=100,I=100,size=3,Inew=50,B1,varcov=diag(3),B1new)


# Example 3: Three variables and Inew=1 new out of control batch

    B1=matrix(c(-0.3,0,0.4,0,0.2,0,0,-0.1,0.5),3,byrow=TRUE)
    B1new=matrix(c(0.1,0,0.4,0,0.2,0,0,-0.1,0.5),3,byrow=TRUE)
    mydata2=simoff(n=100,I=100,size=3,Inew=1,B1,varcov=diag(3),B1new)
    plot.ts(t(mydata2$data[1:3,]),main="One in control batch sample")
    plot.ts(t(mydata2$newdata),main="One new batch sample")

simulating dataset (Online settings)

Description

Function to simulate datasets based on the VAR(1) model (without intercept). The dataset include in control batches and new batches for online monitoring

Usage

simon(
  n = 100,
  I = 200,
  size = 2,
  Inew = 5,
  n1 = 50,
  B1 = matrix(c(-0.3, 0.4, 0.4, 0.5), ncol = size, byrow = TRUE),
  varcov = diag(2),
  B1new = matrix(c(-0.3, 0.4, 0.4, 0.5), ncol = size, byrow = TRUE)
)

Arguments

n

number of time-instants

I

number of in control batch samples

size

number of variables

Inew

number of new batch samples for monitoring

n1

number of time-instants for the new batches under the in control process

B1

matrix (size x size) containing the VAR(1) coefficients of in control batches

varcov

covariance matrix (size x size) of errors

B1new

matrix (size x size) containing the VAR(1) coefficients of new batches

Value

data A dataframe of reference dataset of I in control batches. For each batch, variables are arranged in lines and columns are time-instants. The different batches are combined in a single dataset of dimension [(I * size) X n]

newdata A dataframe including a dataset of Inew new batches for monitoring (each with same number of variables and time-instants of data). The different batches are combined in a single dataset of dimension [(Inew * size) X n]

See Also

onlinem, simoff, offlinem

Examples

# Example 1: Two variables (A default in control simulating dataset)

    mydata=simon()


# Example 2: Three variables and Inew=5 out of control batches

    B1=matrix(c(-0.3,0,0.4,0,0.2,0,0,-0.1,0.5),3,byrow=TRUE)
    B1new=matrix(c(0.1,0,0.4,0,0.2,0,0,-0.1,0.5),3,byrow=TRUE)
    mydata1=simon(n=100,I=200,size=3,Inew=5,n1=50,B1,varcov=diag(3),B1new)


# Example 3: Three variables and one Inew=1 out of control batch

    B1=matrix(c(-0.3,0,0.4,0,0.2,0,0,-0.1,0.5),3,byrow=TRUE)
    B1new=matrix(c(0.1,0,0.4,0,0.7,0,0,-0.1,0.5),3,byrow=TRUE)
    mydata2=simon(n=100,I=1,size=3,Inew=1,n1=25,B1,varcov=diag(3),B1new)
    plot.ts(t(mydata2$data),main="One in control batch sample")
    plot.ts(t(mydata2$newdata),main="One new batch sample")