[R-sig-Geo] sp.correlogram

Roger Bivand Roger.Bivand at nhh.no
Thu Jun 24 14:40:26 CEST 2010


On Thu, 24 Jun 2010, Robert Pazur wrote:

> Dear all,
>
> I would like to perform Moran'I correlogram (sp.correlogram method in spdep
> package) based on euclidian fixed distances  but I have following problem:
> I created an artificial table, containing long and lati of regular points
>> points <-read.table("http://www.scandinavia.sk/data/moran5.csv", sep=",",
> header=T)
> following the manual I also identified neighbours of region
>> dnb <- dnearneigh(as.matrix(points$long, points$lati), 0, 20, longlat=T)

No, from your helpful link to the data, you have projected coordinates, 
not geographical. In addition, your use of as.matrix() instead of cbind() 
has bad consequences:

str(as.matrix(points$long, points$lati))
str(cbind(points$long, points$lati))

dnearneigh() will be revised to trap this.

Had you said:

coordinates(points) <- c("long", "lati")

then:

proj4string(points) <- CRS("+proj=longlat")

you would have seen the problem, because the sp classes check for the 
bounds on objects.

So after doing:

points <-read.table("http://www.scandinavia.sk/data/moran5.csv", sep=",",
  header=T)
coordinates(points) <- c("long", "lati")
dnb <- dnearneigh(points, 0, 20)

you are good to go. Next step - how to replicate the ArcGIS Moran's I - is 
easy with the correct dnb:

moran.test(points$GRID_CODE, listw=nb2listw(dnb, style="B"))

You might use correlog() in pgirmess for distance bins, but you'll have 
more control over the bin boundaries by makin new sets of neighbours for 
your chosen bin thresholds.

Hope this helps (and thank you for reverting to the list after writing to 
me directly 70 minutes earlier. List is always best).

Roger


> neighbours list
>> ME200.listw <- nb2listw(dnb, style="W", zero.policy=T)
> but if I perform sp.correlogram function:
>> correl<-sp.correlogram(dnb, points$GRID_CODE, order = 2, method = "I",
> style = "W", randomisation = TRUE, zero.policy = TRUE, spChk=NULL)
> my results are :
> Spatial correlogram for points$GRID_CODE
> method: Moran's I
>    estimate expectation   variance standard deviate Pr(I) two sided
> 1 -0.0029855  -0.0344828  0.0019674           0.7101          0.4776
> 2 -0.0044436  -0.0344828  0.0022585           0.6321          0.5273
>
> and if i perform this part of this task in Arcgis for the same point
> shapefile Moran Calculation for Fixed distance band, Euclidian distance a
> and 20m threshold, result of Moran coefficient is
> (SpatialAutocorrelation moran GRID_CODE false "Fixed Distance Band"
> "Euclidean Distance" None 20 # 0 0 0) results are:
> Global Moran's I Summary
> Moran's Index:   0.746511
> Expected Index:  -0.003521
> Variance:        0.001827
> Z Score:         17.545122
> p-value:         0.000000
>
> I would like to perform the same task like in Arcgis but for multiple
> distances. However Arcgis cannot deal with large data with multiple points,
> thatswhy I
> would like to use R. Its seems to me much better software, but
> unfortunatelly I never use it (but I really want)
> If you could give me some advice i will be very happy.
>
> Robert.
>
>
> -------------------------------------------------------
> Robert Pazur
> PhD student
> Institute of Geography
> Slovak Academy Of Sciences
>
> Mobile : +421 948 001 705
> Skype  : ruegdeg
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list