On Mon, 28 Jun 2010, Robert Pazur wrote:

Dear all,

according to perfect recommendations I perform moran.test  from "spdep"
package. My datasets - csv X,Y tables has 90 000 rows representing 90 000
regular points. In order to obtain morans correlogram I did a batch run and
my plan is to obtain autocorrelation values up to 3000 meters
distance.  However according to my hardware limitations I  just came to to
170 meters value of the dnearneigh -neighbours of region points by Euclidean
distance function (dnr_170 <- dnearneigh(pointd_r, 0, 170). After this I
receive well know memory allocation error problem. R in my machine runs on
32-bit Windows xp version, with just 2 GB of RAM. Is there some way to
overcome this issue?

Are you perhaps not deleting the previous large objects that you have created? Look at ls(), and use rm() and gc() to get rid of unneeded objects. If you are careful, you may do save() before rm(), to have a copy of the nb or listw object for each step. If I recall, your points are in a grid 20m apart, so you might also consider using other approaches to this.

Roger

Thanks in advance.

Robert Pazur


-------------------------------------------------------
Robert Pazur
PhD student
Institute of Geography
Slovak Academy Of Sciences

Mobile : +421 948 001 705
Skype  : ruegdeg


2010/6/24 Robert Pazur <pazurrob...@gmail.com>

Thank you very much for wonderful reply! Its exactly what i was looking for
last couple of hours.
Its incredible smart tool!
Kind regards,
Robert.






2010/6/24 Roger Bivand <roger.biv...@nhh.no>

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@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.biv...@nhh.no





--
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.biv...@nhh.no

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to