Hello list,
I would like to calculate the Getis-Ord Gi* clustering
statistic for points (mileposts) on a network (roads) and I don’t think there
is a function in one of the spatial packages to do so. Hence I decided to code
it myself, but I’m having some difficulties. Here is the general framework I
was hoping to implement:
1)      For each focal point i =1,2,…, N, grow a subset of the network within distance k
2)      Determine which points intersect the resultant
network subset and sum the values of all these points plus the focal point i
3)      Calculate Gi* by dividing “neighborhood” sum by
study extent sum and redefine as a normal standard deviate as per Getis and Ord’s
procedures (Getis and Ord 1992).
I was envisioning writing this code as a loop incrementing i  from 1 to N,
calculating the sum of values within each network “neighborhood” and
attributing that to each point. Then the rest are just dataframe calculations.
However, I got stuck in my trial and error and I have 2 questions please in
regards to implementing the above procedures that I’m hoping other list members
can help with:
First, I started with bullet number 1 creating the network “neighborhood“
using the lineardisc function in spatstat. For example the following code shows
the network subsets within distance k = 0.2, for focal points 2 and 5:
library(spatstat)
data(simplenet)
set.seed(100)
X <- rpoislpp(5, simplenet)
xp <- ppp(X$data$x,X$data$y)
plot(simplenet)
points(xp,col=c("blue","red",rep("blue",2),"red",rep("blue",7)),pch=16,cex=1)
text(X$data$x,X$data$y,adj=0.01,cex=1.5)
lineardisc(simplenet,xp[2],0.2,cols=c("transparent",
"red","transparent"))
lineardisc(simplenet,xp[5],0.2,cols=c("transparent",
"red","transparent"))
 
I don’t know how to proceed from here in terms of determining
which points intersect each network “neighborhood” so I can sum them. In this
example the values of pts 2, 3, 10, and 11 will be summed and attributed to focal
pt 2 and values of pts 5, 6, and 8 will be summed and attributed to focal pt 5.  I tried to search for functions that could 1)
convert the output of lineardisc into a spatial lines object and 2) intersect spatial
points with lines, but with no success… I would welcome any suggestions on
completing such tasks.
Second, my road network is an ESRI shp file which I
successfully converted into a psp object using maptools functions. However, I
don’t know how to extract an edge list so I can convert it to a linnet object
using the linnet{spatstat} function. I would welcome any suggestions here as
well.
Thanks in advance for your help and apologies if I’m missing
something obvious… 
Sharon

Sharon Baruch-Mordo
Ph.D. Candidate in Ecology
Dept. of Fish, Wildlife, and Conservation Biology
Colorado State University
Fort Collins, CO 80523-1474
Phone: 970-491-7020  
Fax: 970-491-5091
E-mail: sharonbm@warnercnr.colostate.edu
http://www.warnercnr.colostate.edu/research/bear

	[[alternative HTML version deleted]]

