Compute the spatial exposure (segregation vs. mingling) features from a given multitype point pattern. Usage of shortcuts minglingF
, isarF
, shannonF
, simpsonF
etc. highly recommended.
segregationFun(X, fun = "isar", r = NULL, ntype = "geometric",
funpars = NULL, toroidal = FALSE, minusRange = TRUE,
included = NULL, dbg = FALSE, doDists = FALSE, prepRange = 0,
prepGraph = NULL, prepGraphIsTarget = FALSE, weightMatrix = NULL,
translate = FALSE, ...)
Multitype point pattern of class ppp
(see package 'spatstat')
Default "isar". Takes "isar","mingling","shannon", "simpson", "mci" and "biomass", see below.
Vector for the neighbourhood defining graph, e.g. "geometric" graph with different ranges. See below.
Default "geometric". Type of the neighbourhood graph. Accepts: "knn", "geometric", "delauney", "gabriel".
Default NULL. Parameter(s) for the measure. Mingling: c(i,j), where i= only for type i (0 for all), j=1 -> ratio version. ISAR: i, i=type (integer). Shannon: 0 or 1, see v2
in shannonF
. Simpson: none.
Default FALSE. If TRUE, use a toroidal correction in distance calculation. Works at the moment only for rectangular windows and "geometric" or "knn" graph.
If TRUE, adaptive minus-sampling is employed. Overrides included
-vector. If given as a positive number, included
-vector is created with points with distance atleast minusRange from the border.
boolean-vector of length |pp|. included[i]==TRUE => pp[i] included in calculations. Used for minus-sampling border correction.
Default FALSE. Print additional runtime texts.
Default TRUE. Precalculate distances for speed. Be aware of memory requirement n*(n-1)/2
Default 0. If >0, shrink the search space for neighbourhoods by searching only points within distance R i.e. precalculates a geometric graph.
Precalculated graph for the point pattern. If given, The prepRange
, dodists
and toroidal
are ignored and calculations are carried using the prepGraph as a starting point. Useful for huge datasets.
If TRUE, precalculated graph prepGraph
is used to calculate a single function value directly, all other neighbourhood parameters are ignored.
See isarF
for this.
Use translation correction (see e.g. documentation of spatstat::Kest
for details). Used only in mingling index.
ignored.
Returns an object of class fv
, see spatstat for more details. Basically a list with the computed values and parameter values.
This is the general function for computing the spatial exposure (segregation/mingling) features. Used by minglingF, shannonF, simpsonF, isarF, mciF and biomassF, which should be preferred for better (and nicer) outcome.
Possible neighbourhood relations include geometric, k-nearest neighbours, Delaunay, and Gabriel. Delaunay and Gabriel are parameter free, so given r
has no meaning. In geometric graph, r
is a vector of distances (sizes of the surrounding 'disc') and for k-nn r
is the vector of neighbourhood abundances (so r is k in k-nn) for each point to consider in the calculation of the spatial exposure measures. In general, the basic type of spatial summary in literature uses 'geometric' graph with several ranges.
For geometric
and knn
, the calculations are done by shrinking the graph given by the largest value of r
. If dealing with large datasets, it is advisable to give preprocessing range, prepRange
. The algorithm first calculates a geometric graph with parameter prepRange
, and uses this as basis for finding the needed neighbourhoods. Speeds up calculations, but make sure prepRange
is large enough e.g. in geometric
, prepRange
>max(r
). prepGraph
, if given, works as the preprocessed geometric graph (overrides prepRange), and can be computed using the package spatgraphs
; useful for huge datasets, where the dominating graph needs to be computed only one. The doDists
option speeds up calculations by precomputing the pairwise distances but requires approx. n*(n-1)/2 * 32 bytes of memory.
For border correction, use minusRange
for reduced border correction (for rectangular windows only). If using geometric
or knn
neighbourhoods, the option toroidal
for toroidal correction is also available. The vector included
can be given for more specific minus
-correction, only those points with TRUE (or 1) value are used in calculation. However, the neighbourhoods will include all points.