[STATSGRASS] Re: [GRASS5] r.moran

Roger Bivand Roger.Bivand at nhh.no
Wed Mar 22 08:00:56 EST 2006


On Wed, 22 Mar 2006, Wolf Bergenheim wrote:

> On Wed, 22 Mar 2006, Roger Bivand wrote:
> 
> > On Wed, 22 Mar 2006, Wolf Bergenheim wrote:
> >
> >> On Wed, 22 Mar 2006, Roger Bivand wrote:
> >>
> >>>>
> >>>> You might be right. But I guess it wouldn't work for vectors?
> >>>
> >>> No, vectors are fully supported - in fact a raster would be treated as
> >>> cell centre points. See the range of functions for building lists of
> >>> neighbours in the R spdep package. Are your vectors points or polygons?
> >>
> >> Hey that is good to know. Now I even have a reason to join that list (;
> >>
> >> I have a bunch of vector areas that I'd need to do Moran's I on. Thing is
> >> that I'm not very comfortable with R, so I guess I'll need some help.
> >>
> >>> What criteria for neighbours do you need?
> >>
> >> My vectors are polygons, squares actually, with sides of 1 km. So I guess a
> >> neighbour is one that shares a boundary. I guess I could easily convert
> >> these to rasters, but since they are vectors I can connect an attribute
> >> table to them. I have to calculate Moran's I on many attributes.
> >>
> >
> > OK. Do the squares cover a whole rectanglar region, or are there ragged
> > edges, holes, etc? Are they now stored as GRASS vector - I guess yes? How
> > many are there? What kind(s) of variables do you need to test for
> > autocorrelation, categorical or continuous-valued?
> 
> The squares are 1 km2 squares in geographic orientation. They are side-to 
> side, but some holes exist (i.e. missing squares). The data is categorical. 
> the grid is a grid of population. so one square includes all residents of 
> that square km. I have for instance count of children under the age of 6. 
> I'd like to calculate the Moran's I to see how clustered the children are 
> both with the absolute count and a percentage (for which there is another 
> attribute). What kind of databases can R connect to? Would it be hard to 
> connect to an SQLite database? Currently my data is in grass vector and 
> the data is in an SQLite DB. I also have the same data as an ESRI 
> shapefile and the data as a dBASE IV file.
> 
> This is what the data looks like:
> http://wolf.bergenheim.net/tmp/alkoul_i.jpg

What platform are you doing the analysis on?

The immediate easy route is the shapefile. Yes, R can talk to SQLite, but 
I can't, so can't advise on that.

How had you considered handling the unconnected islands? It looks as 
though most of the map has low values, and only a few higher values - this 
is effectively saying that the variable is predicted by its mean, and 
since most of the map is below the mean, and the rest above, the result is 
a foregone conclusion, that is the data do not look mean-stationary. So I 
don't think Moran's I will tell you much you don't know, but I could be 
wrong. 

Roger

> 
> Zoomed in a bit:
> http://wolf.bergenheim.net/tmp/alkoul_i_2.jpg
> 
> >
> > There will be three steps:
> >
> > 1) get the data into R
> >
> > 2) build the neighbour representation, and
> >
> > 3) test
> 
> hmm I think I'm going to need help with all steps ):
> 
> --Wolf
> 
> 

-- 
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 grass-stats mailing list