accuracy: Calculate statistics summarizing classification accuracy

Description Usage Arguments Details Value References Examples

Description

Calculates a contingency table and various statistics for use in image classification accuracy assessment and map comparison. Contingency table includes user's, producer's, and overall accuracies for an image classification, and quantity disagreement Q and allocation disagreement A. Q and A are calculated based on Pontius and Millones (2011). Standard errors for 95 percent confidence intervals for the user's, producer's and overall accuracies are calculated as in Foody and Stehman (2009) Table 21.3. To avoid bias due to the use of a sample contingency table, the contingency table will be converted to a population contingency table if the variable 'pop' is provided. For an accuracy assessment using testing data from a simple random sample, 'pop' does not need to be provided (see Details).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
accuracy(x, test_data, pop, class_col, reclass_mat)

## S4 method for signature 'train,ANY,ANY,missing'
accuracy(x, test_data, pop, class_col,
  reclass_mat)

## S4 method for signature 'RasterLayer,pixel_data,ANY,missing'
accuracy(x, test_data, pop,
  class_col, reclass_mat)

## S4 method for signature 'RasterLayer,SpatialPolygonsDataFrame,ANY,character'
accuracy(x,
  test_data, pop, class_col, reclass_mat)

Arguments

x

either a classification model with a predict method or a RasterLayer (see Details)

test_data

a link{pixel_data} object, SpatialPolygonsDataFrame, or NULL (see Details).

pop

A RasterLayer, numeric of length equal to the number of clasess, or NULL (see Details).

class_col

required if test_data is a SpatialPolygonsDataFrame. Defines the name of the column containing the observed cover class IDs

reclass_mat

a reclassification matrix to be used in the case of a model fit by classify with the do_split option selected

Details

x can be one of:

  1. A prediction model as output from one of the teamlucc classify functions. If x is a model, and testing data is included in the model, pop and test_data can both be missing, and accuracy will still run (though the output will in this case be biased unless the testing data is from a simple random sample). If x is a RasterLayer, then test_data must be supplied.

  2. A RasterLayer with a predicted map.

test_data can be one of:

  1. NULL. If test_data is NULL, accuracy will try to use testing data included in x. This will only work if x is a model of class train from the caret package, and if the model was run using the one of the teamlucc classify functions.

  2. A SpatialPolygonsDataFrame object, in which case accuracy will extract the predicted classes within each polygon from x. This will only work if x is a RasterLayer.

  3. A pixel_data object, in which case accuracy will use the included training_flag indicator to separate testing and training data.

pop can be one of:

  1. NULL, in which case the sample frequencies will be used as estimates of the population frequencies of each class.

  2. A list of length equal to the number of classes in the map giving the total number of pixels in the population for each class.

  3. A predicted cover map from as a RasterLayer, from which the class frequencies will be tabulated and used as the population frequencies.

Value

accuracy-class instance

References

Pontius, R. G., and M. Millones. 2011. Death to Kappa: birth of quantity disagreement and allocation disagreement for accuracy assessment. International Journal of Remote Sensing 32:4407-4429.

Olofsson, P., G. M. Foody, S. V. Stehman, and C. E. Woodcock. 2013. Making better use of accuracy data in land change studies: Estimating accuracy and area and quantifying uncertainty using stratified estimation. Remote Sensing of Environment 129:122-131.

Foody, G.M., Stehman, S.V., 2009. Accuracy Assessment, in: Warner, T.A., Nellis, M.D., Foody, G.M. (Eds.), The SAGE Handbook of Remote Sensing. SAGE.

Examples

1
2
3
4
5
6
7
## Not run: 
train_data <- get_pixels(L5TSR_1986, L5TSR_1986_2001_training, "class_1986", 
                         training=.6)
model <- train_classifier(train_data)
accuracy(L5TSR_1986_rfmodel)

## End(Not run)

azvoleff/teamlucc documentation built on May 11, 2019, 5:19 p.m.