Learn R Programming

spc4sts (version 0.2.1)

bp: Box-Pierce-Type Statistic

Description

Compute the Box-Pierce-type (BP) statistic for pixels in a given image. bp2() cannot be used for pixels with the boundary problem, but is more efficient than bp() for other pixels.

Usage

bp(img, i1, i2, w, K = kerMat((w + 1)/2))
bp2(img, i1, i2, w , K = kerMat((w + 1)/2))

Arguments

img

the given image

i1

row index of the pixel to compute the BP statistic for.

i2

column index of the pixel to compute the BP statistic for.

w

the spatial moving window size.

K

the weighted matrix.

Value

The BP statistic.

Warning

For pixels with the boundary problem, bp() must be used.

References

Bui, A.T., and Apley., D.W. (2017) A Monitoring and Diagnostic Approach for Stochastic Textured Surfaces", Technometrics (in press).

See Also

kerMat, spaCov, sms, ad

Examples

Run this code
# NOT RUN {
img <- matrix(rnorm(100),10,10)

## for pixels with the boundary problem, e.g., Pixel (5,1),
# running bp2(img,5,1,3) will produce an error; instead, use bp() in this case:
bp(img,5,1,3)

## for pixels without the boundary problem, e.g., Pixel (5,5),
# both can be used, but bp2() is more efficient than bp()
bp2(img,5,5,3)
bp(img,5,5,3)
# }

Run the code above in your browser using DataLab