As per title, I am trying to figure out how to simulate such point pattern without the use of the 'spatstat' package (which I cannot install due to the old version of R which I am using, which in turn I cannot update due to the old OS I am currently using). So, I am wondering if there is a viable workaround? I have performed a web search, but I have only found reference to 'spatstat'.


Since the resulting Poisson CSR is directly a function of the spatial domain being simulated the simulation envelope is critical, in this case the bounding polygon. The spatstat library not only has functionality for simulating CSR under various conditions but also provides object classes that facilitate this type of modeling. This would be very difficult for you to code from scratch and yield correct results. I am a spatial statistician and, often when coding spatial simulations, rely on the spatstat classes.

There should be backwards compatible versions of spatstat. Check the CRAN package archive, all of the previous versions of R libraries retained. The spatstat library has been around for some time and it is very doubtful that you will not be able to find a compatible version in the CRAN archive. Go to the CRAN website and on the left click on "packages", scroll down and click on "archive" then select your library and it will take you to all the previous versions of the package.


If you can install splancs you can do this, there's a function for random point patterns within a polygon defined by a simple loop of x,y coordinates.

Also, if you can install anything that can do point-in-polygon tests (which is how Splancs works) such as sp and rgeos, (or maybe gpclib) you can just generate points over the bounding box using runif and then clip them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.