# Numerical example in Stheman (2014)
s<-c(rep("A",10), rep("B",10), rep("C",10), rep("D",10))
m<-c(rep("A",7), rep("B",3), "A", rep("B",11), rep("C",6), "B", "B", rep("D",10))
r<-c(rep("A",5), "C", "B", "A", "B", "C", "A", rep("B",5), "A", "A", "B",
"B", rep("C",5), "D", "D", "B", "B", "A", rep("D",7), "C", "C", "B")
Nh_strata<-c(40000, 30000, 20000, 10000)
names(Nh_strata)<-c("A", "B", "C", "D")
e<-stehman2014(s, r, m, Nh_strata)
e$area[1] # Proportion of area of class A (compare with paper in p. 4932)
e$area[3] # Proportion of area of class C (p. 4932)
e$OA # Overall accuracy (p. 4932)
e$UA[2] # User's accuracy of class B (compare with paper in p. 4934)
e$PA[2] # Producer's accuracy of class B (p. 4934)
e$matrix[2,3] # Cell (2, 3) of the error matrix (p. 4935)
e$SEa[1] # Standard error (SE) for proportion of area of class A (p. 4935)
e$SEa[3] # Standard error (SE) for proportion of area of class C (p. 4935)
e$SEoa # SE for overall accuracy (p. 4936)
e$SEua[2] # SE for user's accuracy of class B (p. 4936)
e$SEpa[2] # SE for producer's accuracy of class B (p. 4936)
# change class order
stehman2014(s, r, m, Nh_strata, order=c("D","C","B","A"))
# the number (and name) of strata and map classes may differ
s<-c(rep("a",5), rep("aa",5), rep("b",10), rep("c",10), rep("d",10))
Nh_strata<-c("a"=20000, "aa"=20000, "b"=30000, "c"=20000, "d"=10000)
stehman2014(s, r, m, Nh_strata)
# m (map) may include classes not found in r (reference)
m<-c(rep("A",7), rep("B",3), "A", rep("B",11), rep("C",6), "B", "B", rep("D",9), "XX")
stehman2014(s, r, m, Nh_strata)
# r (reference) may include classes not found in m (map)
m<-c(rep("A",7), rep("B",3), "A", rep("B",11), rep("C",6), "B", "B", rep("D",10))
r<-c(rep("A",5), "C", "B", "A", "B", "C", "A", rep("B",5), "A", "A", "B",
"B", rep("C",5), "D", "D", "B", "B", "A", rep("D",7), "C", "C", "YY")
stehman2014(s, r, m, Nh_strata)
# can add classes not found neither in r nor m
stehman2014(s, r, m, Nh_strata, order=c("A","B","C","D","YY","ZZ"))
Run the code above in your browser using DataLab