envelope              package:spatstat              R Documentation

_S_i_m_u_l_a_t_i_o_n _e_n_v_e_l_o_p_e_s _o_f _s_u_m_m_a_r_y _f_u_n_c_t_i_o_n

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

     Computes simulation envelopes of a summary function.

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

       envelope(Y, fun=Kest, nsim=99, nrank=1, verbose=TRUE, ...,
       simulate=NULL, start=NULL, control=list(nrep=1e5, expand=1.5))

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

       Y: Either a point pattern (object of class '"ppp"') or a fitted
          point process model (object of class '"ppm"'). 

     fun: Function that computes the desired summary statistic for a
          point pattern.  

    nsim: Number of simulated point patterns to be generated when
          computing the envelopes. 

   nrank: Integer. Rank of the envelope value amongst the 'nsim'
          simulated values. A rank of 1 means that the minimum and
          maximum simulated values will be used. 

 verbose: Logical flag indicating whether to print progress reports
          during the simulations. 

     ...: Extra arguments passed to 'fun'. 

simulate: Optional. An expression. If this is present, then the
          simulated point patterns will be generated by evaluating this
          expression 'nsim' times. 

start,control: Optional. These specify the arguments 'start' and
          'control' of 'rmh', giving complete control over the
          simulation algorithm. 

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

     Simulation envelopes can be used to assess the goodness-of-fit of
     a point process model to point pattern data. See the References.

     This function first generates 'nsim' random point patterns in one
     of the following ways. 

        *  If 'Y' is a point pattern (an object of class '"ppp"') and
           'simulate=NULL', then this routine generates 'nsim'
           simulations of Complete Spatial Randomness (i.e. 'nsim'
           simulated point patterns each being a realisation of the
           uniform Poisson point process) with the same intensity as
           the pattern 'Y'.

        *  If 'Y' is a fitted point process model (an object of class
           '"ppm"') and 'simulate=NULL', then this routine generates
           'nsim' simulated realisations of that model.

        *  If 'simulate' is supplied, then it must be an expression. It
           will be evaluated 'nsim' times to yield 'nsim' point
           patterns.

     The summary statistic 'fun' is applied to each of these simulated
     patterns. Typically 'fun' is one of the functions 'Kest', 'Gest',
     'Fest', 'Jest', 'pcf', 'Kcross', 'Kdot', 'Gcross', 'Gdot',
     'Jcross', 'Jdot', 'Kmulti', 'Gmulti', 'Jmulti' or 'Kinhom'. It may
     also be a character string containing the name of one of these
     functions.

     The statistic 'fun' can also be a user-supplied function; if so,
     then it must have arguments 'X' and 'r' like those in the
     functions listed above, and it must return an object of class
     '"fv"'.

     Upper and lower pointwise envelopes are computed pointwise (i.e.
     for each value of the distance argument r), by sorting the 'nsim'
     simulated values, and taking the 'm'-th lowest and 'm'-th highest
     values, where 'm = nrank'. For example if 'nrank=1', the upper and
     lower envelopes are the pointwise maximum and minimum of the
     simulated values.

     The significance level of the associated Monte Carlo test is
     'alpha = 2 * nrank/(1 + nsim)'. 

     The return value is an object of class '"fv"' containing the
     summary function for the data point pattern and the upper and
     lower simulation envelopes. It can be plotted using 'plot.fv'.

     Arguments can be passed to the function 'fun' through '...'. This
     makes it possible to select the edge correction used to calculate
     the summary statistic. See the Examples.

     If 'Y' is a fitted point process model, and 'simulate=NULL', then
     the model is simulated by running the Metropolis-Hastings
     algorithm 'rmh'. Complete control over this algorithm is provided
     by the  arguments 'start' and 'control' which are passed to 'rmh'.

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

     An object of class '"fv"', see 'fv.object', which can be plotted
     directly using 'plot.fv'.

     Essentially a data frame containing columns 

       r: the vector of values of the argument r  at which the summary
          function 'fun' has been  estimated 

     obs: values of the summary function for the data point pattern 

      lo: lower envelope of simulations 

      hi: upper envelope of simulations 

_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:

     Cressie, N.A.C. _Statistics for spatial data_. John Wiley and
     Sons, 1991.

     Diggle, P.J. _Statistical analysis of spatial point patterns_.
     Arnold, 2003.

     Ripley, B.D. _Statistical inference for spatial processes_.
     Cambridge University Press, 1988.

     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:

     'fv.object', 'plot.fv', 'Kest', 'Gest', 'Fest', 'Jest', 'pcf',
     'ppp', 'ppm'

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

      X <- rpoispp(42)

      # Envelope of K function under CSR
      ## Not run: 
      plot(envelope(X))
      
     ## End(Not run)
      

      # Translation edge correction (this is also FASTER):
      ## Not run: 
      plot(envelope(X, correction="translate"))
      
     ## End(Not run)
      

      # Envelope of K function for simulations from model 
      data(cells)
      fit <- ppm(cells, ~1, Strauss(0.05))
      ## Not run: 
      plot(envelope(fit))
      
     ## End(Not run)
      

      # Envelope of G function under CSR
      ## Not run: 
      plot(envelope(X, Gest))
      
     ## End(Not run)
      

      # Use of `simulate'
      ## Not run: 
      plot(envelope(X, Gest, simulate=expression(runifpoint(42))))
      plot(envelope(X, Gest, simulate=expression(rMaternI(100,0.02))))
      
     ## End(Not run)
      

