Assign Weights By Pairwise Comparison (Analysis)

Summary

Calculates the relative weights for a set of input variables by comparing them in pairs.

Learn more about how Assign Weights By Pairwise Comparison works

Usage

  • This tool creates pairs from the input variables. Rank each pair by identifying the variable that is more important and by how much. The tool creates a comparison matrix from the rankings of the pairs. The relative weights for each variable is calculated from the matrix.

  • The Input Variables to Compare parameter value can be any names you provide. These names can represent raster or feature layer names, field names, or other variables to compare. The minimum number of variables is two and the maximum is nine.

  • There are some differences when using the tool in the Geoprocessing pane compared to Python. In the Geoprocessing pane, the pairs are created from the Input Variables to Compare parameter values. Click the Compare variables and calculate weights button to open the Pairwise Comparison Matrix window. The window displays the variable pairs along with a slider accompanying each pair. Adjust the sliders to specify which variable for each pairing is more important and by how much. As the sliders are moved, the comparison matrix is updated.

  • The comparisons are made using a 1 to 9 scale developed by Thomas Saaty (Saaty, 2008). The scale, their definitions, and explanations of each value in the scale as presented by Saaty are identified in the table below.

    Intensity of ImportanceDefinitionExplanation

    1

    Equal importance

    Two activities contribute equally to the objective.

    2

    Weak or slight

    3

    Moderate importance

    Experience and judgement slightly favor one activity over the another.

    4

    Moderate plus

    5

    Strong importance

    Experience and judgement strongly favor one activity over another.

    6

    Strong plus

    7

    Very strong or demonstrated importance

    An activity is favored very strongly over another; its dominance is demonstrated in practice.

    8

    Very, very strong

    9

    Extreme importance

    The evidence favoring one activity over another is of the highest possible order of affirmation.

    The values in the scale are multipliers. In a pairwise comparison, if one variable is twice as important as the other, move the slider to 2 toward the more important variable. However, this does not mean that the final weight for the variable will be twice as much as the other. The multiplier only applies to that pairwise comparison.

  • The Pairwise Comparison Matrix parameter control uses two interacting tables to create the comparison matrix. When a slider is moved, a comparison is made, the values in the Comparison Matrix table are updated, and the weights are recalculated. By default, all comparison evaluations are set to 1.

    Move the slider close to the desired evaluation and refine the comparison by clicking the slider bar to reach the specific value. The sliders increment by tenths when clicked.

  • In Python, you can create a file or table using a table or text editor (or from a previous run of the tool) and enter the resulting file as the comparison_matrix parameter value.

    Valid file formats for the comparison_matrix value include geodatabase table, dBASE (.dbf file), and comma-delimited files (.csv and .txt).

    The following is an example of a comparison matrix without weights created using a table editor:

    VariablesDist_RoadsElevationLanduseAspect

    Dist_Roads

    1

    0.333

    3

    1

    Elevation

    3

    1

    0.2

    3

    Landuse

    0.333

    5

    1

    7

    Aspect

    1

    0.333

    0.143

    1

    See Input comparison matrix formats for more examples of acceptable comparison matrices with and without weights.

  • Verify the consistency of the pair evaluations by clicking the Consistency button below the Comparison matrix in the Pairwise Comparison Matrix window. The consistency ratio (CR) will be displayed below the Comparison matrix. The CR should be below 0.1.

    If the CR is above 0.1, the CR value and the top three pairs that are most inconsistent will be highlighted in red. The evaluations for the inconsistent pairs can be adjusted to improve the consistency of the comparisons.

  • In Python, the variables are specified using the input_variables parameter. The pairwise comparisons are identified in the comparison_matrix parameter. The pairs and the evaluations for the comparisons can be directly specified. Alternatively, any file containing a valid comparison matrix created from a table or text editor (or an output table from the tool) can be entered.

    See Input comparison matrix formats for valid input comparison matrices.

  • The Output Table parameter value, contains the calculated weights for the input variables and optionally includes the pairwise comparison matrix.

    Valid output table types are geodatabase table, dBASE (.dbf), and comma-delimited files (.csv and .txt). By default, the output table will be a geodatabase table in a workspace. When the output table is in a file workspace, the output table will be a dBASE table by default.

    The following is an example of an output table when the Add comparison matrix to output parameter is checked.

    VariablesDist_RoadsElevationLanduseAspectWeights

    Dist_Roads

    1

    0.333

    3

    1

    0.253

    Elevation

    3

    1

    0.2

    3

    0.252

    Landuse

    0.333

    5

    1

    7

    0.407

    Aspect

    1

    0.333

    0.143

    1

    0.088

    For more examples of output tables formats with and without weights, see Output table formats.

  • The Add comparison matrix to output parameter identifies whether the output table is saved with or without the comparison matrix. When checked, the output table will contain both the pairwise comparison matrix and the calculated weights.

  • Saaty, T. L. 2008. "Decision making with the analytic hierarchy process". International Journal of Services Sciences, 1(1), 83-98.

