Learn R Programming

spc4sts (version 0.1.1)

surfacemodel: Statistical reprentations of stochastic textured surfaces using supervised learning.

Description

Provides a statistical represenation for a given stochastic textured surface image via a supervised learning model (a regression tree in this version).

Usage

surfacemodel(img, nb, control, y = FALSE)

Arguments

img

the given stochastic textured surface image

nb

the size of the neighborhood. It must be either a scalar or a vector of length 3.

control

control for rpart fits (see rpart.control). The default is rpart.control(minsplit=10, cp=0.00001, xval=10).

y

if set to TRUE, keeps a copy of the response in the output.

Value

A list of the following:

fit

the pruned rpart tree using cross-validation

R2cv

the cross-validated R-squared of fit

nb

the argument nb

Fr

the empirical cdf with exponential tail approximation of the model residuals

References

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

See Also

dataPrep, localStat, rpart

Examples

Run this code
# NOT RUN {
## fit a model to characterize the surface of a simulated image:
img <- sarGen(m = 100, n = 100, border = 50) # training image
model <- surfacemodel(img, nb = 1) # see Note above for how to select nb
model$R2cv

## change the raster scan order from left-to-right top-to-bottom to
## right-to-left top-to-bottom, and re-fit the model (see the Note section above):
img2  <- as.matrix(t(apply(img , 2, rev)))
model2 <- surfacemodel(img2, nb = 1)
model2$R2cv # expected to be smaller than model$R2cv

# }

Run the code above in your browser using DataLab