You are here:
Geoprocessing tool reference > Spatial Statistics toolbox > Analyzing Patterns toolset > Tools

# Spatial Autocorrelation (Morans I) (Spatial Statistics)

Release 9.2   Print all topics in : "Tools"

Measures spatial autocorrelation based on feature locations and attribute values.

Illustration Usage tips

• Given a set of features and an associated attribute, Global Moran's I evaluates whether the pattern expressed is clustered, dispersed, or random. When the Z score indicates statistical significance, a Moran's I value near +1.0 indicates clustering while a value near – 1.0 indicates dispersion.

• The Global Moran's I function also calculate a Z score value that indicates whether or not we can reject the null hypothsis. In this case, the null hypothesis states "there is no spatial clustering". In this tool, the Z Score is based on Randomization Null Hypothesis computation. For more information on Z scores, see What is a Z Score?.

• To determine if the Z score is statistically significant, compare it to the range of values for a particular confidence level. For example, at a significance level of 0.05, a z score would have to be less than – 1.96 or greater than 1.96 to be statistically significant.

• The Moran's I value and associated Z score are written to the Command window and passed as derived output.

• The input field you select should only contain positive numeric values. Negative weights will be converted to zero for the calculations.

• The values in the input field should have at least some variation. The statistic will not compute if the values have no variation (if they are all one value). If you have incident data, consider using the Collect Events tool before using this tool.

• The distance used for analysis should be based on your understanding of spatial interaction among the features being analyzed.

• The units of the "Distance Band or Threshold Distance" parameter are the units of the input feature class' coordinate system.

• Any value entered for the "Distance Band or Threshold Distance" parameter is not considered when "Inverse Distance", "Inverse Distance Squared", "Polygon Contiguity" or "Get Spatial Weights from File" are selected for the "Conceptualization of Spatial Relationships" parameter.

• When using the tool in scripting, use "false" for the Display Output Graphically parameter. If you do not select false, the popup graphic will appear and your script will not complete until you click "Close".

• When output is shown graphically, a separate graphics dialog box will be displayed. Therefore, the output should not be displayed graphically (set display_output_graphically to FALSE) in batch operations.

• For line and polygon features, feature centroids are used in the computations.

• Calculations are based on either Euclidean or Manhattan distance and require projected data to accurately measure distances.

• Current map layers may be used to define the input feature class. When using layers, only the currently selected features are used in the Moran's I operation.

• In ArcGIS version 9.2, the "Global" standardization option has been removed. Global standardization returns the same results as no standardization. Models built with previous versions of ArcGIS that use the Spatial Autocorrelation tool with the Global standardization option will need to be rebuilt.

• The "Display Output Graphically" parameter will only work on the windows operating system. When set to true it will display the results of the tool graphically.

• See the Modeling Spatial Relationships help page for further explanation of this tools parameters.

• The environment settings do not have an effect on this tool.

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 The feature class for which spatial autocorrelation will be calculated. Feature Layer The numeric field used in measuring spatial autocorrelation. Field 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 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 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 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 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
print "The z score of the nearest neighbor index is: " + nn_values

# 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
print "the z score of the General G value is: " + hlc_values

# 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
print "The z score of the Moran's I value is: " + sa_values

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.