Skip to content
Prev 22709 / 29559 Next

Question about inhomogeneous k-functions

Hi eugeneby,


This is quite easy, using rgdal, maptools and spatstat.

See this example:

library(sp)
library(rgdal)
library(maptools)
library(spatstat)

# read external grid with rgdal; for example this data on package sp
x <- readGDAL(system.file("external/test.ag", package="sp")[1])

#transform to "im" format of spatstat

x.im<- as(x, "im")

plot(x.im)

# you should transform the values to correspond to the desired density 
of hospitals with arithmetic operations, for example:

x.im2<- x.im/10e7

plot(x.im2)

# And now you rpoispp to simulate random locations of hospitals an use 
this to compute envelopes

rpoispp(x.im2)

points(rpoispp(x.im2))


HTH,

MArcelino


El 05/05/2015 a las 19:37, eugeneby escribi?: