syrjala            package:ecespa            R Documentation(latin1)

_S_y_r_j_a_l_a'_s _t_e_s_t _f_o_r _t_h_e _d_i_f_f_e_r_e_n_c_e _b_e_t_w_e_e_n _t_h_e _s_p_a_t_i_a_l _d_i_s_t_r_i_b_u_t_i_o_n_s _o_f _t_w_o _p_o_p_u_l_a_t_i_o_n_s

_D_e_s_c_r_i_p_t_i_o_n:

     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.

_U_s_a_g_e:

     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, ...)

_A_r_g_u_m_e_n_t_s:

  coords: A 'data.frame' with `$x` and `$y` components.

    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 'ppp' format of spatstat, 
          representing the values of some parameter measured on the
          corresponding sampling locations. 

    ppp2: A marked point pattern, with the 'ppp' format of spatstat, 
          representing the values of some other parameter measured on
          the same locations than 'ppp1'. 

       x: An object of class ''syrjala.test'' or  ''ecespa.syrjala''
          resulting from 'syrjala' or 'syrjala.test', respectively.

  coline: color for drawing the statistic's line in the plot.

     ...: Graphical parameters passed to 'hist'.

_D_e_t_a_i_l_s:

     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 K
     sampling locations on two populations.  Let (xk, yk) denote the
     coordinates of the kth sampling location ( k= 1,...,K );  let
     d.i(xk, yk) denote the sample density at the Kth sampling location
     of the ith population. To construct a test that is independent of
     the population sizes, the observed density data is first
     normalized:

                   gamma.i(xk, yk) = di(xk, yk)/Di,

     where Di is the sum  of d.i(xk, yk) observations  across the K
     sampling locations.  The value of the cumulative distribution
     function at the location (xk, yk)  for the ith population, denoted
     GAMMA.i(xk, yk), is the sum of all normalized density
     observations, gamma.i(xk, yk), whose location (x, y) is such that 
     x <= xk and y <= yk. 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 

           psi = sum{GAMMA.1(xk, yk) - GAMMA.2(xk, yk)}^2.

     As psi 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, psi  is computed  four times, one with each
     corner as the origin, and the average psi is employed as the test
     statistic. The level of significance of the observed psi is
     determined from its position  in the ordered set of test statistic
     values from all 2^K pairwise  permutations (that is approximated
     from a large number of randomly selected permutations).

_V_a_l_u_e:

     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) psi statistic
          for the CvM test.

 cvm.sim: (class syrjala.test). A numeric vector with the 'nperm+1'
          simulated psi's statistics (including 'cvm.obs').

  ks.obs: (class syrjala.test). The observed (averaged) psi statistic
          for the K-S test.

  ks.sim: (class syrjala.test). A numeric vector with the 'nperm+1'
          simulated psi's statistics (including 'ks.obs').

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 statistic.

psi.sim : (class ecespa.syrjala). A vector with the 'nsim' simulated
          psi's statistics.

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 psi's statistics and draws the observed psi as a
     vertical line.

_W_a_r_n_i_n_g:

     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.

_N_o_t_e:

     '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).

_A_u_t_h_o_r(_s):

     Jose M. Blanco-Moreno jmblanco@ub.edu for the Fortran
     implementation of Syrjala's original QBasic function, Marcelino de
     la Cruz Rot marcelino.delacruz@upm.es for the R version, the
     wrapping functions and the documentation

_R_e_f_e_r_e_n_c_e_s:

     Rey-Benayas, J.M., de la Montana, E., Perez-Camacho, L., de la
     Cruz, M., Moreno, D., Parejo, J.L. and Suarez-Seoane, S. 2008. 
     Inter-annual dynamics and spatial congruence of a nocturnal bird
     assemblage inhabiting a Mediterranean agricultural mosaic. 
     _Submitted_.

     Syrjala, S. E. 1996. A statistical test for a difference between
     the spatial distributions of two populations. _Ecology_ 77: 75-80.

_E_x_a_m_p_l_e_s:

     ## Not run: 
        
        data(syr1); data(syr2); data(syr3)
        
        plot(syrjala.test(syr1, syr2, nsim=999)) 
        
        plot(syrjala.test(syr1, syr3, nsim=999)) 
        
        
        coords <- data.frame(x=syr1$x, y=syr1$y); var1<- syr1$marks; var2<- syr2$marks
        
        syrjala(coords, var1, var2, 9999)
        
        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)

