# How can I calculate Moran's I in 3D?

This may be a question to post on a GIS forum, but I was wondering if among the spatial data experts here, someone could help me calculate the extension of Moran's I to 3D? Our data is about 3D habitat complexity, specificlaly, the 3D complexity of the habitat provided by algae to other marine organisms. The idea is to estimate Moran's I using 3D data we have in which each voxel (3d pixel) is either water or algae. So, the neighbours for each point are distributed in 3d space.

Norbert Marwan used this to calculate bone complexity (medical journal) but there is something about how poitns are accounted for in the index calculation avoid repetition of neighbour pairs that I don't understand

Any help would be most appreciated.

All the best,

Ana

-
could you add a link to the journal article and describe exactly where you are stuck to give this a chance to be answerable – iant Jun 7 '13 at 12:08
This may be semantics, but I am unclear on what you mean by 3D. The Moran's-I requires an associated [Z] value at each [X,Y] observation. Since the required input matrix Z(s) is [X,Y,Z] it conceptually represents a 3D process. A voxel (volumetric pixel) represents multiple ordered Z values. Is this what you are referring to? Or are you asking about deriving some type of 3D spatial weights [Wij] matrix? It seems like you are asking about a bivariate Moran's-I and not 3D. – Jeffrey Evans Jun 7 '13 at 18:11
This answer on the stats site demonstrates that Moran's I (as well as similar statistics like the join-count statistic) do not depend on the dimensionality of the underlying space, but only on the topology of the weighted network defining the neighbors. – whuber Jun 7 '13 at 22:12

I don't think there's much difference between 2d and 3d space, it is just a matter of how you define distance between you samples. The neighboring function is the same as:

``````wij = 1/dij,  dij<c
wij = 0,      dij>0
``````

In 2d case, the distance between samples are usually defined as geographical distance:

``````dij = sqrt((i_x-j_x)^2 + (i_y-j_y)^2)
``````

and in 3d space, you may just make it as:

`````` dij = sqrt((i_x-j_x)^2 + (i_y-j_y)^2 + (i_z-j_z)^2).
``````

Note I'm using i_x, i_y, i_z to reprensets the x,y,z coordinates of ith sample, they are not the variable of interest that you want to check spatial autocorrelation appear in Moran's I definition:

I'm not sure you are also define the distance as the geographical distance in your case, but the distance in neighboring function doesn't have to be a geographical one, it just represents how far away between two samples depending on you own application.

-