Type: Package
Title: Multivariate Normal Mean Monitoring Through Critical-to-X Control Chart
Version: 0.2.0
Maintainer: Dr. Diana Barraza-Barraza <diana.barraza@ujed.mx>
Description: A comprehensive set of functions designed for multivariate mean monitoring using the Critical-to-X Control Chart. These functions enable the determination of optimal control limits based on a specified in-control Average Run Length (ARL), the calculation of out-of-control ARL for a given control limit, and post-signal analysis to identify the specific variable responsible for a detected shift in the mean. This suite of tools provides robust support for precise and effective process monitoring and analysis.
SystemRequirements: Intel MKL (optional for optimized BLAS/LAPACK performance)
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
Encoding: UTF-8
Imports: combinat, matrixcalc, stats, mvtnorm, expm, CompQuadForm
NeedsCompilation: no
Packaged: 2024-11-07 21:15:33 UTC; dianabza
Author: Dr. Burcu Aytaçoğlu [aut] (burcuaytacoglu@gmail.com), Dr. Diana Barraza-Barraza [aut, cre] (diana.barraza@ujed.mx), Dr. Víctor G. Tercero-Gómez [aut] (victor.tercero@tec.mx), Dr. A. Eduardo Cordero-Franco [aut] (lalo.cordero@gmail.com)
Repository: CRAN
Date/Publication: 2024-11-08 09:20:11 UTC

Contribution of variable z.var to C^2

Description

Returns contribution of variable z.var to C^2, even if there are no previous variables in the model

Usage

C2.Contribution(z, mean0, W, R, x.var, z.var = NULL)

Arguments

z

observation vector, kx1, where z[x.var, ] correspond to variables already in the model

mean0

Mean vector for multivariate random vector under the null hypothesis. Dimensions: kx1

W

matrix of variables weigths, kxk

R

correlation matrix, kxk

x.var

vector indicating variables already present in the model. length: k-1

z.var

scalar indicating variables to be included. Defaults to NULL, indicating there are no previous variables in the model

Value

C2.k.extra, scalar containing the contribution of variable z to C_k

Author(s)

Dr. Burcu Aytaçoğlu (burcuaytacoglu@gmail.com) Dr. Diana Barraza-Barraza (diana.barraza@ujed.mx), Dr. Víctor G. Tercero-Gómez (victor.tercero@tec.mx), Dr. A. Eduardo Cordero-Franco (lalo.cordero@gmail.com),

References

Paper

Examples

k<-3
sigma0 = matrix(diag(rep(1,k)),ncol = k)
mu0 = matrix(c(0,0,0), ncol = 1)
Weights = diag(c(0.5, 0.25,0.25))

library(mvtnorm)
set.seed(1000)
X = matrix(ncol= 1, data = rmvnorm(n = 1, mean = mu0, sigma = sigma0))
Z = (X - mu0)/sqrt(as.numeric(diag(sigma0)))
Corr<-get.R(Sigma0 = sigma0)

C2.Contribution(z = Z, W = Weights, R = Corr, x.var = 1:2, z.var = 3)


Conditional decision limit for z, given x already in model

Description

Calculates the conditional decision limit for z, given x already in model, using the exact distribution for the conditional contribution of z to C_k

Usage

C2.DecisionLimit(z, mu.C, R.C, A, x.var, alpha)

Arguments

z

observation vector, kx1, where z[x.var, ] correspond to variables already in the model

mu.C

scalar, conditional mean for z given x

R.C

scalar, conditional covariance for z given x

A

list containing matrix decomposition of A, preferably, obtained from function decomposeA

x.var

vector indicating variables already present in the model. length: k-1

alpha

confidence level for decision limit

Details

Proposition Distribution of a C^2 contribution from Paper Criticality Assessment for Enhanced Multivariate Process Monitoring

Value

conditionalCL, conditional decision limit for z's contribution to C_k

Author(s)

Dr. Burcu Aytaçoğlu (burcuaytacoglu@gmail.com) Dr. Diana Barraza-Barraza (diana.barraza@ujed.mx), Dr. Víctor G. Tercero-Gómez (victor.tercero@tec.mx), Dr. A. Eduardo Cordero-Franco (lalo.cordero@gmail.com),

References

Paper

Examples

k<-3
sigma0 = matrix(diag(rep(1,k)),ncol = k)
mu0 = matrix(c(0,0,0), ncol = 1)
Weights = diag(c(0.5, 0.25,0.25))

library(mvtnorm)
set.seed(1000)
X = matrix(ncol= 1, data = rmvnorm(n = 1, mean = mu0, sigma = sigma0))
Z = (X - mu0)/sqrt(as.numeric(diag(sigma0)))
Corr<-get.R(Sigma0 = sigma0)

A<-decomposeA(W = Weights, R = Corr, x.var = 1:2, z.var = 3)

Par<-zConditionalParameters(mean0 = mu0, R0 = Corr, z = Z, x.var = 1:2, z.var = 3)
C2.DecisionLimit(z = Z, mu.C = Par$muC, R.C = Par$RC, A = A, x.var = 1:2, alpha = 0.95)