Parameters

LabelExplanationData Type
Input Variables To Compare

The variable names that will be compared. Any name can be provided.

The minimum number of variables is two and the maximum is nine.

String
Output Table

The name of the output table that will contain calculated weights for the input variables. When the Add comparison matrix to output parameter is checked, the output table will also include the pairwise comparison matrix.

Table
Add comparison matrix to output
(Optional)

Specifies whether the Output Table parameter value will contain the pairwise comparison matrix.

  • Checked—The output table will contain both the pairwise comparison matrix and the calculated weights. This is the default.
  • Unchecked—The output table will only include the calculated weights.
Boolean
Pairwise Comparison Matrix
(Optional)

The pairwise comparison matrix that will be used when calculating the weights.

Use the sliders in the Pairwise Comparison Matrix window to identify which variable in each pairwise comparison is more important and by how much.

Pairwise Weights Table

arcpy.analysis.AssignWeightsByPairwiseComparison(input_variables, out_table, {add_comparison_matrix}, {comparison_matrix})
NameExplanationData Type
input_variables
[input_variables,...]

The variable names that will be compared. Any name can be provided.

The minimum number of variables is two and the maximum is nine.

String
out_table

The name of the output table that will contain calculated weights for the input variables. When the add_comparison_matrix parameter value is ADD_MATRIX, the output table will also include the pairwise comparison matrix.

Table
add_comparison_matrix
(Optional)

Specifies whether the out_table parameter value will contain the pairwise comparison matrix.

  • ADD_MATRIXThe output table will contain both the pairwise comparison matrix and the calculated weights. This is the default.
  • WEIGHTS_ONLYThe output table will only include the calculated weights.
Boolean
comparison_matrix
(Optional)

The pairwise comparison matrix that will be used when calculating the weights.

Define the pairwise comparisons by doing one of the following:

  • Provide a file containing a valid comparison matrix.
  • Specify the variable names and their comparisons.

The file can be a geodatabase table, dBASE (.dbf), or comma-delimited files (.csv and .txt).

Pairwise Weights Table

Code sample

AssignWeightsByPairwiseComparison example 1 (Python window)

This example demonstrates how to use this function in the Python window.

import arcpy
arcpy.env.workspace = "C:/data/data.gdb"
arcpy.analysis.AssignWeightsByPairwiseComparison("elev;landuse;dist_road;dist_line","output_weights","ADD_MATRIX","Variables elev landuse 0.333; elev dist_road 2.200; elev dist_line 2.70; landuse dist_road 1; landuse dist_line 1; dist_road dist_line 1" )
AssignWeightsByPairwiseComparison example 2 (stand-alone script)

The following sample calculates the weights for three variables by typing in the pairwise comparisons directly into a comparison matrix.

# Name: AssignWeightsbyPairwiseComparison.py
# Description: Calculates the weights for three variables using the
#              pairwise comparsion method.

# Import system module
import arcpy

# Set workspace environment
arcpy.env.workspace = "C:/data"

# Set local variables 
input_variables = "elev; landuse; dist_road"
outputTable = "outputweights.csv"
add_comparison_matrix = "WEIGHTS_ONLY"
comparison_matrix = "input_matrix.txt"
 
 
# Run Assign Weights By Pairwise Comparison
arcpy.analysis.AssignWeightsByPairwiseComparison(input_variables, outputTable, add_comparison_matrix, comparison_matrix)

Licensing information

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

Related topics