Spatial Autocorrelation (Global Moran's I) (Spatial Statistics)

License Level:BasicStandardAdvanced

Summary

Measures spatial autocorrelation based on feature locations and attribute values using the Global Moran's I statistic.

You can access the results of this tool (including the optional report file) from the Results window. If you disable background processing, results will also be written to the Progress dialog box.

Learn more about how Spatial Autocorrelation (Global Moran's I) works

Illustration

Global Moran's I illustration

Usage

Syntax

SpatialAutocorrelation_stats (Input_Feature_Class, Input_Field, {Generate_Report}, Conceptualization_of_Spatial_Relationships, Distance_Method, Standardization, {Distance_Band_or_Threshold_Distance}, {Weights_Matrix_File})
ParameterExplanationData Type
Input_Feature_Class

The feature class for which spatial autocorrelation will be calculated.

Feature Layer
Input_Field

The numeric field used in assessing spatial autocorrelation.

Field
Generate_Report
(Optional)
  • NO_REPORTNo graphical summary will be created (default).
  • GENERATE_REPORTA graphical summary will be created as an HTML file.
Boolean
Conceptualization_of_Spatial_Relationships

Specifies how spatial relationships among features are conceptualized.

  • INVERSE_DISTANCENearby neighboring features have a larger influence on the computations for a target feature than features that are far away.
  • INVERSE_DISTANCE_SQUAREDSame as INVERSE_DISTANCE except that the slope is sharper, so influence drops off more quickly, and only a target feature's closest neighbors will exert substantial influence on computations for that feature.
  • FIXED_DISTANCE_BANDEach feature is analyzed within the context of neighboring features. Neighboring features inside the specified critical distance receive a weight of 1 and exert influence on computations for the target feature. Neighboring features outside the critical distance receive a weight of zero and have no influence on a target feature's computations.
  • ZONE_OF_INDIFFERENCEFeatures within the specified critical distance of a target feature receive a weight of 1 and influence computations for that feature. Once the critical distance is exceeded, weights (and the influence a neighboring feature has on target feature computations) diminish with distance.
  • CONTIGUITY_EDGES_ONLYOnly neighboring polygon features that share a boundary or overlap will influence computations for the target polygon feature.
  • CONTIGUITY_EDGES_CORNERSPolygon features that share a boundary, share a node, or overlap will influence computations for the target polygon feature.
  • GET_SPATIAL_WEIGHTS_FROM_FILESpatial relationships are defined in a spatial weights file. The path to the spatial weights file is specified in the Weights Matrix File parameter.
String
Distance_Method

Specifies how distances are calculated from each feature to neighboring features.

  • EUCLIDEAN_DISTANCEThe straight-line distance between two points (as the crow flies)
  • MANHATTAN_DISTANCEThe distance between two points measured along axes at right angles (city block); calculated by summing the (absolute) difference between the x- and y-coordinates
String
Standardization

Row standardization is recommended whenever the distribution of your features is potentially biased due to sampling design or an imposed aggregation scheme.

  • NONENo standardization of spatial weights is applied.
  • ROWSpatial weights are standardized; each weight is divided by its row sum (the sum of the weights of all neighboring features).
String
Distance_Band_or_Threshold_Distance
(Optional)

Specifies a cutoff distance for Inverse Distance and Fixed Distance options. Features outside the specified cutoff for a target feature are ignored in analyses for that feature. However, for Zone of Indifference, the influence of features outside the given distance is reduced with distance, while those inside the distance threshold are equally considered. The distance value entered should match that of the output coordinate system.

For the Inverse Distance conceptualizations of spatial relationships, a value of 0 indicates that no threshold distance is applied; when this parameter is left blank, a default threshold value is computed and applied. This default value is the Euclidean distance that ensures every feature has at least one neighbor.

This parameter has no effect when Polygon Contiguity or Get Spatial Weights From File spatial conceptualizations are selected.

Double
Weights_Matrix_File
(Optional)

The path to a file containing weights that define spatial, and potentially temporal, relationships among features.

File

Code Sample

SpatialAutocorrelation example 1 (Python window)

The following Python window script demonstrates how to use the SpatialAutocorrelation tool.

import arcpy
arcpy.env.workspace = r"c:\data"
arcpy.SpatialAutocorrelation_stats("olsResults.shp", "Residual","NO_REPORT", 
                                   "GET_SPATIAL_WEIGHTS_FROM_FILE","EUCLIDEAN DISTANCE", 
                                   "NONE", "#","euclidean6Neighs.swm")
SpatialAutocorrelation example 2 (stand-alone Python script)

The following stand-alone Python script demonstrates how to use the SpatialAutocorrelation tool.

# Analyze the growth of regional per capita incomes in US
# Counties from 1969 -- 2002 using Ordinary Least Squares Regression

# Import system modules
import arcpy

# Set the geoprocessor object property to overwrite existing outputs
arcpy.gp.overwriteOutput = True

# Local variables...
workspace = r"C:\Data"

try:
    # Set the current workspace (to avoid having to specify the full path to the feature classes each time)
    arcpy.workspace = workspace

    # Growth as a function of {log of starting income, dummy for South
    # counties, interaction term for South counties, population density}
    # Process: Ordinary Least Squares... 
    ols = arcpy.OrdinaryLeastSquares_stats("USCounties.shp", "MYID", 
                        "olsResults.shp", "GROWTH",
                        "LOGPCR69;SOUTH;LPCR_SOUTH;PopDen69",
                        "olsCoefTab.dbf",
                        "olsDiagTab.dbf")

    # Create Spatial Weights Matrix (Can be based off input or output FC)
    # Process: Generate Spatial Weights Matrix... 
    swm = arcpy.GenerateSpatialWeightsMatrix_stats("USCounties.shp", "MYID",
                        "euclidean6Neighs.swm",
                        "K_NEAREST_NEIGHBORS",
                        "#", "#", "#", 6) 
                        

    # Calculate Moran's I Index of Spatial Autocorrelation for 
    # OLS Residuals using a SWM File.  
    # Process: Spatial Autocorrelation (Morans I)...      
    moransI = arcpy.SpatialAutocorrelation_stats("olsResults.shp", "Residual",
                        "NO_REPORT", "GET_SPATIAL_WEIGHTS_FROM_FILE", 
                        "EUCLIDEAN_DISTANCE", "NONE", "#", 
                        "euclidean6Neighs.swm")

except:
    # If an error occurred when running the tool, print out the error message.
    print arcpy.GetMessages()

Environments

Output Coordinate System

Feature geometry is projected to the Output Coordinate System prior to analysis. All mathematical computations are based on the Output Coordinate System spatial reference.

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
4/18/2013