Contribution to C^2 for all variables

Description

Returns a matrix with values for C^2_1 and C^2_k|C^2_k-1,C^2_k-2, ..., C^2_1, k=2,3, 4... for all possible permutations among k variables

Usage

C2.allPerms(z, W, R)

Arguments

z

observation vector, kx1

W

matrix of variables weigths, kxk

R

correlation matrix, kxk

Value

Data frame where, the first k columns correspond to variable that entred the model first, second... k-th. The following (k+1) to 2*k columns contain the conditional contribution of the variable. The last column contains the sum of all contributions, meaning C^2_k

Author(s)

Dr. Burcu Aytaçoğlu (burcuaytacoglu@gmail.com) Dr. Diana Barraza-Barraza (diana.barraza@ujed.mx), Dr. Víctor G. Tercero-Gómez (victor.tercero@tec.mx), Dr. A. Eduardo Cordero-Franco (lalo.cordero@gmail.com),

References

Paper

Examples

k<-3
sigma0 = matrix(diag(rep(1,k)),ncol = k)
mu0 = matrix(c(0,0,0), ncol = 1)
Weights = diag(c(0.5, 0.25,0.25))

library(mvtnorm)
set.seed(1000)
X = matrix(ncol= 1, data = rmvnorm(n = 1, mean = mu0, sigma = sigma0))
Z = (X - mu0)/sqrt(as.numeric(diag(sigma0)))
Corr<-get.R(Sigma0 = sigma0)

C2.allPerms(z = Z, W = Weights, R = Corr)


Distribution for C2, through simulation of its values

Description

Simulates s instances of C^2_k given 1 to k-1 variables are already in the model. Obtains the quantile indicated by alpha

Usage

SimulatedDistributionC2(z, R.C, mu.C, W, R, A, x.var, z.var, alpha, s)

Arguments

z

observation vector, kx1

R.C

scalar, conditional covariance for z given x

mu.C

scalar, conditional mean for z given x

W

matrix of variables weigths, kxk

R

correlation matrix, kxk

A

list containing matrix decomposition of A, preferably, obtained from function decomposeA

x.var

vector indicating variables already present in the model. length: k-1

z.var

scalar indicating variable to be included

alpha

quantile(s) of the distribution

s

scalar indicating amount of simulations

Value

Quantile(s) of the simulated distribution

Author(s)

Dr. Burcu Aytaçoğlu (burcuaytacoglu@gmail.com) Dr. Diana Barraza-Barraza (diana.barraza@ujed.mx), Dr. Víctor G. Tercero-Gómez (victor.tercero@tec.mx), Dr. A. Eduardo Cordero-Franco (lalo.cordero@gmail.com),

References

Paper

Examples

k<-3
sigma0 = matrix(diag(rep(1,k)),ncol = k)
mu0 = matrix(c(0,0,0), ncol = 1)
Weights = diag(c(0.5, 0.25,0.25))

library(mvtnorm)
set.seed(1000)
X = matrix(ncol= 1, data = rmvnorm(n = 1, mean = mu0, sigma = sigma0))
Z = (X - mu0)/sqrt(as.numeric(diag(sigma0)))
Corr<-get.R(Sigma0 = sigma0)

A<-decomposeA(W = Weights, R = Corr, x.var = 1:2, z.var = 3)

Par<-zConditionalParameters(mean0 = mu0, R0 = Corr, z = Z, x.var = 1:2, z.var = 3)
SimulatedDistributionC2(z = Z, R.C = Par$RC, mu.C = Par$muC, W = Weights, R = Corr,
                        A = A, x.var = 1:2, z.var = Z, alpha = 0.95, s = 1000 )

Calculation and decomposition of matrix A

Description

Decomposition of matrix A, required in Proposition 4.3. Decomoposition given by equation 41

Usage

decomposeA(W, R, x.var, z.var)

Arguments

W

diagonal matrix containing the corresponding weigth for each monitored variable. Dimensions kxk

R

correlation matrix for monitores variables, kxk

x.var

vector indicating variables already present in the model. length: k-1.

z.var

scalar indicating variables to be included.

Details

Note that length(z.var) + length(x.var) = k

Value

Returns decomposition of matrix A according to Equation 41 in paper.

Author(s)

Dr. Burcu Aytaçoğlu (burcuaytacoglu@gmail.com) Dr. Diana Barraza-Barraza (diana.barraza@ujed.mx), Dr. Víctor G. Tercero-Gómez (victor.tercero@tec.mx), Dr. A. Eduardo Cordero-Franco (lalo.cordero@gmail.com),

References

Paper

Examples

k<-6 # variables
B<-matrix(runif(n = k*k),ncol= k)### creating random matrix for sigma0
sigma0 <- B%*%t(B)
R<-get.R(sigma0)
Weights = diag(rep(1/k,k))
decomposeA(W = Weights, R = R, x.var = 1:5, z.var = 6)

Get Correlation matrix from a Covariance matrix

Description

Returns a correlation matrix from a variance-covariance matrix

Usage

get.R(Sigma0)

Arguments

Sigma0

variance-covariance matrix of dimensions kxk

