Volkan Kepoglu wrote:
I loaded spatstat, maptools, rgdal packages.
I want to generate random point pattern with different window derived
from polygon shp file.
but i can not pass new owin argument to rpoispp
> spdf = readOGR(dsn="polygon.shp",layer= "polygon")
> sp_owin = as(as(spdf,"SpatialPolygons"),"owin")
> grpp = rpoispp(100000, win=sp_owin) # this does not work
The last line instructs spatstat to generate a Poisson process with an
**intensity** equal to 100000,
that is, a density of 100000 points ***PER UNIT AREA**.
Your polygonal window sp_owin has an area of 11857425 square units.
This means the expected number of points in the simulated pattern is
100000 * 11857425 = 1.185743e+12.
That is more than a trillion points.
For a Poisson process, the actual number of points generated is a
Poisson random variable with mean equal to 1.2 trillion:
v <- 100000 * 11857425
n <- rpois(1, v)
x <- runif(n)
The error message is coming from 'runif' which is refusing to generate
more than a trillion random numbers:
Error in runif(n) : invalid arguments
In addition: Warning message:
In runif(n) : NAs introduced by coercion
If you wanted to generate approximately 100000 points, set lambda =
100000/area.owin(sp_owin) in the call to rpoispp.
If you wanted to generate exactly 100000 points, use runifpoint(100000,
win=sp_owin).
Adrian Baddeley
_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo