Skip to contents

Stratified estimation of map accuracy and area after Card (1982). The stratified estimator accounts for disproportional allocation of samples within the strata.

Usage

aa_card(
  x,
  m = NULL,
  w = NULL,
  h = NULL,
  area = NULL,
  olofsson = TRUE,
  se_precision = 1e-09
)

Arguments

x

Reference vector or confusion matrix if m is NULL

m

Map vector or NULL if x is a confusion matrix

w

Stratum weights. Named vector or specify h. If NULL, proportional sampling is assumed.

h

Stratum names associated with stratum weights w. Alternatively, stratum names can be coded in w.

area

total area (optional)

olofsson

(default=TRUE) uses Olofsson formula instead of Card to estimate standard errors of reference class proportions and OA.

se_precision

(default=1e-9) precision threshold for standard errors. Negative standard errors below that threshold are set to zero.

Value

A list of map accuracy and area proportion estimates and associated standard errors:

  • cm: adjusted confusion matrix in counts

  • cmp: adjusted confusion matrix in area proportion (sums to 1)

  • stats: A data frame with one row per class and these columns:

    • class: class label.

    • ua, ua_se: User's accuracy and its standard error.

    • pa, pa_se: Producer's accuracy and its standard error.

    • p_i, p_i_se: Estimated reference-class proportion and its standard error.

    • w: Sampling-stratum weight for the map class.

    • f1: F1 score, estimated as the stratified ratio 2 * TP / (map-class total + reference-class total).

    • f1_se: Selected F1 standard error. Uses f1_se_ratio when available; otherwise falls back to f1_se_propa.

    • f1_se_ratio: F1 standard error from direct ratio linearization, . accounting for within-stratum covariance between numerator and denominator.

    • f1_se_propa: F1 standard error propagated from ua_se and pa_se using aa_f1(), which assumes UA and PA are independent.

    • f1_se_type: Flag declaring whether f1_se was constructed from f1_se_ratio (1), f1_se_propa (2), or is NA (0).

  • macroF1: A named numeric vector:

    • macroF1: Macro-F1 estimate.

    • macroF1_se_ratio: Stratified linearization standard error, including covariance between class-specific F1 estimates.

    • macroF1_se_approx: Approximate standard error that borrows variance from other strata when a stratum has one sample.

    • macroF1_se_propa: Propagated standard error that assumes class-specific F1 estimates are independent.

  • accuracy: Overall accuracy and its standard error

  • area: estimated area proportion and standard errors for each class

Details

Map agreement

References

Card, D.H. (1982). Using Known Map Category Marginal Frequencies to Improve Estimates of Thematic Map Accuracy. Photogrammetric Engineering and Remote Sensing, 48, 431-439

Olofsson, P., Foody, G.M., Stehman, S.V., & Woodcock, C.E. (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

Author

Dirk Pflugmacher

Examples

ex <- aa_examples("olofsson")
result <- aa_card(ex$reference, m = ex$map, w = ex$w, h = ex$h)

# or provide a confusion matrix
cm <- aa_confusion_matrix(ex$reference, ex$map)
result <- aa_card(cm, w = ex$w)
result
#> $cm
#>                reference
#> map             deforestation forest nonforest
#>   deforestation            97      0         3
#>   forest                    3    279        18
#>   nonforest                 2      1        97
#> 
#> $cmp
#>                reference
#> map             deforestation      forest    nonforest
#>   deforestation   0.012353777 0.000000000 0.0003820756
#>   forest          0.006395805 0.594809820 0.0383748271
#>   nonforest       0.006953674 0.003476837 0.3372531855
#> 
#> $stats
#>                       class   ua        pa        p_i      p_i_se      ua_se
#> deforestation deforestation 0.97 0.4806308 0.02570326 0.006125724 0.01705872
#> forest               forest 0.93 0.9941887 0.59828666 0.010057434 0.01473092
#> nonforest         nonforest 0.97 0.8969259 0.37601009 0.010617971 0.01705872
#>                     pa_se          w        f1       f1_se f1_se_ratio
#> deforestation 0.114122636 0.01273585 0.6427713 0.102657971 0.102657971
#> forest        0.005749319 0.63958045 0.9610237 0.008368316 0.008368316
#> nonforest     0.020988018 0.34768370 0.9320328 0.014333262 0.014333262
#>               f1_se_propa f1_se_type
#> deforestation 0.102123036          1
#> forest        0.008311087          1
#> nonforest     0.013799136          1
#> 
#> $macroF1
#>           macroF1  macroF1_se_ratio macroF1_se_approx  macroF1_se_propa 
#>        0.84527593        0.03726064        0.03726064        0.03446190 
#> 
#> $accuracy
#> [1] 0.9444168 0.0111644
#> 
#> $area
#>           class proportion proportion_ci
#> 1 deforestation 0.02570326    0.01200620
#> 2        forest 0.59828666    0.01971221
#> 3     nonforest 0.37601009    0.02081084
#> 
#> $adjusted
#> [1] TRUE
#>