olofsson {mapaccuracy}R Documentation

Thematic map accuracy and area.

Description

Implements the estimators described in Olofsson et al. (2013, 2014) for overall accuracy, producer's accuracy, user's accuracy, and area. Includes precision estimates.

Usage

olofsson(r, m, Nh, margins = TRUE)

Arguments

r

character vector. Reference class labels. The object will be coerced to factor.

m

character vector. Map class labels. The object will be coerced to factor.

Nh

numeric vector. Area, number of pixels, or proportion of the classes in the map. It must be named (see details).

margins

logical. If FALSE, the error matrix produced includes no margins (sum of the rows and columns).

Details

Argument Nh must be named to explicitly and clearly identify the class that each area refers to. The order of Nh will be used for displaying the results.

In the error matrix returned, the entries corresponding to no observed cases will present NA rather than 0. This is to emphasize the difference between the absence of cases and the presence of some (few) cases that represent a very small proportion of area (almost zero) and thus possibly rounded to zero. However, NA means zero proportion of area.

Value

A list with the estimates and error matrix.

OA

overall accuracy

UA

user's accuracy

PA

producer's accuracy

area

area proportion

SEoa

standard error of OA

SEua

standard error of UA

SEpa

standard error of PA

SEa

standard error of area proportion

matrix

confusion error (area proportion). Rows and columns represent map and reference class labels, respectively

Author(s)

Hugo Costa

References

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 Sens. Environ., 129, 122-131.

Olofsson, P.; Foody, G. M.; Herold, M.; Stehman, S. V.; Woodcock, C. E.; Wulder, M. A. (2014). Good practices for estimating area and assessing accuracy of land change. Remote Sens. Environ., 148, 42-57.

Examples

## Example 1 in Olofsson et al. (2013)
r<-c(rep("1",102),rep("2",280),rep("3",118))
m<-c(rep("1",97) ,rep("2",3), rep("3",2),rep("2",279),
              "3",rep("1",3),rep("2",18),rep("3",97))
Nh<-c(22353, 1122543, 610228)
names(Nh)<-c("1", "2", "3")
a<-olofsson(r, m, Nh)

# compare to paper:
a$area[1]                                       # eq. 9
a$area[1]*sum(Nh)                               # eq. 10
a$SEa[1]*sum(Nh)                                # eq. 12
a$area[1]*sum(Nh)-qnorm(0.975)*a$SEa[1]*sum(Nh) # 95% CI lower bound (note typo in the paper)
a$area[1]*sum(Nh)+qnorm(0.975)*a$SEa[1]*sum(Nh) # 95% CI upper bound
a$UA[1]                                         # eq. 14
a$PA[1]                                         # eq. 15
a$OA                                            # eq. 16
a$UA                                            # table 4
qnorm(0.975)*a$SEua                             # table 4
a$PA                                            # table 4
qnorm(0.975)*a$SEpa                             # table 4
a$matrix                                        # table 4


## Example 2 in Olofsson et al. (2013)
r<-c(rep("1", 129), rep("2", 403), rep("3", 611))
m<-c(rep("1", 127), "2", "2", rep("1", 66), rep("2", 322), rep("3", 15), rep("1", 54),
     rep("2", 17), rep("3", 540))
Nh<-c(0.007, 0.295, 0.698)
names(Nh)<-c("1", "2", "3")
b<-olofsson(r, m, Nh)

# compare to paper (table 6):
b$OA
qnorm(0.975)*b$SEoa
b$UA
qnorm(0.975)*b$SEua
b$PA
qnorm(0.975)*b$SEpa


## Example of table 8 in Olofsson et al. (2014)
r<-c(rep(1,69),rep(2,56),rep(3,175),rep(4,340))
m<-c(rep(1,66), 3, rep(4,2), rep(2,55), 4, rep(1,5), rep(2,8),
              rep(3,153),rep(4,9),rep(1,4),rep(2,12),rep(3,11),rep(4,313))
r[r==1] <- m[m==1] <- "Deforestation"
r[r==2] <- m[m==2] <- "Forest gain"
r[r==3] <- m[m==3] <- "Stable forest"
r[r==4] <- m[m==4] <- "Stable non-forest"
Nh<-c("Deforestation"=200000, "Forest gain"=150000,
      "Stable forest"=3200000, "Stable non-forest"=6450000) * 30^2 # Landsat pixel area = 30^2
e<-olofsson(r, m, Nh)

# compare to paper, left-hand of p. 54:
e$UA                            # User's accuracy
qnorm(0.975)*e$SEua             # 95% CI width
e$PA                            # Producer's accuracy
qnorm(0.975)*e$SEpa             # 95% CI width
e$OA                            # Overall accuracy
qnorm(0.975)*e$SEoa             # 95% CI width

# compare to paper, right-hand of p. 54:
e$area[1]*sum(Nh)/10000                 # deforestation in hectares
qnorm(0.975)*e$SEa[1]*sum(Nh)/10000     # 95% CI width in hectares
e$area[2]*sum(Nh)/10000                 # forest gain in hectares
qnorm(0.975)*e$SEa[2]*sum(Nh)/10000     # 95% CI width in hectares
e$area[3]*sum(Nh)/10000                 # stable forest in hectares
qnorm(0.975)*e$SEa[3]*sum(Nh)/10000     # 95% CI width in hectares
e$area[4]*sum(Nh)/10000                 # stable non-forest in hectares
qnorm(0.975)*e$SEa[4]*sum(Nh)/10000     # 95% CI width in hectares


# change class order
olofsson(r, m, Nh[c(4,2,1,3)])


# m (map) may include classes not found in r (reference)
r<-c(rep("1",102),rep("2",280),rep("3",118))
m<-c(rep("1",97) ,rep("2",3), rep("3",2),rep("2",279),
     "3",rep("1",3),rep("2",18),rep("3",95), rep("4",2))
Nh<-c("1"=22353, "2"=1122543, "3"=610228, "4"=10)
olofsson(r, m, Nh)

# r (reference) may include classes not found in m (map)
r<-c(rep("1",102),rep("2",280),rep("3",116),rep("4",2))
m<-c(rep("1",97) ,rep("2",3), rep("3",2),rep("2",279),
     "3",rep("1",3),rep("2",18),rep("3",97))
Nh<-c("1"=22353, "2"=1122543, "3"=610228)
olofsson(r, m, Nh)

# can add classes not found neither in r nor m
Nh<-c(Nh, "9"=0)
olofsson(r, m, Nh)

[Package mapaccuracy version 0.1.2 Index]