Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

clusterfield

Field of clusters


Description

Calculate the superposition of cluster kernels at the location of a point pattern.

Usage

clusterfield(model, locations = NULL, ...)

  ## S3 method for class 'character'
clusterfield(model, locations = NULL, ...)

  ## S3 method for class 'function'
clusterfield(model, locations = NULL, ..., mu = NULL)

  ## S3 method for class 'kppm'
clusterfield(model, locations = NULL, ...)

Arguments

model

Cluster model. Either a fitted cluster model (object of class "kppm"), a character string specifying the type of cluster model, or a function defining the cluster kernel. See Details.

locations

A point pattern giving the locations of the kernels. Defaults to the centroid of the observation window for the "kppm" method and to the center of a unit square otherwise.

...

Additional arguments passed to density.ppp or the cluster kernel. See Details.

mu

Mean number of offspring per cluster. A single number or a pixel image.

Details

The actual calculations are preformed by density.ppp and ... arguments are passed thereto for control over the pixel resolution etc. (These arguments are then passed on to pixellate.ppp and as.mask.)

For the function method the given kernel function should accept vectors of x and y coordinates as its first two arguments. Any additional arguments may be passed through the ....

The function method also accepts the optional parameter mu (defaulting to 1) specifying the mean number of points per cluster (as a numeric) or the inhomogeneous reference cluster intensity (as an "im" object or a function(x,y)). The interpretation of mu is as explained in the simulation functions referenced in the See Also section below.

For the character method model must be one of: model="Thomas" for the Thomas process, model="MatClust" for the Matern cluster process, model="Cauchy" for the Neyman-Scott cluster process with Cauchy kernel, or model="VarGamma" for the Neyman-Scott cluster process with Variance Gamma kernel. For all these models the parameter scale is required and passed through ... as well as the parameter nu when model="VarGamma". This method calls clusterfield.function so the parameter mu may also be passed through ... and will be interpreted as explained above.

The kppm method extracts the relevant information from the fitted model (including mu) and calls clusterfield.function.

Value

A pixel image (object of class "im").

Author(s)

and Ege Rubak rubak@math.aau.dk .

See Also

Simulation algorithms for cluster models: rCauchy rMatClust rThomas rVarGamma

Examples

# method for fitted model
  fit <- kppm(redwood~1, "Thomas")
  clusterfield(fit, eps = 0.01)

  # method for functions
  kernel <- function(x,y,scal) { 
      r <- sqrt(x^2 + y^2)
      ifelse(r > 0,
             dgamma(r, shape=5, scale=scal)/(2 * pi * r),
             0)               
  }
  X <- runifpoint(10)
  clusterfield(kernel, X, scal=0.05)

spatstat.core

Core Functionality of the 'spatstat' Family

v2.1-2
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Kasper Klitgaard Berthelsen [ctb], Achmad Choiruddin [ctb], Jean-Francois Coeurjolly [ctb], Ottmar Cronie [ctb], Tilman Davies [ctb], Julian Gilbey [ctb], Yongtao Guan [ctb], Ute Hahn [ctb], Kassel Hingee [ctb], Abdollah Jalilian [ctb], Marie-Colette van Lieshout [ctb], Greg McSwiggan [ctb], Tuomas Rajala [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Plenge Waagepetersen [ctb], Hangsheng Wang [ctb]
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.