Skip to contents

Computes the kernel spectral estimator for a multivatiate (multitype) point pattern.

Usage

periodogram_smooth(
  ppp,
  i = NULL,
  j = i,
  inten.formula = "~1",
  data.covariate = NULL,
  bandwidth,
  correct = TRUE,
  a = 0.025,
  A1 = NULL,
  A2 = A1,
  endpt = 1.5,
  equal = TRUE,
  kern = bartlett_uni
)

Arguments

ppp

A point pattern of class "ppp".

i

Mark index. An element in levels(spatstat.geom::marks(ppp)).

j

Mark index. An element in levels(spatstat.geom::marks(ppp)).

inten.formula

A formula syntax in character format specifying the log-liner model for the intensity function, which is passed to ppm(). The default is constant intensity inten.formula = "~1".

data.covariate

Optional. The values of spatial covariates passed to the data argument in ppm.

bandwidth

A positive value indicating the bandwidth of kernel, determined by select_band().

correct

Logical. If TRUE (default), conduct edge correction when computing the kernel spectral estimator.

a

Taper coefficient, a value within (0,1/2)(0,1/2). If a = 0, then taper is not applied. Default is a = 0.025.

A1, A2

Optional. Side lengths of the observation window.

endpt

A positive value indicating the scale factor of the endpoint frequency.

equal

Logical. If TRUE, then use the same bandwidth for both x and y direction.

kern

Univariate scaled kernel function. The default is Barrlett kernel.

Value

A list of matrices, or a single matrix if i and j are specified.

Details

The minimal required arguments are ppp, inten.formula, and bandwidth. If you use any spatial covariate other than the Cartesian coordinates in inten.formula, then data.covariate is also needed. All the other arguments can be left by default setting. periodogram_smooth() computes all the pairwise (marginal and cross-) kernel spectral estimators automatically when the mark indices i and j are unspecified. If i and j are specified, then it only computes the result for that mark combination.

The bandwidth can be determined by select_band().

Examples

library(spatstat)
lam <- function(x, y, m) {(x^2 + y) * ifelse(m == "A", 2, 1)}
spp <- rmpoispp(lambda = lam, win = square(5), types = c("A","B"))

