This vignette demonstrates the ISAR summary computation.

Data

library(knitr)
opts_chunk$set(echo=TRUE, fig.height=6, fig.width=6)

Let's look at the multitype pattern lansing

library(spatstat)
library(sseg)
xl <- split(lansing)
par(mar=c(0,0,0,0))
plot(xl, cex=.4, main="")

Intensity

To compute the inhomogeneous ISAR we need to estimate the intensity per point per type. We can estimate the intensities using kernel smoothing. The bandwidth needs to be chosen, and one criteria is to minimize [ L(h)=(\sum_{x\in X_i}\frac{1}{\lambda_i(x; h)}-|W|)^2 ] To do this for each pattern there is a wrapper:

A <- intensity_optimal(lansing, verb = T)
print(summary(A))
#par(mfrow=c(2,3))
#plot(A, i=1:6, type="l", log="y")

And to see the intensity estimates

ims <- density_ppplist(xl, sigmas = A$bandwidth)
plot(ims, equal.ribbon = F)

ISAR

Now let's compute the ISAR values. We need to specify a target type. A function ISAR computes both homogeneous and inhomogeneous, depending whether we specify the parameter intensity. Here's an example of homogeneous ISAR:

I <- ISAR(lansing, "hickory", CSR=TRUE)
plot(I)

Since the pattern of hickories seem clustered on large scales,

Lh <- Lest(xl[["hickory"]], correction = "trans")
plot(Lh, .-r~r)

there are a lot of same types around for ISAR, so we get less alien types than would be expected if everything was random. Note that CSR is much stronger independence than independence between types, and rarely a good null model for multitypes.

Il <- lapply(names(xl), ISAR, x=lansing)
isar <- do.call(cbind, Il)
plot(isar)

And then the inhomogeneous ones:

Iil <- lapply(names(xl), ISAR, x=lansing, intensity = A$intensity)
# or
# Iil <- lapply(names(xl), ISAR, x=lansing, intensity = ims)

inhISAR <- do.call(cbind, Iil)
plot(inhISAR)

The differences (a bit ugly):

Idl <- lapply(seq_along(xl), function(s) {
    k <- Il[[s]]
    k[,2] <- Il[[s]]$ISAR - Iil[[s]]$inhISAR
    k
  })
difference <- do.call(cbind, Idl)
plot(difference)
abline(h=0)

We see that most of the homogeneous values are higher that inhomogeneous values. This implies that the segregation can be somewhat explained possibly by different environmental preferences.

Testing

Focus on the Hickories. We study are the Hickories particularly aversive of other species using a Monte Carlo test.

env1 <- envelope(lansing, fun = function(x, ...) ISAR(x, "hickory"),
         simulate = expression(rshift(lansing)), savefuns = TRUE )
plot(env1, xlim = c(0,0.05))


antiphon/sseg documentation built on May 10, 2019, 12:22 p.m.