Spatial Autocorrelation (Morans I) (Spatial Statistics)

Measures spatial autocorrelation based on feature locations and attribute values.

Learn more about how Spatial Autocorrelation: Moran's I works


Attribute Similarity (Moran's I) illustration

Usage Tips


SpatialAutocorrelation_stats (Input_Feature_Class, Input_Field, Display_Output_Graphically, Conceptualization_of_Spatial_Relationships, Distance_Method, Standardization, Distance_Band_or_Threshold_Distance, Weights_Matrix_File)
Parameter Explanation Datatype
Input Feature Class (Required)

The feature class for which spatial autocorrelation will be calculated.

Feature Layer
Input Field (Required)

The numeric field used in measuring spatial autocorrelation.

Display Output Graphically (Required)

Specifies whether the tool will display the Moran's I and z score values graphically.

  • True—The output will be displayed graphically.
  • False—The output will not be displayed graphically.

Conceptualization of Spatial Relationships (Required)

Specifies how spatial relationships between features are conceptualized.

  • Inverse Distance—The impact of one feature on another feature decreases with distance.
  • Inverse Distance Squared—Same as Inverse Distance, but the impact decreases more sharply over distance.
  • Fixed Distance Band—Everything within a specified critical distance is included in the analysis; everything outside the critical distance is excluded.
  • Zone of Indifference—A combination of Inverse Distance and Fixed Distance Band. Anything up to a critical distance has an impact on your analysis. Once that critical distance is exceeded, the level of impact quickly drops off.
  • Polygon Contiguity (First Order)—The neighbors of each feature are only those with which the feature shares a boundary. All other features have no influence.
  • Get Spatial Weights From File—Spatial relationships are defined in a spatial weights file. The pathname to the spatial weights file is specified in the Weights Matrix File parameter.

Distance Method (Required)

Specifies how distances are calculated when measuring spatial autocorrelation.

  • Euclidean (as the crow flies)—The straight-line distance between two points.
  • Manhattan (city block)—The distance between two points measured along axes at right angles. Calculated by summing the (absolute) differences between point coordinates.

Standardization (Required)

The standardization of spatial weights provides more accurate results.

  • None—No standardization of spatial weights is applied.
  • Row—Spatial weights are standardized by row. Each weight is divided by its row sum.

Distance Band or Threshold Distance (Required)

Specifies a distance cutoff value. When determining the neighbors for a particular feature, features outside the specified Distance Band or Threshold Distance are ignored in the cluster analysis. The value entered for this parameter should be in the units of the Input Feature Class' coordinate system.A value of zero indicates that no threshold distance is applied. This is only valid with the "Inverse Distance" and "Inverse Distance Squared" spatial conceptualizations.This parameter has no effect when "Polygon Contiguity" and "Get Spatial Weights From File" spatial conceptualizations are selected.

Weights Matrix File (Optional)

The pathname to a file containing spatial weights that define spatial relationships between features.

Data types for geoprocessing tool parameters

Script Example

# Analyze crime data to determine if spatial patterns are statistically significant

# Import system modules
import arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

# Local variables...
workspace = "C:/project93/data"
crime_data = "burglaries.shp"

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

    # Obtain Nearest Neighbor Ratio and Z Score
    # Process: Average Nearest Neighbor...
    nn_output = gp.AverageNearestNeighbor_stats(crime_data, "Euclidean Distance", "false", "#")
    nn_values = nn_output.split(";")
    print "The nearest neighbor index is: " + nn_values[0]
    print "The z score of the nearest neighbor index is: " + nn_values[1]

    # Obtain General G  and Z Score
    # Process: High/Low Clustering (Getis-Ord General G)...
    hlc_output = gp.HighLowClustering_stats(crime_data, "Count", "false", "Inverse Distance", "Euclidean Distance", "None", "#", "#")
    hlc_values = hlc_output.split(";")
    print "The General G value is: " + hlc_values[0]
    print "the z score of the General G value is: " + hlc_values[1]

    # Obtain Moran's Index and Z Score
    # Process: Spatial Autocorrelation (Morans I)...       
    sa_output = gp.SpatialAutocorrelation_stats(crime_data, "Count", "false", "Inverse Distance", "Euclidean Distance", "None", "#", "#")
    sa_values = sa_output.split(";")
    print "The Moran's I value is: " + sa_values[0]
    print "The z score of the Moran's I value is: " + sa_values[1]

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

See Also

  • Average Nearest Neighbor (Spatial Statistics)
  • High/Low Clustering (Getis-Ord General G) (Spatial Statistics)
  • Modeling spatial relationships