# Compute kernel spectral estimator with intensity fitted by log-linear model
# with Cartesian coordinates
ksde = periodogram_smooth(spp, inten.formula = "~ x + y", bandwidth = 1.2)
lapply(ksde, round, 2)
#> $`A, A`
#>                    -4.71238898038469 -3.76991118430775 -2.82743338823081
#> -4.71238898038469               0.20              0.40              0.54
#> -3.76991118430775               0.54              0.38              0.85
#> -2.82743338823081               0.54              0.36              0.85
#> -1.88495559215388               0.52              0.41              0.32
#> -0.942477796076938              0.57              0.98              0.61
#> 0                               0.50              0.85              0.56
#> 0.942477796076938               0.43              0.75              0.50
#> 1.88495559215388                0.23              0.50              0.68
#> 2.82743338823081                0.24              0.31              0.34
#> 3.76991118430775                0.33              0.27              0.22
#> 4.71238898038469                0.33              0.51              0.84
#>                    -1.88495559215388 -0.942477796076938    0 0.942477796076938
#> -4.71238898038469               0.31               0.31 0.25              0.22
#> -3.76991118430775               0.87               0.37 0.22              0.19
#> -2.82743338823081               1.19               0.55 0.34              0.44
#> -1.88495559215388               0.39               0.49 0.37              0.31
#> -0.942477796076938              0.46               0.88 0.32              0.27
#> 0                               0.62               0.58 0.23              0.58
#> 0.942477796076938               0.32               0.27 0.32              0.88
#> 1.88495559215388                0.23               0.31 0.37              0.49
#> 2.82743338823081                0.23               0.44 0.34              0.55
#> 3.76991118430775                0.18               0.19 0.22              0.37
#> 4.71238898038469                0.56               0.22 0.25              0.31
#>                    1.88495559215388 2.82743338823081 3.76991118430775
#> -4.71238898038469              0.56             0.84             0.51
#> -3.76991118430775              0.18             0.22             0.27
#> -2.82743338823081              0.23             0.34             0.31
#> -1.88495559215388              0.23             0.68             0.50
#> -0.942477796076938             0.32             0.50             0.75
#> 0                              0.62             0.56             0.85
#> 0.942477796076938              0.46             0.61             0.98
#> 1.88495559215388               0.39             0.32             0.41
#> 2.82743338823081               1.19             0.85             0.36
#> 3.76991118430775               0.87             0.85             0.38
#> 4.71238898038469               0.31             0.54             0.40
#>                    4.71238898038469
#> -4.71238898038469              0.33
#> -3.76991118430775              0.33
#> -2.82743338823081              0.24
#> -1.88495559215388              0.23
#> -0.942477796076938             0.43
#> 0                              0.50
#> 0.942477796076938              0.57
#> 1.88495559215388               0.52
#> 2.82743338823081               0.54
#> 3.76991118430775               0.54
#> 4.71238898038469               0.20
#> 
#> $`A, B`
#>                    -4.71238898038469 -3.76991118430775 -2.82743338823081
#> -4.71238898038469         0.05+0.03i        0.13-0.26i        0.07-0.28i
#> -3.76991118430775         0.10+0.13i        0.11-0.03i       -0.22-0.06i
#> -2.82743338823081        -0.04-0.15i       -0.04-0.01i       -0.24-0.04i
#> -1.88495559215388        -0.07-0.24i       -0.15-0.02i       -0.13+0.05i
#> -0.942477796076938       -0.02-0.13i       -0.29-0.11i       -0.14+0.13i
#> 0                        -0.05-0.23i       -0.31-0.13i       -0.14+0.07i
#> 0.942477796076938        -0.04-0.22i       -0.21-0.11i       -0.04-0.02i
#> 1.88495559215388          0.07-0.11i        0.09-0.10i        0.09-0.05i
#> 2.82743338823081          0.11-0.01i        0.16+0.04i       -0.04+0.06i
#> 3.76991118430775          0.18-0.05i        0.18+0.04i        0.03+0.09i
#> 4.71238898038469          0.12-0.02i        0.13+0.10i        0.04+0.39i
#>                    -1.88495559215388 -0.942477796076938           0
#> -4.71238898038469         0.00-0.06i        -0.03-0.15i -0.03-0.03i
#> -3.76991118430775        -0.03+0.13i        -0.02-0.04i -0.08+0.01i
#> -2.82743338823081        -0.06+0.00i         0.05-0.01i  0.09+0.04i
#> -1.88495559215388        -0.04+0.00i         0.14+0.05i  0.15+0.19i
#> -0.942477796076938        0.07-0.03i         0.20+0.07i  0.07+0.12i
#> 0                        -0.05-0.13i         0.04-0.02i  0.01+0.00i
#> 0.942477796076938        -0.07+0.07i         0.08-0.02i  0.07-0.12i
#> 1.88495559215388         -0.05-0.01i         0.04-0.15i  0.15-0.19i
#> 2.82743338823081         -0.13-0.02i         0.06-0.10i  0.09-0.04i
#> 3.76991118430775         -0.02+0.03i        -0.01-0.06i -0.08-0.01i
#> 4.71238898038469         -0.27-0.01i        -0.08-0.11i -0.03+0.03i
#>                    0.942477796076938 1.88495559215388 2.82743338823081
#> -4.71238898038469        -0.08+0.11i      -0.27+0.01i       0.04-0.39i
#> -3.76991118430775        -0.01+0.06i      -0.02-0.03i       0.03-0.09i
#> -2.82743338823081         0.06+0.10i      -0.13+0.02i      -0.04-0.06i
#> -1.88495559215388         0.04+0.15i      -0.05+0.01i       0.09+0.05i
#> -0.942477796076938        0.08+0.02i      -0.07-0.07i      -0.04+0.02i
#> 0                         0.04+0.02i      -0.05+0.13i      -0.14-0.07i
#> 0.942477796076938         0.20-0.07i       0.07+0.03i      -0.14-0.13i
#> 1.88495559215388          0.14-0.05i      -0.04+0.00i      -0.13-0.05i
#> 2.82743338823081          0.05+0.01i      -0.06+0.00i      -0.24+0.04i
#> 3.76991118430775         -0.02+0.04i      -0.03-0.13i      -0.22+0.06i
#> 4.71238898038469         -0.03+0.15i       0.00+0.06i       0.07+0.28i
#>                    3.76991118430775 4.71238898038469
#> -4.71238898038469        0.13-0.10i       0.12+0.02i
#> -3.76991118430775        0.18-0.04i       0.18+0.05i
#> -2.82743338823081        0.16-0.04i       0.11+0.01i
#> -1.88495559215388        0.09+0.10i       0.07+0.11i
#> -0.942477796076938      -0.21+0.11i      -0.04+0.22i
#> 0                       -0.31+0.13i      -0.05+0.23i
#> 0.942477796076938       -0.29+0.11i      -0.02+0.13i
#> 1.88495559215388        -0.15+0.02i      -0.07+0.24i
#> 2.82743338823081        -0.04+0.01i      -0.04+0.15i
#> 3.76991118430775         0.11+0.03i       0.10-0.13i
#> 4.71238898038469         0.13+0.26i       0.05-0.03i
#> 
#> $`B, B`
#>                    -4.71238898038469 -3.76991118430775 -2.82743338823081
#> -4.71238898038469               0.22              0.37              0.30
#> -3.76991118430775               0.19              0.29              0.24
#> -2.82743338823081               0.14              0.11              0.14
#> -1.88495559215388               0.18              0.16              0.19
#> -0.942477796076938              0.11              0.17              0.17
#> 0                               0.18              0.20              0.16
#> 0.942477796076938               0.19              0.15              0.11
#> 1.88495559215388                0.17              0.13              0.12
#> 2.82743338823081                0.18              0.17              0.19
#> 3.76991118430775                0.23              0.18              0.23
#> 4.71238898038469                0.10              0.12              0.37
#>                    -1.88495559215388 -0.942477796076938    0 0.942477796076938
#> -4.71238898038469               0.15               0.18 0.18              0.20
#> -3.76991118430775               0.11               0.08 0.13              0.13
#> -2.82743338823081               0.06               0.04 0.10              0.14
#> -1.88495559215388               0.13               0.11 0.23              0.21
#> -0.942477796076938              0.14               0.11 0.15              0.20
#> 0                               0.16               0.07 0.05              0.07
#> 0.942477796076938               0.26               0.20 0.15              0.11
#> 1.88495559215388                0.32               0.21 0.23              0.11
#> 2.82743338823081                0.38               0.14 0.10              0.04
#> 3.76991118430775                0.32               0.13 0.13              0.08
#> 4.71238898038469                0.39               0.20 0.18              0.18
#>                    1.88495559215388 2.82743338823081 3.76991118430775
#> -4.71238898038469              0.39             0.37             0.12
#> -3.76991118430775              0.32             0.23             0.18
#> -2.82743338823081              0.38             0.19             0.17
#> -1.88495559215388              0.32             0.12             0.13
#> -0.942477796076938             0.26             0.11             0.15
#> 0                              0.16             0.16             0.20
#> 0.942477796076938              0.14             0.17             0.17
#> 1.88495559215388               0.13             0.19             0.16
#> 2.82743338823081               0.06             0.14             0.11
#> 3.76991118430775               0.11             0.24             0.29
#> 4.71238898038469               0.15             0.30             0.37
#>                    4.71238898038469
#> -4.71238898038469              0.10
#> -3.76991118430775              0.23
#> -2.82743338823081              0.18
#> -1.88495559215388              0.17
#> -0.942477796076938             0.19
#> 0                              0.18
#> 0.942477796076938              0.11
#> 1.88495559215388               0.18
#> 2.82743338823081               0.14
#> 3.76991118430775               0.19
#> 4.71238898038469               0.22
#>