markcorr              package:spatstat              R Documentation

_M_a_r_k _C_o_r_r_e_l_a_t_i_o_n _F_u_n_c_t_i_o_n

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

     Estimate the marked correlation function of a marked point
     pattern.

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

     markcorr(X, f = function(m1,m2) { m1 * m2 }, r=NULL,
              slow=FALSE, correction=c("border", "isotropic", "Ripley", "translate"),
              method="density", ...)

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

       X: The observed point pattern. An object of class '"ppp"' or
          something acceptable to 'as.ppp'.  

       f: Function f used in the definition of the mark correlation
          function. 

       r: numeric vector. The values of the argument r at which the
          mark correlation function  rho_f(r) should be evaluated.
          There is a sensible default. 

correction: A character vector containing any selection of the options
          '"border"',  '"isotropic"', '"Ripley"' or '"translate"'. It
          specifies the edge correction(s) to be applied. 

  method: A character vector indicating the user's choice of density
          estimation technique to be used. Options are '"density"', 
          '"loess"', '"sm"' and '"smrep"'. 

    slow: Logical vector indicating whether to use exact analytic
          geometry to calculate  the edge correction weights for the
          translation correction in the case where the window of
          observation of 'X' is polygonal. These calculations are
          extremely slow and should be avoided unless you are a
          developer investigating the package. 

     ...: Arguments passed to the density estimation routine
          ('density', 'loess' or 'sm.density') selected by 'method'. 

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

     The mark correlation function rho_f(r) of a marked point process X
     is a measure of the dependence between the marks of two  points of
     the process a distance r apart. It is informally defined as

                  rho_f(r) = E[f(M1,M2)]/E[f(M,M')]

     where E[ ] denotes expectation and M1,M2 are the marks attached to
     two points of the process separated by a distance r, while M,M'
     are independent realisations of the marginal distribution of
     marks.

     Here f is any function f(m1,m2) with two arguments which are
     possible marks of the pattern, and which returns a nonnegative
     real value. Common choices of f are: for continuous real-valued
     marks,

                          f(m1,m2)= m1 * m2

     for discrete marks (multitype point patterns),

                         f(m1,m2)= (m1 == m2)

     and for marks taking values in [0,2 * pi),

                        f(m1,m2) = sin(m1-m2)

     .

     Note that rho_f(r) is not a ``correlation'' in the usual
     statistical sense. It can take any  nonnegative real value. The
     value 1 suggests ``lack of correlation'': if the marks attached to
     the points of 'X' are independent and identically distributed,
     then rho_f(r) =  1. The interpretation of values larger or smaller
     than 1 depends on the choice of function f.

     The argument 'X' must be a point pattern (object of class '"ppp"')
     or any data that are acceptable to 'as.ppp'. It must be a marked
     point pattern.

     The argument 'f' must be a function, accepting two arguments 'm1'
     and 'm2' which are vectors of equal length containing mark values
     (of the same type as the marks of 'X'). It must return a vector of
     numeric values of the same length as 'm1' and 'm2'. The values
     must be non-negative.

     The argument 'r' is the vector of values for the distance r at
     which rho_f(r) is estimated.

     This algorithm assumes that 'X' can be treated as a realisation of
     a stationary (spatially homogeneous)  random spatial point process
     in the plane, observed through a bounded window. The window (which
     is specified in 'X' as 'X$window') may have arbitrary shape.

     Biases due to edge effects are treated in the same manner as in
     'Kest'. The edge corrections implemented here are

     _b_o_r_d_e_r the border method or ``reduced sample'' estimator (see
          Ripley, 1988). This is the least efficient (statistically)
          and the fastest to compute. It can be computed for a window
          of arbitrary shape.

     _i_s_o_t_r_o_p_i_c/_R_i_p_l_e_y Ripley's isotropic correction (see Ripley, 1988;
          Ohser, 1983). This is currently implemented only for
          rectangular windows.

     _t_r_a_n_s_l_a_t_e Translation correction (Ohser, 1983). Implemented for
          all window geometries, but slow for complex windows. 

     Note that the estimator assumes the process is stationary
     (spatially homogeneous). 

     The numerator and denominator of the mark correlation function (in
     the expression above) are estimated using density estimation
     techniques. The user can choose between

     '"_d_e_n_s_i_t_y"' which uses the standard kernel density estimation
          routine 'density', and works only for evenly-spaced 'r'
          values;

     '"_l_o_e_s_s"' which uses the function 'loess' in the package 'modreg';

     '"_s_m"' which uses the function 'sm.density' in the package 'sm'
          and is extremely slow;

     '"_s_m_r_e_p"' which uses the function 'sm.density' in the package 'sm'
          and is relatively fast.

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

     An object of class '"fv"' (see 'fv.object').

     Essentially a data frame containing numeric columns  

       r: the values of the argument r  at which the mark correlation
          function rho_f(r) has been  estimated 

    theo: the theoretical value of rho_f(r) when the marks attached to
          different points are independent, namely 1 

     together with a column or columns named  '"border"',  '"iso"'
     and/or '"trans"', according to the selected edge corrections.
     These columns contain estimates of the function rho_f(r) obtained
     by the edge corrections named.

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

     Adrian Baddeley adrian@maths.uwa.edu.au <URL:
     http://www.maths.uwa.edu.au/~adrian/> and Rolf Turner
     rolf@math.unb.ca <URL: http://www.math.unb.ca/~rolf>

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

     Stoyan, D. and Stoyan, H. (1994) Fractals, random shapes and point
     fields: methods of geometrical statistics. John Wiley and Sons.

_S_e_e _A_l_s_o:

     'Kest', 'Kmulti'

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

         # CONTINUOUS-VALUED MARKS:
         # (1) Longleaf Pine data
         # marks represent tree diameter
         data(longleaf)
         # Subset of this large pattern
         swcorner <- owin(c(0,100),c(0,100))
         sub <- longleaf[ , swcorner]
         # mark correlation function
         mc <- markcorr(sub)
         plot(mc)

         # (2) simulated data with independent marks
         X <- rpoispp(100)
         X <- X %mark% runif(X$n)
         Xc <- markcorr(X)
         plot(Xc)
         
         # MULTITYPE DATA:
         # Hughes' amacrine data
         # Cells marked as 'on'/'off'
         data(amacrine)
         # (3) Kernel density estimate with Epanecnikov kernel
         # (as proposed by Stoyan & Stoyan)
         M <- markcorr(amacrine, function(m1,m2) {m1==m2},
                       correction="translate", method="density",
                       kernel="epanechnikov")
         plot(M)
         # Note: kernel="epanechnikov" comes from help(density)

         # (4) Same again with explicit control over bandwidth
         M <- markcorr(amacrine, function(m1,m2) {m1==m2},
                       correction="translate", method="density",
                       kernel="epanechnikov", bw=0.02)
         # see help(density) for correct interpretation of 'bw'

        

