faultFilter: Process Fault Filtering

View source: R/faultFilter.R

faultFilterR Documentation

Process Fault Filtering


Flag and filter out observations beyond normal operating conditions, then return the observations within normal operating conditions.


faultFilter(trainData, testData, updateFreq, faultsToTriggerAlarm = 5, ...)



An xts data matrix of initial training observations


The data not included in the training data set


The number of observations from the test data matrix that must be returned to update the training data matrix and move it forward.


Specifies how many sequential faults will cause an alarm to trigger. Defaults to 5.


Lazy dots for additional internal arguments


This function is essentially a wrapper function to call and organize the output from these other internal functions: faultDetect(), threshold(), and pca(). It is applied over a rolling window, with observation width equal to updateFreq, of the larger full data matrix via the processMonitor() function, wherein the testing and training data sets move forward in time across the entire data matrix.

This internal function is called by processMonitor().


A list of class "fault_ls" with the following:

faultObj –

An xts flagging matrix with the same number of rows as "testData". This flag matrix has the following five columns:


The SPE statistic value for each observation in "testData". This statistic is defined as

SPE_i = (\textbf{X}_i - \textbf{Y}_i * \textbf{P}^T) * (\textbf{X}_i - \textbf{Y}_i * \textbf{P}^T)^T,

where \textbf{X}_i is the i^{th} observation vector, \textbf{Y}_i is the reduced-feature projection of the observation \textbf{X}_i, and \textbf{P} is the projection matrix such that \textbf{X}_i\textbf{P} = \textbf{Y}_i.

SPE_Flag –

A vector of SPE indicators recording 0 if the test statistic is less than or equal to the critical value passed through from the threshold object.

T2 –

The T2 statistic value for each observation in "testData". This statistic is defined as

T^2_i = \textbf{Y}_i * \textbf{D}^{-1} * \textbf{Y}_i^T,

where \textbf{Y}_i = \textbf{X}_i\textbf{P} is the reduced- feature projection of the observation \textbf{X}_i, and \textbf{D} is the diagonal matrix of eigenvalues.

T2_Flag –

A vector of T2 fault indicators, defined like SPE_Flag.

Alarm –

A column indicating if there have been five flags in a row for either the SPE or T2 monitoring statistics or both. Alarm states are as follows: 0 = no alarm, 1 = Hotelling's T2 alarm, 2 = Squared Prediction Error alarm, and 3 = both alarms.

nonAlarmedTestObs –

An xts matrix of the first updateFreq number of rows of the training data which were not alarmed.

trainSpecs –

The threshold object returned by the internal threshold() function. See the threshold() function's help file for more details.

See Also

Calls: pca, threshold, faultDetect. Called by: processMonitor.


nrml <- mspProcessData(faults = "NOC")
# Select the data under state 1
data <- nrml[nrml[,1] == 1]

faultFilter(trainData = data[1:672, -1],
            testData = data[673:3360, -1],
            updateFreq = 336)

mvMonitoring documentation built on Nov. 22, 2023, 1:09 a.m.