locperf(X, Y, which.stats = c("ph", "mhd", "med", "msd", "fom", "minsep"), alpha = 0.1, k = 4, distfun = "distmapfun", ...)
distob(X, Y, distfun = "distmapfun", ...)
distmapfun(x, ...)
solutionset
from package solutionset
from package solutionset
from package which.stat
method "fom".quantile function. Otherwise, k should be a whole number such that 1 =>
X
yielding, at each point x, the shortest distances from x to the set of events in the field. Default is distmapfun
, which returns the Euclidean ddistfun
function. In the case of distmapfun
, these are the optional arguments to distmap
from package locperf
returns a list object with components depending on which.stats
: one or more of the following, each of which is a single numeric.distob
returns a single numeric.distmapfun
returns a matrix of same dimension as the input argument's field.
First, it is helpful to establish some notation. Suppose a distance rho(x,y) is defined between any two pixels x and y in the entire raster of pixels/grid (If distfun is distmapfun (default), then rho is the Euclidean distance) that satisfies the formal mathematical axioms of a metric. Let d(x,A) denote the shortest distance (smallest value of rho) from the point x in the entire raster to the the set A contained in the raster. That is, d(x,A) = min(rho(x,a): a in A contained in the raster) [formally, the minimum should be the infimum], with d(x, empty set) defined to be infinity. Note that the distfun argument is a function that returns d(x,A) for all x in the raster.
The mean error distance ("med") is the mean of d(x,A) over the points in B. That is e.bar = mean( d(x,A)), over all x in B.
The mean square error distance ("msd") is the mean of the squared d(x,A) over the points in B. That is, e2.bar = mean( d(x,A)^2), over all x in B.
Pratt's figure of merit ("fom") is given by: FOM(A,B) = sum( 1/(1+alpha*d(x,A)^2))/max(N(A),N(B)), where x in B, and N(A) (N(B)) is the number of points in the set A (B) and alpha is a scaling constant (see, e.g., Pratt, 1977; Abdou and Pratt, 1979). The scaling constant is typically set to 1/9 when rho is normalized so that the smallest nonzero distance between pixel neighbors is 1. The default (0.1) here is approximately 1/9.
Minimum separation distance between boundaries ("minsep") is just the smallest value of the distance map of one field over the subset where events occur in the other. This is mainly for when single features within the fields are being compared.
distob is a modification of the mean error distance where if there are no events in either field, the value is 0, and if there are no events in one field only, the value is something large (in this case the length of the longest side of the grid).
The Hausdorff distance for a finite grid is given by max( max( d(x,B); x in A), max( d(x,A); x in B)), and can be written as max( abs(d(x,A) - d(x,B)), over all x in the raster). The partial Hausdorff distance ("ph") is a modification that replaces the maximum in the latter equation with a k-th order statistic (or quantile). The modified Hausdorff distance ("mhd") is given by mhd(A,B) = max( e.bar(A,B), e.bar(B,A)). See, e.g., Baddeley, 1992; Schwedler and Baldwin (2011).
For computational efficiency, the distance transform method is used via distmap
from package
Baddeley, A., 1992. An error metric for binary images. In Robust Computer Vision Algorithms, W. Forstner and S. Ruwiedel, Eds., Wichmann, 59--78.
Peli, T. and D. Malah, 1982: A study on edge detection algorithms. Computer Graphics and Image Processing, 20, 1--21.
Pratt, W. K., 1977: Digital Image Processing. John Wiley and Sons, New York.
Schwedler, B. R. J. and M. E. Baldwin, 2011. Diagnosing the sensitivity of binary image measures to bias, location, and event frequency within a forecast verification framework. Wea. Forecasting, 26, 1032--1044, doi: 10.1175/WAF-D-11-00032.1.
Zhu, M., V. Lakshmanan, P. Zhang, Y. Hong, K. Cheng, and S. Chen, 2011: Spatial verification using a true metric. Atmos. Res., 102, 408--419, doi:10.1016/j.atmosres.2011.09.004.
distmap
, solutionset
, im
, bounding.box
, as.rectangle
, metrV
, locmeasures2d
, locmeasures2dPrep
x <- y <- matrix( 0, 10, 12)
x[2,3] <- 1
y[4,7] <- 1
x <- im( x)
y <- im( y)
x <- solutionset( x > 0)
y <- solutionset( y > 0)
locperf( x, y)
par( mfrow=c(1,2))
image.plot( distmapfun(x))
image.plot( distmapfun(y))
Run the code above in your browser using DataLab