Skip to contents

It is good practice to report uncertainty (e.g., standard errors) alongside land-cover map accuracy estimates. Accordingly, mapac reports standard errors for overall accuracy, User’s and Producer’s accuracy, F1-scores, and Macro-F1 using design-based estimators. However, design-based standard errors cannot always be estimated from the available sample. In such cases, bootstrapping or error propagation may be alternatives.

Error propagation uses calculus to approximate the uncertainty of a combined result from the uncertainties of its inputs. This approach is relatively simple, but it assumes that the input estimates are uncorrelated—an assumption that is often violated for spatial map accuracy estimates. Ignoring such correlations can lead to uncertainty estimates that are either too small or too large, depending on the direction of the correlation. Nevertheless, when there is a lack of better alternatives, error propagation may still provide a useful approximation of uncertainty, as long as its limitations are kept in mind.

Basic formula

Let’s assume, we want to estimate the uncertainty of \(x\), which itself is a function of \(u\) and \(v\).

\[x= f(u,v,...)\]

Now, the variance of \(x\) (denoted as \(\sigma_x^2\)), can be approximated from the variance of \(u\) (\(\sigma_u^2\)) and \(v\) (\(\sigma_v^2\)) using partial derivatives:

\[\sigma_x^2 \simeq \sigma_u^2 \left(\frac{\partial x}{\partial u}\right)^2 + \sigma_v^2 \left(\frac{\partial x}{\partial v}\right)^2\]

Subtraction (and addition)

This example equally applies to addition. But let’s say we want to estimate the difference between two User’s accuracies, i.e., model #1 (\(u\)) and model #2 (\(v\)). In other words, we want to estimate the increase or decrease in User’s accuracy, denoted here as \(x\).

\[x = u - v\]

To estimate the standard error of \(x\), we need to calculate the partial derivatives, which are 1 and -1, respectively.

\[\sigma_x^2 \simeq \sigma_u^2 (1)^2 + \sigma_v^2 (-1)^2\]

which reduces to..

\[\sigma_x^2 \simeq \sigma_u^2 + \sigma_v^2\]

Because these formula apply to variances, we need to take the square root to convert them to standard errors \(\sigma\):

\[\sigma_x \simeq \sqrt{\sigma_u^2 + \sigma_v^2}\]

Division (and multiplication)

If \(x\) is the quotient of \(u\) and \(v\),

\[x = \frac{u}{v}\]

then the partial derivatives are as follows:

\[\sigma_x^2 \simeq \sigma_u^2 \left(\frac{1}{v}\right)^2 + \sigma_v^2 \left(\frac{-u}{v^2}\right)^2\]

we can summarize this and divide both sides by \(x^2= \left(\frac{u}{v}\right)^2\):

\[\frac{\sigma_x^2}{x^2} \simeq \frac{\sigma_u^2 \frac{1}{v^2}}{u^2/v^2} +\frac{\sigma_v^2 \frac{u^2}{{v^4}}}{u^2/v^2}\]

After canceling out terms, we get:

\[ \frac{\sigma_x^2}{x^2} \simeq \frac{\sigma_u^2}{u^2} +\frac{\sigma_v^2}{v^2} \]

again, taking the square root we obtain the general formula for multiplying and dividing standard errors. The big difference to the addition-subtraction example, is that it incorporates \(u\) and \(v\). Hence, we sum the relative variances for those parameters.

\[ \sigma_x \simeq \sqrt{x^2 \left(\frac{\sigma_u^2}{u^2} +\frac{\sigma_v^2}{v^2} \right)} \]

F1-score

A more complex example is the formula of the F-score:

\[ x = 2 \cdot \frac{u \cdot v }{u + v} \]

where \(x\) is the F-score and \(u\) and \(v\) are Users’s and Producer’s accuracy, respectively. As a reminder here the partial derivatives that we need to solve:

\[ \sigma_x^2 \simeq \sigma_u^2 \left(\frac{\partial x}{\partial u}\right)^2 + \sigma_v^2 \left(\frac{\partial x}{\partial v}\right)^2 \]

Let’s solve the partial derivatives in R. The D() function takes an expression object and the character name of the variable that we want to derive.

f <- expression(2 * u * v / (u + v))
pdu <- D(f, 'u')
pdu
#> 2 * v/(u + v) - 2 * u * v/(u + v)^2

pdv <- D(f, 'v')
pdv
#> 2 * u/(u + v) - 2 * u * v/(u + v)^2

which is:

\[ \sigma_x^2 \simeq \sigma_u^2 \left( \frac{2v^2}{(u+v)^2} \right)^2 + \sigma_v^2 \left(\frac{2u^2}{(u+v)^2} \right)^2 \]

and further simplified:

\[ \sigma_x = \sqrt{4 \cdot \frac{\sigma_u^2 v^4 + \sigma_v^2 u^4}{(u + v)^4}} \]

where \(\sigma_x\) is the standard error of the F-score, \(\sigma_u\) the standard error of the User’s accuracy, and \(\sigma_v\) the standard error of the Producer’s accuracy.

library(mapac)

exdata <- aa_examples("stehman2014")
strata <- exdata[["stratum"]]
ref <- exdata[["reference"]]
map <- exdata[["map"]]

result <-  aa_stratified(strata, ref, map, 
                         h=exdata[["h"]], 
                         N_h=exdata[["N_h"]])

result$stats
#>   class        ua     ua_se        pa     pa_se        f1     f1_se f1_se_ratio
#> 1     A 0.7419355 0.1645627 0.6571429 0.1477318 0.6969697 0.1282960   0.1282960
#> 2     B 0.5744681 0.1248023 0.7941176 0.1165671 0.6666667 0.1002029   0.1002029
#> 3     C 0.5000000 0.2151657 0.3000000 0.1504438 0.3750000 0.1613113   0.1613113
#> 4     D 0.7000000 0.1527525 0.6363636 0.1623242 0.6666667 0.1287357   0.1287357
#>   f1_se_propa f1_se_type
#> 1  0.11034620          1
#> 2  0.09354009          1
#> 3  0.13219833          1
#> 4  0.11284328          1

Let’s use the previous equation to calculate the F1 standard error. In this example, the design-based estimates (f1_se_ratio) are slightly higher than the estimates obtain via error propagation (f1_se_propa).

f1_uncertainty <- function(ua, ua_se, pa, pa_se) {
  sqrt( 4*(ua_se^2*pa^4+pa_se^2*ua^4) / (ua+pa)^4 )
}

f1_uncertainty(result$stats$ua, result$stats$ua_se, 
               result$stats$pa, result$stats$pa_se)
#> [1] 0.11034620 0.09354009 0.13219833 0.11284328

References

Drosg, M. (2009). Dealing with Uncertainties: A Guide to Error Analysis. 2nd ed. Edition. Springer. ISBN 978-3-642-01384-3

McRoberts, R.E. (2014). Post-classification approaches to estimating change in forest area using remotely sensed auxiliary data. Remote Sensing of Environment, 151, 149-156