# Statistical relationships between rasters

I am trying to analyze how sets of rasters relate to each other using some statistical techniques. As, I don't have much experience using the spatial statistics tools in ArcGIS I was exporting my rasters as Ascii files, and analyzing them using R (specifically the `maptools` package, and `readAsciiGrid()` ). This has been functioning ok (but as the datasets have 90,000 points it is slow to run the analysis), but I don't know if I am recreating in R, existing functionality in ArcGIS.

For example, I want to perform regressions between each of these rasters using a few different transformations (logarithmic, exponential, etc). Can this be done within ArcGIS? A second broader question is if there are standard statistical methods for examining this type of data?

Each raster pair has matching data/no-data values and all parameters are identical, aside from the gridcell value.

-

I would stick to R. If speed is really a problem ( I doubt so 90.000 is not such a big number) you could try finding relationships between a subset of your data. Actually the first thing I would do is make a plot to look for obvious relationships.

Even if arcgis contains tools to compare rasters, R will always give you a lot more statistical tools.

Eg:

``````library(rgdal)
samplenr<-sample(length(map1\$band1), 1000)
smallset<-data.frame(map1=map1\$band1[samplenr],map2=map2\$band1[samplenr])
plot(smallset)
lm(map2~map1, smallset)
...
``````

I should actually add that often it is more correct to work with a subset of your data then with your full dataset. In many cases grid cells are not independent from the surrounding data cells, which will result in overly optimistic p values for eg regression fits (you will find more info if you search on declustering).

-
+1. Neither ArcGIS nor, for that matter, any GIS will ever natively provide capabilities like R or other full-featured statistical packages. It would be foolish for them to try. What we can hope for--and ArcGIS appears to be in the early stages--is for the GIS platform to provide efficient integration with other applications for statistical analysis and visualization. –  whuber Jan 5 '11 at 14:56
It's true - speed is not really an issue. It takes about 10s to load two rasters and a 10-15 seconds per operation thus far. If I keep things in perspective, I've waited just as long in ArcGIS for things to happen! I plan to use sampling more, though which will remove any slight delay. –  djq Jan 5 '11 at 17:03

Look into the R raster package, it was designed with this specific kind of problem in mind. It tries to keep as little of the raster in memory, and performs a number of basic spatial operations -- via GDAL it can handle native ESRI Grid files, among many other formats. The vignette provides some nice examples of its use.

-

I just read about an ArcGIS 10 package that is an R plugin. I have not had the chance to explore it fully, but it might be possible to modify this to do what I describe above.

-