Learn R Programming

rasclass (version 0.1.0)

accuracyAssessment: Accuracy Assessment of the Classification

Description

This function calculates the standard accuracy assessment of a classified grid in a rasclass object.

Usage

accuracyAssessment(object)

Arguments

object
{A rasclass-class object}.

Value

  • A rasclass-class object, containing the newly calculated accuracy matrix and kappa-coefficient.

Details

The accuracy assessment includes the confusion matrix, the user and producer accuracies and the kappa coefficient. The confusion matrix is combined into one table accuracy matrix containing the user and producer accuracies. The combined table is stored in the accuracy slot of the rasclass-class object. The kappa coefficient is stored in the kappa slot.

References

Foody, G. M. (2002) Status of land cover classification accuracy assessment. Remote Sensing of Environment 80(1):185-201.

See Also

accuracyAssessment, buildFormula, checkRasclass, classifyMLC, classifyMlogit, rasclass-class, rasclassRaster-class, readRaster, readRasterFolder, setRasclassData, writeRaster

Examples

Run this code
# Load data from external folder
object <- readRasterFolder(path = "mypath", samplename = "mysample",
	filenames = c('myvar1.asc', 'myvar2.asc'))

# For this example, get data from a random data frame
mysample <- sample(c(NA, 1, 2, 3), 20000, rep = TRUE)
red <- sample(c(NA,1:255), 20000, rep = TRUE)
green <- sample(c(NA,1:255), 20000, rep = TRUE)
blue <- sample(c(NA,1:255), 20000, rep = TRUE)
newdata <- data.frame(mysample,red,green,blue)

# Prepare object using the dataframe and specifying raster properties
object <- new('rasclass')
object <- setRasclassData(newdata, object, ncols = 100, nrows = 200,
	xllcorner = 0, yllcorner = 0, cellsize = 10, NAvalue = -9999,
	samplename = 'mysample')

# Classify and compute accuracy
object <- classifyMlogit(object, anova = TRUE)
object <- accuracyAssessment(object)

# Summarize and plot results
summary(object)
image(object@predictedGrid)

Run the code above in your browser using DataLab