[R-sig-Geo] Question about inhomogeneous k-functions

Marcelino de la Cruz marcelino.delacruz at upm.es
Tue May 5 22:32:49 CEST 2015


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ó:
> Good afternoon everyone! I'm new to this forum and was hoping to get some
> clarity about running k-function analysis in R.
>
> I would like to see whether hospitals in a certain state are clustered,
> dispersed or randomly distributed. I could just use the regular Ripley's
> k-function analysis to examine the spatial distribution of the hospitals and
> simulate confidence envelopes using the envelope command.
>
> However, it won't be surprising to find that hospitals are clustered, as
> more will be located in areas where the population (or population density)
> is higher. So my question is whether there any way for R to take into
> consideration a raster file showing the different population densities in
> various parts of my study region when simulating confidence envelopes? Is
> this what the Kinhom function does? And if so, how do I get it to read my
> raster file?
>
> Thank you!
>
>
>
>
>
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Question-about-inhomogeneous-k-functions-tp7588180.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list