Pergunta

I am working on R 3.0.1 and I did the simulation for a clustered Poisson Process, R normally has a default area which is basically a box, in the next picture you can see my simulation:

enter image description here

Everything is all right so far, the trouble is that I want to do is to simulate the same distribution but using a geographic area, but I do not know how I could change the parameters in order to have a different area using geographic coordinates. For example:

enter image description here

To sum up, basically what I want to do is to figure out how to change this area for a bigger one, in order to make the same simulation but with the new area. Here is the code I tried:

library(spatstat)

sim1 = rpoispp(100)
plot(sim1)
Foi útil?

Solução

You can try this:

require(spatstat)
require(maps)

lambda = 0.1 # intensity of the process
lon = c(-100,-70) # domain's longitude
lat = c(-40,10)   # domain's latitude

sim = rpoispp(lambda, win=c(lon,lat))

# do the plot
par(mar=c(1,1,1,1))
map("world", xlim=lon, ylim=lat, fill=TRUE)
map.axes() # add axes
plot(sim, chars=19, cols="red",cex=0.5, add=TRUE)

# add other process

lon1 = c(-95,-85) # other area
lat1 = c(-5,5)
sim1 = rpoispp(5*lambda, win=c(lon1,lat1))
plot(sim1, chars=19, cols="blue",cex=0.5, add=TRUE)

Final map

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top