# How to simulate spatial point patterns that have spatial structure similar to that of given spatial point pattern?

I have some spatial point pattern X distributed in polygon wind and I wonder how can I simulate different point patterns that by their spatial properties (for example, number of points, spatial autocorrelation of intensity function and etc.) would resemble X spatial point pattern? I am very new in spatial point pattern analysis, so I am not exactly sure what parameters should I want to replicate in my simulations, nor do I know the best methods to do so.

So far, I have tried a number of different methods, but none of these gave me a satisfactory result.

I will share what I have tried:

1. rpoispp function from spatstat with parameter ex=X. Number of points were different and simulated patterns of points seemed to have much more homogeneous distribution than X
2. Estimate intensity of X with density.ppp and nndensity. Calculate variogram of intensity functions and feed sill and range parameters into gstat function to simulate random field R. Than I scaled R values so that the sum of them would be the same as sum of intensity values of X and minimum value of R would be 0. Then I used rpoissp(R,wind) to generate points. The problem was that the number of points was slightly different than that of X and distribution of points seemed not respectful of R image. Finally, intensities of generated point patterns exhibited different variograms.
3. I also tried to scale R values from .1 to .9 and use them as probabilities in generating values of binary variable with many trials. Then I filtered the same number of most successful cases as there are points in X to get the locations of points. However, the resulting distribution of points was too respectful of R and autocorrelation of intensities of these points were different from that of X.
4. Finally, with the help of spsann I tried simulated spatial annealing algorithm to optimize Kinhom function of random point pattern, so that this function would converge to that of X. It worked - functions looked very similar, but the problem is that I do not think that this is the right parameter to optimize, since visually point patterns were very different. Also, the calculation time was too long for me, as I will need to simulate many point patterns. But maybe this was due to poor choice of parameter values, as my understanding of how to use spsann is extremely limited. If that's the case and calculation time can be decreased, this method seems to be the most promising - all I need is to choose more suitable parameter to optimize for.

The most extreme case is to use spatstat::rjitter() which simply shifts the points by independent displacement vectors. If you choose a very small radius the new point patterns will be almost distinguishable from the original pattern.
Otherwise, you can first estimate the inhomogeneous intensity of points with spatstat::density.ppp() and then place a fixed number of independent points according to this intensity with spatstat::rpoint().