1

I recently dabbled a bit into point pattern analysis and wonder if there is any standard practice to create mark correlation structures varying with the inter-point distance of point locations. Clearly, I understand how to simulate independent marks, as it is frequently mentioned e.g.

library(spatstat)
data(finpines) 
set.seed(0907)
marks(finpines) <- rnorm(npoints(finpines), 30, 5)
plot(finpines)

enter image description here

More generally speaking, assume we have a fair amount of points, say n=100 with coordinates x and y in an arbitrary observation window (e.g. rectangle). Every point carries a characteristic, for example the size of the point as a continuous variable. Also, we can examine every pairwise distance between the points. Is there a way to introduce correlation structure between the marks (of pairs of points) which depends on the inter-point distance between the point locations?


Furthermore, I am aware of the existence of mark analysing techniques like

fin <- markcorr(finpines, correction = "best")
plot(fin)

When it comes to interpretation, my lack of knowledge forces me to trust my colleagues (non-scientists). Besides, I looked at several references given in the documentation of the spatstat functions; especially, I had a look on "Statistical Analysis and Modelling of Spatial Point Patterns", p. 347, where inhibition and mutual stimulation as deviations from 1 (independence of marks) of the normalised mark correlation function are explained.

Codo1981
  • 11
  • 3

1 Answers1

1

I think the best bet is to use a random field model conditional on your locations. Unfortunately the package RandomFields is not on CRAN at the moment, but hopefully it will return soon. I think it may be possible to install an old version of RandomFields from the archives if you want to get going immediately.

Thus, the procedure is:

  1. Use spatstat to generate the random locations you like.
  2. Extract the coordinates (either coords() or as.data.frame.ppp()).
  3. Define a model in RandomFields (e.g. RMexp()).
  4. Simulate the model on the given coordinates (RFsimulate()).
  5. Convert back to a marked point pattern in spatstat (either ppp() or as.ppp()).
Ege Rubak
  • 4,347
  • 1
  • 10
  • 18
  • Thank you very much! I will try to get it going soon! Not sure how to set up such a model yet (cp. bullet point 3). – Codo1981 Sep 07 '22 at 17:39
  • Unfortunately, found no way to install `{RandomFields}` from the archives on arm64 (apple silicon). – Codo1981 Sep 09 '22 at 10:20
  • Maybe you could try to install from https://predictiveecology.r-universe.dev (I don't know if it works on Apple Silicon): `install.packages(c("RandomFieldsUtils", "RandomFields"), repos = "https://predictiveecology.r-universe.dev")` – Ege Rubak Sep 12 '22 at 07:34
  • Thank you for the suggestion. Tried similar approaches; error. I think Apple Silicon is the problem with those. – Codo1981 Sep 13 '22 at 06:26
  • OK. Did you also try to compile an old version locally? E.g. installing `RandomFieldsUtils_0.5.5.tar.gz` from https://cran.r-project.org/src/contrib/Archive/RandomFieldsUtils/ and `RandomFields_3.3.13.tar.gz` from https://cran.r-project.org/src/contrib/Archive/RandomFields/ ? Is the compilation of the package C-code giving an error on Apple Silicon? – Ege Rubak Sep 13 '22 at 10:40
  • Indeed, I tried. Installation of `RandomFieldUtils` works without throwing any error, but for `RandomField`: `ERROR: compilation failed for package` + warning: `had non-zero exit status`. Even after installing XCode. – Codo1981 Sep 13 '22 at 22:09
  • Asking for curiosity, would it be possible to add some explanation to 3-6? `xy <- coords(finpines); model <- RMexp(); res <- RFsimulate(model = model, x = xy); marks(finpines) <- res$variable1` Is this the suggested way? Is there a way to construct correlated marks on the positive axis only? – Pax Sep 23 '22 at 12:22