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
and negative).
NOTE: it is assumed the input
data are of the same extent and cellsize.
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)
y
a vector or matrix of data with the same
dimensions and class of 'x'
pattern
logical value defining if differences are
respective to relative patterning (TRUE) or absolute
values (FALSE)
tasc
a matrix of probability values (0 to 1)
likely created by SigDiff; The matrix can be a
raster of class 'asc' (adehabitat package), 'RasterLayer'
(raster package) or 'SpatialGridDataFrame' (sp package)
sig.levels
the significance levels to define
significantly above and below. Default settings represent
significance at the 0.05 level
tcol
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()
Value
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
inputs.
ImageDiff returns nothing but
creates an image of the areas of significant differences
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.
Examples
#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')
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(SDMTools)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/SDMTools/SigDiff.Rd_%03d_medium.png", width=480, height=480)
> ### Name: SigDiff
> ### Title: Identify Regions of Significant Differences
> ### Aliases: ImageDiff SigDiff
>
> ### ** Examples
>
> #create some simple objects of class 'asc'
> tasc = as.asc(matrix(1:50,nr=50,nc=50)); print(tasc)
Raster map of class "asc":
Cell size: 1
Number of rows: 50
Number of columns: 50
Type: numeric
> #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')
>
>
>
>
>
> dev.off()
null device
1
>