Learn R Programming

spc4sts (version 0.2.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, trim.vars = TRUE, control, y = FALSE)

Arguments

img

the given stochastic textured surface image

nb

the size of the neighborhood. It must be a positive vector of length 1 or 3.

trim.vars

if TRUE, refit the model using only the variables that were used in the first fit.

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

trim.vars

the trim.vars argument

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, showNb, 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
## left-to-right bottom-to-rop, 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