1

I have a set of one-dimensional data points (locations on a segment), and I would like to test for Complete Spatial randomness. I was planning to run Gest (nearest neighbor), Fest (empty space) and Kest (pairwise distances) functions on it.

I am not sure how I should import my data set though. I can use ppp by setting a second dimension to 0, e.g.:

myDistTEST<- data.frame(
  col1= sample(x = 1:100, size = 50, replace = FALSE),
  col2= paste('Event', 1:50, sep = ''), stringsAsFactors = FALSE)
myDistTEST<- myDistTEST[order(myDistTEST$col1),]                        
myPPPTest<- ppp(x = myDistTEST[,1], y = replicate(n = 50, expr = 0),
                c(1,120), c(0,0))

But I am not sure it is the proper way to format my data. I have also tried to use lpp, but I am not sure how to set the linnet object. What would be the correct way to import my data? Thank you for your kind attention.

Max_IT
  • 602
  • 5
  • 15

1 Answers1

1

It will be wrong to simply let y=0 for all your points and then proceed as if you had a point pattern in two dimensions. Your suggestion of using lpp is good. Regarding how to define the linnet and lpp try to look at my answer here.

I have considered making a small package to handle one dimensional patterns more easily in spatstat, but so far I have only started the package with a single function to make the definition of the appropriate lpp easier. If you feel adventurous you can install it from the GitHub repo via the remotes package:

remotes::install_github("rubak/spatstat.1d")

The single function you can use is called lpp1. It basically just wraps up the few steps described in the linked answer.

Ege Rubak
  • 4,347
  • 1
  • 10
  • 18
  • Thank you for your kind answer! I will try and implement your solution and see if I can make it work – Max_IT Feb 15 '20 at 00:35
  • OK, it works! Thank you again for the kind help. I can produce a plot with the linear K, which shows me a theoretical distribution and compares it to the observed. Is there a specific function to test for significance and have a p value? I am not sure performing the t test would be correct. Also, I was looking for equivalents of Gstat and found nndist.lpp, which seems to work, although it only outputs the observed distribution. Would it be correct to then use rpois on the same dataset and compare it to the nndist.lpp output? – Max_IT Feb 17 '20 at 17:49