Returns a matrix containing the maximal coherence or partial coherence for all pairwise processes.
Arguments
- sp.est
List. The kernel spectral density estimate from
periodogram_smooth()
.- ppp
A point pattern of class
"ppp"
.- type
If
"partial"
(default), calculate the partial coherence. If"normal"
, calculate the coherence.- all
Logical. If
TRUE
, extract the maximum (partial) coherence across all frequencies, which is not recommended.
Value
A matrix with each entry storing the maximal (partial) coherence between two individual point processes.
Examples
library(spatstat)
#> Loading required package: spatstat.data
#> Loading required package: spatstat.univar
#> spatstat.univar 3.1-2
#> Loading required package: spatstat.geom
#> spatstat.geom 3.3-5
#> Loading required package: spatstat.random
#> spatstat.random 3.3-2
#> Loading required package: spatstat.explore
#> Loading required package: nlme
#> spatstat.explore 3.3-4
#> Loading required package: spatstat.model
#> Loading required package: rpart
#> spatstat.model 3.3-4
#> Loading required package: spatstat.linnet
#> spatstat.linnet 3.2-5
#>
#> spatstat 3.3-1
#> For an introduction to spatstat, type ‘beginner’
lam <- function(x, y, m) {(x^2 + y) * ifelse(m == "A", 2, 1)}
set.seed(227823)
spp <- rmpoispp(lambda = lam, win = square(5), types = c("A","B"))
# Compute kernel spectral density estimator with fitted intensity by log-linear
# model with Cartesian coordinates
KSDE.list <- periodogram_smooth(spp, inten.formula = "~ x + y", bandwidth = 1.15)
coh.partial <- coherence(KSDE.list, spp) # Compute the maximum partial coherence
#> Number of frequencies to pick the maximum partial coherence: 9 (this value should not be too small).
attr(coh.partial, "CohTable") # Print the partial coherence values for all frequencies
#> omega1 omega2
#> result.1 -2.827433 -2.827433 0.0040862635
#> result.2 0.000000 -2.827433 0.0006695371
#> result.3 2.827433 -2.827433 0.0002041050
#> result.4 -2.827433 0.000000 0.0001230843
#> result.5 0.000000 0.000000 0.0002522640
#> result.6 2.827433 0.000000 0.0001230843
#> result.7 -2.827433 2.827433 0.0002041050
#> result.8 0.000000 2.827433 0.0006695371
#> result.9 2.827433 2.827433 0.0040862635