spatstat (version 1.9-4)

alltypes: Calculate Statistic for All Types in a Multitype Point Pattern

Description

Given a marked point pattern, this computes the estimates of a selected summary function ($F$,$G$, $J$ or $K$) of the pattern, for all possible combinations of marks. It returns these functions in a list (an object of class "fasp") amenable to plotting by plot.fasp().

Usage

alltypes(pp, fun="K",dataname=NULL,verb=FALSE)

Arguments

pp
The observed point pattern, for which summary function estimates are required. An object of class "ppp". If the pattern is not marked, the resulting ``array'' has dimensions $1 \times 1$.
fun
Character string indicating the summary function required. Options are "F", "G", "J", "K", "Gcross", "Jcross", "Kcross", "Gdot",
dataname
Character string giving an optional (alternative) name to the point pattern, different from what is given in the call. This name, if supplied, may be used by plot.fasp() in forming the title
verb
Logical value, meaning ``verbose''. If verb is true then terse ``progress reports'' (just the values of the mark indices) are printed out when the calculations for that combination of marks are completed.

Value

  • A function array (an object of class "fasp", see fasp.object). This can be plotted using plot.fasp.

    If fun="F", the function array has dimensions $m \times 1$ where $m$ is the number of different marks in the point pattern. The entry at position [i,1] in this array is the result of applying Fest to the points of type i only.

    If fun is "Gdot", "Jdot" or "Kdot", the function array again has dimensions $m \times 1$. The entry at position [i,1] in this array is the result of Gdot(pp, i) or Jdot(pp, i) or Kdot(pp, i) respectively.

    If fun is "Gcross", "Jcross" or "Kcross", (or their abbreviations "G", "J" or "K"), the function array has dimensions $m \times m$. The [i,j] entry of the function array (for $i \neq j$) is the result of applying the function Gcross, Jcross or Kcross to the pair of types (i,j). The diagonal [i,i] entry of the function array is the result of applying the univariate function Gest, Jest or Kest to the points of type i only. Each function entry fns[[i]] retains the format of the output of the relevant estimating routine Fest, Gest, Jest, Kest, Gcross, Jcross, Kcross, Gdot, Jdot, or Kdot.

    The default formulae for plotting these functions are cbind(km,theo) ~ r for F, G, and J functions, and cbind(trans,theo) ~ r for K functions.

Details

This routine is a convenient way to analyse the dependence between types in a multitype point pattern. Suppose that the points have possible types $1,2,\ldots,m$ and let $X_i$ denote the pattern of points of type $i$ only.

If fun="F" then this routine calculates, for each possible type $i$, an estimate of the Empty Space Function $F_i(r)$ of $X_i$. See Fest for explanation of the empty space function.

If fun is "Gcross", "Jcross" or "Kcross", the routine calculates, for each pair of types $(i,j)$, an estimate of the ``i-toj'' cross-type function $G_{ij}(r)$, $J_{ij}(r)$ or $K_{ij}(r)$ respectively describing the dependence between $X_i$ and $X_j$. See Gcross, Jcross or Kcross respectively for explanation of these functions.

If fun is "Gdot", "Jdot" or "Kdot", the routine calculates, for each type $i$, an estimate of the ``i-to-any'' dot-type function $G_{i\bullet}(r)$, $J_{i\bullet}(r)$ or $K_{i\bullet}(r)$ respectively describing the dependence between $X_i$ and $X$. See Gdot, Jdot or Kdot respectively for explanation of these functions.

The letters "G", "J" and "K" are interpreted as abbreviations for "Gcross", "Jcross" and "Kcross" respectively, assumin the point pattern is marked. If the point pattern is unmarked, the appropriate function Fest, Jest or Kest is invoked instead.

See Also

plot.fasp, fasp.object, allstats, Fest, Gest, Jest, Kest, Gcross, Jcross, Kcross, Gdot, Jdot, Kdot

Examples

Run this code
# bramblecanes (3 marks).
   data(bramblecanes)
   X.F <- alltypes(bramblecanes,fun="F",verb=TRUE)
   plot(X.F) 
   X.G <- alltypes(bramblecanes,fun="G",verb=TRUE)
   X.J <- alltypes(bramblecanes,fun="J",verb=TRUE)
   X.K <- alltypes(bramblecanes,fun="K",verb=TRUE)
   X.Gd <- alltypes(bramblecanes,fun="Gdot",verb=TRUE)
   X.Jd <- alltypes(bramblecanes,fun="Jdot",verb=TRUE)
   X.Kd <- alltypes(bramblecanes,fun="Kdot",verb=TRUE)
   <testonly># smaller dataset
      bram <- bramblecanes[seq(1, bramblecanes$n, by=20), ]
      X.F <- alltypes(bram,fun="F",verb=TRUE)
      X.G <- alltypes(bram,fun="G",verb=TRUE)
      X.J <- alltypes(bram,fun="J",verb=TRUE)
      X.K <- alltypes(bram,fun="K",verb=TRUE)
      X.Gd <- alltypes(bram,fun="Gdot",verb=TRUE)
      X.Jd <- alltypes(bram,fun="Jdot",verb=TRUE)
      X.Kd <- alltypes(bram,fun="Kdot",verb=TRUE)</testonly>
   
   # Swedishpines (unmarked).
   data(swedishpines)
   <testonly>swedishpines <- swedishpines[1:25]</testonly>
   X.K <- alltypes(swedishpines,fun="K")
   X.F <- alltypes(swedishpines,fun="F")
   X.G <- alltypes(swedishpines,fun="G")
   X.J <- alltypes(swedishpines,fun="J")

   # simulated data
   pp <- runifpoint(350, owin(c(0,1),c(0,1)))
   pp$marks <- factor(c(rep(1,50),rep(2,100),rep(3,200)))
   X.F <- alltypes(pp,fun="F",verb=TRUE,dataname="Fake Data")
   X.G <- alltypes(pp,fun="G",verb=TRUE,dataname="Fake Data")
   X.J <- alltypes(pp,fun="J",verb=TRUE,dataname="Fake Data")
   X.K <- alltypes(pp,fun="K",verb=TRUE,dataname="Fake Data")

   # A setting where you might REALLY want to use dataname:
   xxx <- alltypes(ppp(Melvin$x,Melvin$y,
                window=as.owin(c(5,20,15,50)),marks=clyde),
                fun="F",verb=TRUE,dataname="Melvin")

Run the code above in your browser using DataCamp Workspace