metrV(x, ...)## S3 method for class 'default':
metrV(x, xhat, xhat2 = NULL, thresholds, lam1 = 0.5, lam2 = 0.5,
distfun = "distmapfun", a = NULL, verbose = FALSE, ...)
## S3 method for class 'SpatialVx':
metrV(x, time.point = 1, model = 1, lam1 = 0.5, lam2 = 0.5,
distfun = "distmapfun", verbose = FALSE, ...)
## S3 method for class 'metrV':
print(x, ...)
make.SpatialVx
or a matrix representing a verificaiton grid. For the print
method, this is an object returned by metrV
.xhat
is not NULL) matrix giving the thresholds to apply to the verification field (first column) and each forecast field.locperf
for more information).xhat2
in the call to metrV.default
).distfun
function.distOV
(simply the square root of sum of squared errors between two binary fields), and (if there are events in both fields) the mean error distance described in Peli and Malah (1982); see also Baddeley (1992). The metric can be computed between a forecast field, M1, and the verificaiton field, V, or it can be compared between two foreast models M1 and M2 with reference to V. That is,metrV(M1,M2) = lam1*distOV(I.M1,I.M2) + lam2*distDV(I.M1,I.M2),
where I.M1 (I.M2) is the binary field determined by M1 >= threshold (M2 >= threshold), distOV(I.M1,I.M2) = sqrt( sum( (I.M1 - I.M2)^2)), distDV(I.M1,I.M2) = abs(distob(I.V,I.M1) - distob(I.V,I.M2)), where distob(A,B) is the mean error distance between A and B, given by:
e(A,B) = 1/(N(A))*sqrt( sum( d(x,B)), where the summation is over all the points x corresponding to events in A, and d(x,B) is the minimum of the shortest distance from the point x to each point in B. e(A,B) is calculated by using the distance transform as calculated by the distmap
function from package spatstat
for computational efficiency.
Note that if there are no events in both fields, then by definition, the term distob(A,B) = 0, and if there are no events in one and only one of the two fields, then a large constant (here, the maximum dimension of the field), is returned. In this way, distob differs from the mean error distance described in Peli and Malah (1982).
If comparing between the verification field and one forecast model, then the distDV term simplifies to just distob(I.V,I.M1).
One final note is that Eq (6) that defines distOV
in Zhu et al. (2011) is correct (or rather, what is used in the paper). It is not, as is stated below Eq (6) in Zhu et al. (2011) the root *mean* square error, but rather the root square error. This function computes Eq (6) as written.
Peli, T. and Malah, D. (1982) A study on edge detection algorithms. Computer Graphics and Image Processing, 20, 1--21.
Zhu, M., Lakshmanan, V. Zhang, P. Hong, Y. Cheng, K. and Chen, S. (2011) Spatial verification using a true metric. Atmos. Res., 102, 408--419, doi:10.1016/j.atmosres.2011.09.004.
distob
, distmap
, im
, solutionset
, deltametric
, locmeasures2d
, make.SpatialVx
A <- B <- B2 <- matrix( 0, 10, 12)
A[2,3] <- 3
B[4,7] <- 400
B2[10,12] <- 17
hold <- make.SpatialVx(A, list(B,B2), thresholds=c(0.1,3.1,500),
field.type="contrived", units="none",
data.name=c("Example", "A", "B", "B2"))
metrV(hold)
metrV(hold, model=c(1,2))
data(pert000)
data(pert001)
data(ICPg240Locs)
testobj <- make.SpatialVx(pert000, pert001, thresholds=1e-8,
projection=TRUE, map=TRUE, loc=ICPg240Locs, loc.byrow = TRUE,
field.type="Precipitation", units="mm/h",
data.name=c("ICP Perturbed Cases", "pert000", "pert001"))
metrV(testobj)
# compare above to results in Fig. 3 (top right panel) of Zhu et al. (2011).
data(geom000)
data(geom001)
testobj <- make.SpatialVx(geom000, geom001, thresholds=0,
projection=TRUE, map=TRUE, loc=ICPg240Locs, loc.byrow = TRUE,
field.type="Precipitation", units="mm/h",
data.name=c("ICP Geometric Cases", "geom000", "geom001"))
metrV(testobj)
# compare above to results in Fig. 2 (top right panel)
# of Zhu et al. (2011). Note that they differ wildly.
# Perhaps because an actual elliptical area is taken in
# the paper instead of finding the values from the fields
# themselves?
Run the code above in your browser using DataLab