Directional Trend (Spatial Statistics)

Summary

Creates a scatter plot chart on a feature layer displaying the trend of data values in a particular direction.

Illustration

Directional Trend tool illustration
A scatter plot of northeast linear trend of data values is displayed.

Usage

  • The output is a scatter plot chart that is added to the input features. The input must be point or polygon features. For polygons, the centroids of the polygons will be used to create the chart. At least seven features are required. The input features will not be altered by the tool.

  • The tool requires an active map. This means, for example, that the tool cannot be used in a stand-alone Python script. If there is no active map, an error will be returned. If the input features are a feature layer in the active map, the chart will be added to the feature layer. In all other cases, a derived output feature layer will be added to the active map containing the chart.

  • The following are potential applications of the tool:

    • Determine how sentiment to immigration changes as you move north from the United States southern border.
    • Determine how precipitation levels change moving away from a coastline.
    • When performing geostatistical interpolation (kriging), the tool can be used to determine whether the data values have trends and which polynomial order should be used when performing trend removal.

  • The direction of the trend is provided as degrees clockwise from north. For example, 0 corresponds to north, 90 to east, 180 to south, and 270 to west. The direction will generally not correspond to true cardinal directions. For example, 0 corresponds to the direction of the y-coordinates of the features in their coordinate system, which will generally not be true north.

  • The tool will return messages displaying the R-squared and AIC values for each order of polynomial (1 through 6). If you provide a direction of trend, the values will be determined for that direction for each polynomial trend order. If you determine the direction of strongest trend, the direction of strongest trend will be determined for each polynomial order independently and will generally be different for each order. You can use the messages to determine which order of polynomial to use and either rerun the tool with the appropriate polynomial order or change the polynomial order in the Chart Properties pane of the chart.

  • Although the tool allows you to use up to a sixth order polynomial, it is rarely appropriate to use orders larger than three.

  • When determining the direction of strongest trend, the tool finds the direction that maximizes the R-squared value for the given direction of trend and polynomial trend order. The direction of strongest trend will be a whole number between 0 and 179. This is because adding 180 degrees to the direction will only reverse the x-axis and result in an identical R-squared value.

  • If the input features have a selection, the direction of strongest trend and associated messages will be determined only from the selected features. However, the chart will be created for the entire feature layer, not just the selected features. To view only the selected features in the chart, click the Filter By Selection button in the Chart pane.

  • To explore the trends in multiple directions, use batch geoprocessing to create multiple charts at different directions.

  • The x-axis of the scatter plot is created by rotating the coordinate system according to the direction of trend and finding the x-coordinates of the features in the rotated coordinate system. The x-axis values are rescaled to start at 0 and can be interpreted as distances along the rotated x-axis.

    Coordinate system rotation

    The coordinate system rotation is performed using the following transformation of the x- and y-coordinates of the features: x*cos(direction) + y*sin(direction). The direction is converted to counter-clockwise radians from east before applying the transformation.

  • If the input features are a feature layer in the active map, the directional trend chart will be added to the feature layer. If the input is a feature class on disk, a layer of the features will be added to the active map containing the chart.

Parameters

LabelExplanationData Type
Input Features

The input feature layer that will be used to calculate the directional trend. The input must be point or polygon features. For polygons, the centroids of the polygons will be used to create the chart.

Feature Layer
Analysis Field

The numeric field from the input feature layer that will be used to calculate the directional trend.

Field
Direction of Trend
(Optional)

The direction of the trend. Provide the value as degrees clockwise from north. For example, 0 corresponds to north, 90 to east, 180 to south, and 270 to west. The value must be between 0 and 360. The default is 0. This parameter does not apply if you choose to determine the direction of strongest trend.

The direction will generally not correspond to true cardinal directions. For example, 0 corresponds to the direction of the y-coordinates of the features, which may not be true north.

Double
Determine Direction of Strongest Trend
(Optional)

Specifies whether the direction of the strongest trend will be determined by the tool. The direction of strongest trend is determined by finding the direction that maximizes the R-squared value for the provided polynomial order. When this parameter is checked, the value will be rounded to a whole number between 0 and 179.

  • Checked—The direction of strongest trend will be determined by the tool.
  • Unchecked—The direction of trend will be the Direction of Trend parameter value. This is the default.

Boolean
Polynomial Trend Order
(Optional)

Specifies the order of the polynomial that will be fitted to the data values.

  • 1First order (linear) polynomial will be used.
  • 2Second order (quadratic) polynomial will be used.
  • 3Third order (cubic) polynomial will be used.
  • 4Fourth order (quartic) polynomial will be used.
  • 5Fifth order (quintic) polynomial will be used.
  • 6Sixth order (sextic) polynomial will be used.
Long

Derived Output

LabelExplanationData Type
Updated Input Features With Chart

The feature layer with the directional trend chart. If the input features are a feature layer in the active map, the value will be empty.

Feature Layer

arcpy.stats.DirectionalTrend(in_features, analysis_field, {direction}, {determine_direction}, {order})
NameExplanationData Type
in_features

The input feature layer that will be used to calculate the directional trend. The input must be point or polygon features. For polygons, the centroids of the polygons will be used to create the chart.

Feature Layer
analysis_field

The numeric field from the input feature layer that will be used to calculate the directional trend.

Field
direction
(Optional)

The direction of the trend. Provide the value as degrees clockwise from north. For example, 0 corresponds to north, 90 to east, 180 to south, and 270 to west. The value must be between 0 and 360. The default is 0. This parameter does not apply if you choose to determine the direction of strongest trend.

The direction will generally not correspond to true cardinal directions. For example, 0 corresponds to the direction of the y-coordinates of the features, which may not be true north.

Double
determine_direction
(Optional)

Specifies whether the direction of the strongest trend will be determined by the tool. The direction of strongest trend is determined by finding the direction that maximizes the R-squared value for the provided polynomial order. If you specify DETERMINE_DIRECTION, the value will be rounded to a whole number.

  • DETERMINE_DIRECTIONThe direction of strongest trend will be determined by the tool.
  • NO_DETERMINE_DIRECTIONThe direction of trend will be the direction parameter value. This is the default.
Boolean
order
(Optional)

Specifies the order of the polynomial that will be fitted to the data values.

  • 1First order (linear) polynomial will be used.
  • 2Second order (quadratic) polynomial will be used.
  • 3Third order (cubic) polynomial will be used.
  • 4Fourth order (quartic) polynomial will be used.
  • 5Fifth order (quintic) polynomial will be used.
  • 6Sixth order (sextic) polynomial will be used.
Long

Derived Output

NameExplanationData Type
updated_in_features

The feature layer with the directional trend chart. If the input features are a feature layer in the active map, the value will be empty.

Feature Layer

Code sample

DirectionalTrend example 1 (Python window)

The following Python script demonstrates how to use the DirectionalTrend function.

import arcpy
# Create chart of trend of data values in northeast direction.
arcpy.stats.DirectionalTrend(
    in_features="myFeatureLayer",
    analysis_field="myField",
    direction=45,
    determine_direction="NO_DETERMINE_DIRECTION",
    order=2
)

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics