syrjala {ecespa} | R Documentation |
Syrjala's test for the difference between the spatial distributions of two populations
Description
Computes a two-sample Cramer-von Mises (and Kolmogorov-Smirnov) type test for a difference between the spatial distributions of two populations. It is designed to be sensitive to differences in the way the populations are distributed across the study area but insensitive to differences in abundance between the two populations.
Usage
syrjala0(coords, var1, var2, nsim, R=FALSE)
syrjala(coords = NULL, var1 = NULL, var2 = NULL, nperm = 999)
syrjala.test(ppp1, ppp2, nsim = 999)
## S3 method for class 'syrjala.test'
plot(x, coline=1, ...)
## S3 method for class 'ecespa.syrjala'
plot(x, ...)
Arguments
coords |
A |
var1 |
The first numeric variable |
var2 |
The second numeric variable. |
nperm |
Number of permutations. |
nsim |
Number of permutations. |
R |
Logical. Should be computed using R approach? |
ppp1 |
A marked point pattern, with the |
ppp2 |
A marked point pattern, with the |
x |
An object of class ' |
coline |
color for drawing the statistic's line in the plot. |
... |
Graphical parameters passed to |
Details
The null hypothesis of Syrjala's test is that across the study area, the normalized distributions of the two populations are the same (Syrjala, 1996). Population density data are collected at sampling locations on two populations.
Let
denote the coordinates of the
sampling location (
);
let
denote the sample density at the
sampling location of the
population.
To construct a test that is independent of the population sizes, the observed density data is first normalized:
where is the sum of
observations across the
sampling locations.
The value of the cumulative distribution function at the location
for the
population, denoted
,
is the sum of all normalized density observations,
, whose location
is such that
and
. The statistic proposed by Syrjala to test the null hypothesis is the square of the difference
between the cumulative distribution functions of the two populations, summed over all sampling locations,
that is
As is not invariant with respect to the 'corner' of the rectangle enclosing the study area that is chosen as the origin of the coordinate sytem,
is computed four times, one with each corner as the origin, and the average
is employed as the test statistic.
The level of significance of the observed
is determined from its position in the ordered set of test statistic values from all
pairwise
permutations (that is approximated from a large number of randomly selected permutations).
Value
Functions syrjala
or syrjala0
(with the argument R=FALSE
) return an object of class 'syrjala.test
'.
Functions syrjala.test
or syrjala0
(with the argument R=TRUE
) return an object of class 'ecespa.syrjala
'.
In Both cases, the result is a list with the following elements:
cvm.obs |
(class syrjala.test). The observed (averaged) |
cvm.sim |
(class syrjala.test). A numeric vector with the |
ks.obs |
(class syrjala.test). The observed (averaged) |
ks.sim |
(class syrjala.test). A numeric vector with the |
datanames |
(class syrjala.test). A character vector with the names of the two patterns, the spatial congruence of which is been analyzed. |
nperm |
(class syrjala.test). The number of permutations employed in the test (not counting the original data). |
psi.obs |
(class ecespa.syrjala).The observed (averaged) |
psi.sim |
(class ecespa.syrjala). A vector with the |
datanames |
(class ecespa.syrjala). A vector with the names of the two point patterns whose spatial congruence is been analyzed. |
nsim |
(class ecespa.syrjala). The number of permutations employed in the test. |
Both S3 plot methods plot an histogram with the distribution of the simulated 's statistics and draws the observed
as a vertical line.
Warning
The test requires both populations being sampled in exactly the same sampling locations.
Althoug this implementation employs ppp
's as the supporting data format, this kind of data are not spatial point patterns.
They cannot be analysed with the usual tools employed for marked point patterns.
Note
syrjala
or syrjala0
(with the argument R=FALSE
) implement a Fortran version of Syrjala's test. They run considerably faster
than the "whole-R" implementation of syrjala.test
or syrjala0
(with the argument R=TRUE
). This last implementation is supplied for illustrative purposes and to
maintain compability with previous versions of package ecespa
. One can use function haz.ppp
to easily build the ppp
objects from a data.frame
with only three columns (x-coordinate,
y-coordinate and abundance).
This function has been employed to compute Syrjala's test in Rey-Benayas et al. (2008).
Author(s)
Jose M. Blanco-Moreno jmblanco@ub.edu for the Fortran implementation of Syrjala's original QBasic function, Marcelino de la Cruz Rot for the R version, the wrapping functions and the documentation
References
Rey-Benayas, J.M., de la Montaña, E., Pérez-Camacho, L., de la Cruz, M., Moreno, D., Parejo, J.L. and Suárez-Seoane, S. 2010. Inter-annual dynamics and spatial congruence of a nocturnal bird assemblage inhabiting a Mediterranean agricultural mosaic. Ardeola,57(2): 303-320.
Syrjala, S. E. 1996. A statistical test for a difference between the spatial distributions of two populations. Ecology 77: 75-80. doi:10.2307/2265656.
Examples
data(syr1); data(syr2); data(syr3)
coords <- data.frame(x=syr1$x, y=syr1$y); var1<- syr1$marks; var2<- syr2$marks
(stest<-syrjala(coords, var1, var2, 9999))
plot(stest)
## Not run:
plot(syrjala.test(syr1, syr2, nsim=999))
plot(syrjala.test(syr1, syr3, nsim=999))
syrjala0(coords, var1, var2, 9999)
syrjala0(coords, var1, var2, 999, R=TRUE)
coords <- expand.grid(x=1:10,y=1:10)
var1 <- runif(100)
var2 <- runif(100)
syrjala(coords, var1, var2, 9999)
## End(Not run)