showNb: Show Neighborhood

View source: R/showNb.R

showNbR Documentation

Show Neighborhood

Description

Shows the neighborhood corresponding to the left-to-right then top-to-bottom raster scan order with additional information: variable names of the data frame returned by dataPrep, predictors used in the model returned by surfacemodel, or their percentage importance in the model (currently extracted from the rpart object). This function is useful for choosing a good neighborhood size and understanding relationship between pixels (e.g., periodicity).

Usage

showNb(model, what = c("neighborhood", "predictors", "importance"), plot.it = TRUE)

Arguments

model

either the object returned by surfacemodel or a positive vector of length 1 or 3 specifying the neighboorhood. If it is a vector, what <- "neighborhood".

what

what to show in the neighorhood. "neighborhood" shows variable names of the data frame returned by dataPrep, "predictors" shows predictors used in the model returned by surfacemodel, and "importance" shows their percentage importance in the model.

plot.it

if TRUE, plot the neighborhood.

Value

A matrix that contains the information for the plot (using the grid.table function).

Author(s)

Anh Bui

References

Bui, A.T. and Apley., D.W. (2018a) "A Monitoring and Diagnostic Approach for Stochastic Textured Surfaces", Technometrics, 60, 1-13.

See Also

dataPrep, surfacemodel

Examples

## show the neighorhood with variables names of the data frame constructed by dataPrep()
img <- matrix(1:25, 5, 5) # an image of size 5x5 pixels
img
dataPrep(img, 2)
showNb(c(2, 2, 2)) # showNb(2) has the same effect

## show the neighorhood with predictors and their importance used in the model returned
## by surfacemodel()
img <- sarGen(m = 100, n = 100, border = 50) # training image
model <- surfacemodel(img, nb = 3)
showNb(model, "predictors") # show predictors
showNb(model, "importance") # show predictor percentage importance

spc4sts documentation built on May 24, 2022, 5:07 p.m.