Identify Regions of Significant Differences
SigDiff computes the significance of the pairwise
differences relative to the mean and variance of all
differences between the two input datasets. This is useful
for identifying regions of significant difference between
two datasets (e.g., different DEMs (Januchowski et al.
2010) or different species distribution model predictions
(Bateman et al 2010)).
ImageDiff is a
wrapper to the image.asc command in adehabitat package that
uses the result from
SigDiff to create an image
mapping the regions of significant differences (positive
NOTE: it is assumed the input data are of the same extent and cellsize.
1 2 3
a vector or matrix of data; the matrix can be of can be a raster of class 'asc' (adehabitat package), 'RasterLayer' (raster package) or 'SpatialGridDataFrame' (sp package)
a vector or matrix of data with the same dimensions and class of 'x'
logical value defining if differences are respective to relative patterning (TRUE) or absolute values (FALSE)
a matrix of probability values (0 to 1)
likely created by
the significance levels to define significantly above and below. Default settings represent significance at the 0.05 level
a set of 3 colors for use in the image to represent significantly lower or greater, and not significant
other graphical parameters defined by image() or plot()
SigDiff returns a vector or matrix of the same
dimensions and class of the input representing the
significance of the pairwise difference relative to the
mean and variance of all differences between the two
ImageDiff returns nothing but
creates an image of the areas of significant differences
Stephanie Januchowski email@example.com
Januchowski, S., Pressey, B., Vanderwal, J. & Edwards, A.
(2010) Characterizing errors in topographic models and
estimating the financial costs of accuracy. International
Journal of Geographical Information Science, In Press.
Bateman, B.L., VanDerWal, J., Williams, S.E. & Johnson, C.N. (2010) Inclusion of biotic interactions in species distribution models improves predictions under climate change: the northern bettong Bettongia tropica, its food resources and a competitor. Journal of Biogeography, In Review.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#create some simple objects of class 'asc' tasc = as.asc(matrix(1:50,nr=50,nc=50)); print(tasc) #modify the asc objects so that they are slightly different tasc1 = tasc + runif(n = 2500, min = -1, max = 1) tasc2 = tasc + rnorm(n = 2500, mean = 1, sd = 1) #create graphical representation par(mfrow=c(2,2),mar=c(1,1,4,1)) image(tasc1,main='first grid',axes=FALSE) image(tasc2,main='second grid',axes=FALSE) #get significant difference by spatial patterning out = SigDiff(tasc1,tasc2) ImageDiff(out,main="Pattern Differences",axes=FALSE) #get significant difference out = SigDiff(tasc1,tasc2,pattern=FALSE) ImageDiff(out,main="Absolute Differences",axes=FALSE) legend('topleft',legend=c('-ve','ns','+ve'),title='significance', fill=terrain.colors(3),bg='white')