Detect if a single multivariate observation is beyond normal operating conditions.

faultDetect(threshold_object, observation, ...)

Arguments

threshold_object

An object of classes "threshold" and "pca" returned by the internal threshold() function.

observation

A single row of an xts data matrix (a 1 x p matrix) to compare against the thresholds

...

Lazy dots for additional internal arguments

Value

A named 1 x 4 matrix with the following entries for the single row observation passed to this function:

SPE --

the SPE statistic value

SPE_Flag --

the SPE fault indicator, where 1 represents a flag and 0 marks that the observation is within the normal operating conditions

T2 --

the T2 statistic value

T2_Flag --

the T2 fault indicator, defined the same as SPE_Flag

Details

This function takes in a threshold object returned by the threshold() function and a single observation as a matrix or xts row. Internally, the function multiplies the observation by the projection matrix returned within the threshold object, calculates the SPE and T2 process monitoring statistics for that observation, and compares these statistics against their corresponding threshold values to determine if the observation lies outside the expected boundaries. The function then returns a row vector of the SPE test statistic, a logical indicator marking if this statistic is beyond the threshold, the Hotelling's T2 statistic, and an indicator if this statistic is beyond the threshold. Observations with monitoring statistics beyond the calculated threshold are marked with a 1, while observations within normal operating conditions are marked with a 0. These threshold values are passed from the threshold() function through this function via a returned threshold object. This object will be used in higher function calls.

This internal function is called by faultFilter().

See also

Called by faultFilter and mspMonitor.

Examples

nrml <- mspProcessData(faults = "NOC")
scaledData <- scale(nrml[,-1])
pca_obj <- pca(scaledData)
thresh_obj <- threshold(pca_object = pca_obj)
#> Warning: In density.default(spe, bw = "SJ", kernel = "gaussian", from = 0, 
#>     old.coords = TRUE) :
#>  extra argument ‘old.coords’ will be disregarded
#> Warning: In density.default(t2, bw = "SJ", kernel = "gaussian", from = 0, 
#>     old.coords = TRUE) :
#>  extra argument ‘old.coords’ will be disregarded

faultDetect(threshold_object = thresh_obj,
            observation = scaledData[1,])
#>            SPE SPE_Flag        T2 T2_Flag
#> [1,] 0.2706896        0 0.2492299       0