This vignette demonstrates the ISAR summary computation.
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="")
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, sigma = A$bandwidth) plot(ims, equal.ribbon = F)
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 and example of homogeneous ISAR:
I <- ISAR(lansing, "hickory", CSR=TRUE) plot(I)
Since the pattern of hickories seem clustered,
Lh <- Linhom(xl[["hickory"]], ims[["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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.