Show Navigation | Hide Navigation
You are here:
Geoprocessing tool reference > Spatial Statistics toolbox > Analyzing Patterns toolset > Tools

Spatial Autocorrelation (Morans I) (Spatial Statistics)

Release 9.2
Last modified January 9, 2009
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Tools"


Related Topics

Measures spatial autocorrelation based on feature locations and attribute values.

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


Illustration

Attribute Similarity (Moran's I) illustration

Usage tips

Command line syntax
An overview of the Command Line window
SpatialAutocorrelation_stats <Input_Feature_Class> <Input_Field> <Display_Output_Graphically> <Inverse Distance | Inverse Distance Squared | Fixed Distance Band | Zone of Indifference | Polygon Contiguity (First Order) | Get Spatial Weights From File> <Euclidean Distance | Manhattan Distance> <None | Row > <Distance_Band_or_Threshold_Distance> {Weights_Matrix_File}

Parameter Explanation Data Type
<Input_Feature_Class>

The feature class for which spatial autocorrelation will be calculated.

Feature Layer
<Input_Field>

The numeric field used in measuring spatial autocorrelation.

Field
<Display_Output_Graphically>

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.

Boolean
<Inverse Distance | Inverse Distance Squared | Fixed Distance Band | Zone of Indifference | Polygon Contiguity (First Order) | Get Spatial Weights From File>

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.

String
<Euclidean Distance | Manhattan Distance>

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.

String
<None | Row >

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.

String
<Distance_Band_or_Threshold_Distance>

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.

Double
{Weights_Matrix_File}

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

File
Data types for geoprocessing tool parameters


Command line example

workspace e:\project93\data
SpatialAutocorrelation cancernm.shp RATE true 'Inverse Distance' 'Euclidean Distance' None # #

Scripting syntax
About getting started with writing geoprocessing scripts
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 Data Type
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.

Field
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.

Boolean
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.

String
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.

String
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.

String
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.

Double
Weights_Matrix_File (Optional)

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

File

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"

try:
    # 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]

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

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.