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


Illustration

Attribute Similarity (Moran's I) illustration

Usage tips

Syntax

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 assessing 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 among features are conceptualized.

  • Inverse Distance—All features impact/influence all other features, but the farther away something is, the smaller the impact it has.
  • Inverse Distance Squared—Same 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 in computations for that feature.
  • Fixed Distance Band—Each feature is analyzed within the context of those neighboring features within some specified critical distance. Features outside the critical distance of a target feature do not influence calculations for that feature.
  • Zone of Indifference—Features within the specified critical distance of a target feature are included in analyses for that feature. Once the 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 on computations. Requires an ArcInfo license.
  • 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)

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

  • None—No standardization of spatial weights is applied.
  • Row—Spatial 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 (Required)

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 value entered should match those of the Output Coordinate System.For the Inverse Distance conceptualizations of spatial relationships: A value of zero for this parameter indicates that no threshold distance is applied; when this parameter is left blank, a default threshold value will be computed and applied.This parameter has no effect when "Polygon Contiguity" or "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 the spatial distribution of 911 calls in a metropolitan area
# using the Spatial Autocorrelation Tool (Global Moran's I)
# Import system modules
import arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create(9.3)
gp.OverwriteOutput = 1
# Local variables...
workspace = "C:\Data\911Calls"
try:

 # Set the current workspace (to avoid having to specify the full path to the feature classes each time)
    gp.workspace = workspace
    # Copy the input feature class and integrate the points to snap
    # together at 500 feet
    # Process: Copy Features and Integrate
    cf = gp.CopyFeatures("911Calls.shp", "911Copied.shp",
                         "#", 0, 0, 0)
    integrate = gp.Integrate("911Copied.shp #", "500 Feet")
    # Use Collect Events to count the number of calls at each location
    # Process: Collect Events
    ce = gp.CollectEvents("911Copied.shp", "911Count.shp", "Count", "#")
    # Add a unique ID field to the count feature class
    # Process: Add Field and Calculate Field
    af = gp.AddField("911Count.shp", "MyID", "LONG", "#", "#", "#", "#",
                     "NON_NULLABLE", "NON_REQUIRED", "#",
                     "911Count.shp")

    cf = gp.CalculateField("911Count.shp", "MyID", "[FID]", "VB")
    # Create Spatial Weights Matrix for Calculations
    # Process: Generate Spatial Weights Matrix... 
    swm = gp.GenerateSpatialWeightsMatrix("911Count.shp", "MYID",
                        "euclidean6Neighs.swm",
                        "K_NEAREST_NEIGHBORS",
                        "#", "#", "#", 6) 
    # Spatial Autocorrelation of 911 Calls
    # Process: Spatial Autocorrelation (Global Moran's I)
    hs = gp.SpatialAutocorrelation("911Count.shp", "ICOUNT", 
                        "false", 
                        "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 gp.GetMessages()

See Also

  • Average Nearest Neighbor (Spatial Statistics)
  • High/Low Clustering (Getis-Ord General G) (Spatial Statistics)
  • Cluster and Outlier Analysis: Anselin Local Moran's I (Spatial Statistics)
  • Modeling spatial relationships
  • What is a Z score What is a p-value