Value

R

correlation matrix correspondig to Sigma0

Author(s)

Dr. Burcu Aytaçoğlu (burcuaytacoglu@gmail.com) Dr. Diana Barraza-Barraza (diana.barraza@ujed.mx), Dr. Víctor G. Tercero-Gómez (victor.tercero@tec.mx), Dr. A. Eduardo Cordero-Franco (lalo.cordero@gmail.com),

References

Paper

Examples

k<-6 # variables
B<-matrix(runif(n = k*k),ncol= k)### creating random matrix for sigma
sigma = B%*%t(B)
get.R(Sigma0=sigma)

Compute control limit of Weighted Chi-Squared control charts for monitoring multivariate normal mean.

Description

Computation of a control limit of the Weighted Chi-Squared control chart for a given vector of weights, w, correlation matrix, R, and the false alarm rate, alpha.

Usage

wChisq.CLim(w,R,alpha)

Arguments

w

vector of weigths, 1xk

R

correlation matrix, kxk

alpha

false alarm rate

Value

ContLim

control limit of the Weighted Chi-Squared control chart

Author(s)

Dr. Burcu Aytaçoğlu (burcuaytacoglu@gmail.com) Dr. Diana Barraza-Barraza (diana.barraza@ujed.mx), Dr. Víctor G. Tercero-Gómez (victor.tercero@tec.mx), Dr. A. Eduardo Cordero-Franco (lalo.cordero@gmail.com),

References

Paper

Examples

# Table 1 in the Paper Criticality Assessment for Enhanced Multivariate Process Monitoring.

w <- c(0.29836,0.70164)  #vector of weights
R <- diag(2)
alpha <- 0.005
wChisq.CLim(w,R,alpha)

w <- c(0.23912,0.76088)  #vector of weights
R <- diag(2)
R[1,2] <- R[2,1] <- 0.25
alpha <- 0.005
wChisq.CLim(w,R,alpha)


Compute ARLs of Weighted Chi-Squared control charts for monitoring multivariate normal mean.

Description

Computation of the Average Run Length (ARL) for a Weighted Chi-Squared control chart for a given mean vector, delta, correlation matrix, R, control limit, h, and the vector of weights, w. The mean vector, delta, is defined in Propositon 4.2 from Paper Criticality Assessment for Enhanced Multivariate Process Monitoring.

Usage

wChisq.arl(delta, R, h,  w)

Arguments

delta

Vector of values representing the change in the mean for each variable, 1xk

R

correlation matrix, kxk

h

Control limit of Weighted Chi-Squared Control chart

w

vector of weigths, 1xk

Value

arl

Average Run Length (ARL) for a Weighted Chi-Squared control chart for a given mean vector

Author(s)

Dr. Burcu Aytaçoğlu (burcuaytacoglu@gmail.com) Dr. Diana Barraza-Barraza (diana.barraza@ujed.mx), Dr. Víctor G. Tercero-Gómez (victor.tercero@tec.mx), Dr. A. Eduardo Cordero-Franco (lalo.cordero@gmail.com),

References

Paper

Examples

#Table 1 in the Paper Criticality Assessment for Enhanced Multivariate Process Monitoring.
delta <- c(0.5, 0.5)    # mean vector (change vector)
R <- diag(2)    	# correlation matrix
h <- 2.649506  	# Control limit
w <- c(0.50153, 0.49847)	# vector of weights
wChisq.arl(delta, R, h,  w)


Conditional parameters for z, given x

Description

This function calculates and returns conditional parameters for z, given x are being already considered in the model

Usage

zConditionalParameters(mean0, R0, z, x.var, z.var)

Arguments

mean0

Mean vector for multivariate random vector under the null hypothesis. Dimensions: kx1

R0

Correlations matrix for multivariate random vector under the null hypothesis. Dimensions kxk

z

vector of random observation. Dimensions kx1

x.var

Elements of z that are already considered in the model

z.var

element of z whose contribution to C_k|C_k-1,C_k-2,...,C_1 is going to be calculated

Value

A list containing

muC

conditional mean for z

RC

Conditional variance for z

Author(s)

Dr. Burcu Aytaçoğlu (burcuaytacoglu@gmail.com) Dr. Diana Barraza-Barraza (diana.barraza@ujed.mx), Dr. Víctor G. Tercero-Gómez (victor.tercero@tec.mx), Dr. A. Eduardo Cordero-Franco (lalo.cordero@gmail.com),

References

Paper

Examples

        k<-3
      sigma0 = matrix(diag(rep(1,k)),ncol = k)
      mu0 = matrix(c(0,0,0), ncol = 1)
      Weights = diag(c(0.5, 0.25,0.25))

      library(mvtnorm)
      set.seed(1000)
      X = matrix(ncol= 1, data = rmvnorm(n = 1, mean = mu0, sigma = sigma0))
      Z = (X - mu0)/sqrt(as.numeric(diag(sigma0)))
      Corr<-get.R(Sigma0 = sigma0)

      zConditionalParameters(mean0 = mu0, R0 = Corr, z = Z, x.var = 1:2, z.var = 3)