Multiscale Geographically Weighted Regression (MGWR) (Spatial Statistics)

Summary

Performs Multiscale Geographically Weighted Regression (MGWR), which is a local form of linear regression that models spatially varying relationships.

MGWR builds upon geographically weighted regression (GWR). It is a local regression model that allows the coefficients of the explanatory variables to vary across space. Each explanatory variable may operate at a different spatial scale. GWR does not account for this, but MGWR does by allowing a different neighborhood (bandwidth) for each explanatory variable. The neighborhood (bandwidth) of an explanatory variable determines the features that are used to estimate the coefficient of that explanatory variable in the linear regression model that is fit at a target feature.

Learn more about how Multiscale Geographically Weighted Regression (MGWR) works

Illustration

Multiscale Geographically Weighted Regression tool illustration
A bisquare kernel is applied to the neighborhood of each explanatory variable. Each explanatory variable uses a different bandwidth to capture varying spatial relationships.

Usage

  • This tool is most effective for datasets with at least several hundred features. It is not an appropriate tool for small datasets. The tool does not work with multipoint data.

  • Use the Input Features parameter with a field representing the phenomena you are modeling (the Dependent Variable value) and one or more fields representing the Explanatory Variable(s) value. These fields must be numeric and include a range of values. Features that contain missing values in the dependent or explanatory variable will be excluded from the analysis; however, you can use the Fill Missing Values tool to complete the dataset before running the Multiscale Geographically Weighted Regression tool.

  • The current model only accepts dependent variables representing continuous values. Do not use the tool with count, rate, or binary (indicator) dependent variables. Currently, the Model Type parameter's Continuous option is the only supported option. Other options may be added in future releases.

    If a noncontinuous dependent variable is provided, the results may lack meaning, for example predictions with negative counts or probabilities larger than one.

    Caution:

    The explanatory variables (not dependent variable) can be any type, but use caution when using count, rate, or binary explanatory variables. Local regression models using noncontinuous explanatory variables frequently experience local multicollinearity problems. If any explanatory variables are highly correlated, either globally or locally, the tool may fail with error 110222 due to multicollinearity.

    Learn more about multicollinearity

  • There should be both global and local variation in the fields in the Dependent Variable and Explanatory Variables parameters. Do not use fields that contain a single constant value, indicator explanatory variables that represent different spatial regimes, or categorical variables that are spatially clustered.

  • To use categorical explanatory variables, the categories must be converted to indicator (0 or 1) variables using the Encode Field tool. You can then use these indicator variables as explanatory variables in the Multiscale Geographically Weighted Regression tool.

  • This tool outputs a feature class and adds fields with the local diagnostic values. The Output Features values and associated charts are automatically added to the table of contents with a diverging color scheme applied to the model residuals.

  • There are four options for the Neighborhood Selection Method parameter that can be used to estimate the optimal spatial scale for each of the explanatory variables:

    • Golden Search—Determines either the number of neighbors or distance band for each explanatory variable using the Golden Search algorithm. This method searches multiple combinations of values for each explanatory variable between a specified minimum and maximum value. The procedure is iterative and uses the results from previous values to select each new combination to be tested. The final values selected will have the smallest AICc. For the number of neighbors option, the minimum and maximum are specified using the Minimum Number of Neighbors and Maximum Number of Neighbors parameters. For the distance band option, the minimum and maximum are specified using the Minimum Search Distance and Maximum Search Distance parameters. The minimum and maximum values are shared for all explanatory variables, but the estimated number of neighbors or distance band will be different for each explanatory variable (unless two or more coincidentally have the same spatial scale). This option takes the longest time to calculate, especially for large or high-dimensional datasets.

    • Gradient Search—Determines the number of neighbors or distance band for each explanatory variable using a gradient-based optimization algorithm. To find the optimal bandwidth of each explanatory variable, Gradient Search takes the derivative of the AICc with respect to the bandwidths and updates the bandwidths until it finds the lowest AICc. For the number of neighbors option, the minimum and maximum are specified using the Minimum Number of Neighbors and Maximum Number of Neighbors parameters. For the Distance Band option, the minimum and maximum are specified using the Minimum Search Distance and Maximum Search Distance parameters. Like Golden Search, the minimum and maximum values are shared for all explanatory variables, but the estimated number of neighbors or distance band may be different for each explanatory variable (unless two or more coincidentally have the same spatial scale). This option estimates comparable neighborhoods to Golden Search but has a better runtime performance and requires significantly less memory usage.

    • Manual Intervals—Determines the number of neighbors or distance band for each explanatory variable by incrementing the number of neighbors or distance band from a minimum value. For the number of neighbors option, the method starts with the value of the Minimum Number of Neighbors parameter. The number of neighbors is then increased by the value of the Number of Neighbors Increment parameter. This increment is repeated a certain number of times, specified using the Number of Increments parameter. For the distance band option, the method uses the Minimum Search Distance, Search Distance Increment, and Number of Increments parameters. The number of neighbors or distance band used by each explanatory variable will be one of the tested values, but the values may be different for each explanatory variable. This option is faster than Golden Search and frequently estimates comparable neighborhoods.

    • User Defined—The number of neighbors or distance band that is used by all explanatory variables. The value is specified using the Number of Neighbors or Distance Band parameter. This option provides the most control if you know the optimal values.

    By default, the dependent neighborhood parameters of each neighborhood selection method apply to all explanatory variables. However, customized neighborhood selection parameters can be provided for particular explanatory variables using the corresponding override parameter for the neighborhood type and selection method: Number of Neighbors for Golden Search, Number of Neighbors for Gradient Search, Number of Neighbors for Manual Intervals, User Defined Number of Neighbors, Search Distance for Golden Search, Search Distance for Gradient Search, Search Distance for Manual Intervals, or User Defined Search Distance. To use customized neighborhoods for particular explanatory variables, provide the explanatory variables in the first column of the corresponding override parameter, and provide the customized options of the neighborhood in the other columns. The columns have the same names as the parameters they override; for example, if you are using manual intervals with distance band, the Search Distance Increment column specifies customized values of the Search Distance Increment parameter. In the Geoprocessing pane, customized neighborhood parameters are in the Customized Neighborhood Options parameter category.

    For example, suppose you use three explanatory variables with the Golden Search neighborhood type with 30 minimum neighbors and 40 maximum neighbors. If the tool is run with these parameters, each of the three explanatory variables will use between 30 and 40 neighbors. If you instead want to use between 45 and 55 neighbors for only the second explanatory variable, you can provide the second explanatory variable, the custom minimum, and the custom maximum in the columns of the Number of Neighbors for Golden Search parameter. With these parameters, the first and third explanatory variables will use between 30 and 40 neighbors, and the second explanatory variable will use between 45 and 55 neighbors.

  • Several model diagnostics are shown in the geoprocessing messages that can be used to assess the reliability of the MGWR model. Review these diagnostics before viewing any other tool outputs. If the model diagnostics are acceptable, view the charts and symbology of the output features to better understand the results.

    Learn more about model diagnostics and tool outputs

  • Evaluate the results and consider whether the relationship between each explanatory variable and the dependent variable is linear, any explanatory variables are missing (misspecification) or redundant (multicollinearity), there are outliers, or the residuals are not normally distributed. To learn more about potential regression model issues, see Regression analysis basics.

  • For the most accurate results, project the data to a projected coordinate system if the coordinates are stored as latitude and longitude. This is especially important when using the Distance Band option of the Neighborhood Type parameter because the optimizations require accurate measures of distance.

  • If you check the Scale Data parameter, a layer will be created for each scaled coefficient. The coefficients that are rescaled to original data units are stored as fields in the output feature class. If coefficient rasters are created with the Coefficient Raster Workspace parameter, layers will be created of the scaled coefficient rasters, and the rescaled rasters will be saved in the workspace.

    It is recommended that you scale the explanatory and dependent variables. This is especially important when the range of values of the variables vary significantly because scaling equalizes the variances of the values of the explanatory variables. When numerically estimating the bandwidth and coefficients of each local model, the estimations usually converge faster and to more accurate values when each variable contributes equal amounts to the total variance of the data. If the explanatory variables have different variances, the variables with larger variances have more influence on each step of the iterative estimation. In most cases, this influence will negatively affect the final bandwidths and coefficients for the model.

  • In some cases, the Manual Interval option for the Neighborhood Selection Method parameter may estimate a lower AICc value than the Golden Search option even when searching the same range of distances or neighbors. Similarly, if you perform Golden Search or manual intervals and then provide the estimated bandwidths or numbers of neighbors using the User Defined option, the outputs will not be exactly the same. Both of these behaviors are due to the path dependencies of the Golden Search and backfitting algorithms that are used to estimate MGWR model parameters. To reproduce the same MGWR results, you must run the tool with all the same parameter settings.

Parameters

LabelExplanationData Type
Input Features

The feature class containing the dependent and explanatory variables.

Feature Layer
Dependent Variable

The numeric field containing the observed values that will be modeled.

Field
Model Type

Specifies the regression model based on the values of the dependent variable. Currently, only continuous data is supported, and the parameter is hidden in the Geoprocessing pane. Do not use categorical, count, or binary dependent variables.

  • ContinuousThe dependent variable represents continuous values. This is the default.
String
Explanatory Variables

A list of fields that will be used as independent explanatory variables in the regression model.

Field
Output Features

The new feature class containing the coefficients, residuals, and significance levels of the MGWR model. The feature class will be added to the Contents pane in a group layer.

Feature Class
Neighborhood Type

Specifies whether the neighborhood will be a fixed distance or allowed to vary spatially depending on the density of the features.

  • Number of Neighbors The neighborhood size will be a specified number of closest neighbors for each feature. Where features are dense, the spatial extent of the neighborhood will be smaller; where features are sparse, the spatial extent of the neighborhood will be larger.
  • Distance BandThe neighborhood size will be a constant or fixed distance for each feature.
String
Neighborhood Selection Method

Specifies how the neighborhood size will be determined.

  • Golden SearchAn optimal distance or number of neighbors will be identified by minimizing the AICc value using the Golden Search algorithm. This option takes the longest time to calculate, especially for large or high-dimensional datasets.
  • Gradient SearchAn optimal distance or number of neighbors will be identified by minimizing the AICc value using the gradient-based optimization algorithm. This option runs the fastest and requires significantly less memory usage than Golden Search.
  • Manual Intervals A distance or number of neighbors will be identified by testing a range of values and determining the value with the smallest AICc. If the Neighborhood Type parameter is set to Distance Band, the minimum value of this range is provided by the Minimum search distance parameter. The minimum value is then incremented by the value specified in the Search Distance Increment parameter. This is repeated the number of times specified by the Number of Increments parameter. If the Neighborhood Type parameter is set to Number of Neighbors, the minimum value, increment size, and number of increments are provided in the Minimum Number of Neighbors, Number of Neighbors Increment, and Number of Increments parameters, respectively.
  • User DefinedThe neighborhood size will be specified by either the Number of Neighbors parameter value or the Distance Band parameter value.
String
Minimum Number of Neighbors
(Optional)

The minimum number of neighbors that each feature will include in its calculation. It is recommended that you use at least 30 neighbors.

Long
Maximum Number of Neighbors
(Optional)

The maximum number of neighbors that each feature will include in its calculations.

Long
Distance Unit
(Optional)

Specifies the unit of distance that will be used to measure the distances between features.

  • International FeetDistances will be measured in international feet.
  • Statute MilesDistances will be measured in statute miles.
  • US Survey FeetDistances will be measured in US survey feet.
  • MetersDistances will be measured in meters.
  • KilometersDistances will be measured in kilometers.
  • US Survey MilesDistances will be measured in US survey miles.
String
Minimum Search Distance
(Optional)

The minimum search distance that will be applied to every explanatory variable. It is recommended that you provide a minimum distance that includes at least 30 neighbors for each feature.

Double
Maximum Search Distance
(Optional)

The maximum neighborhood search distance that will be applied to all variables.

Double
Number of Neighbors Increment
(Optional)

The number of neighbors by which manual intervals will increase for each neighborhood test.

Long
Search Distance Increment
(Optional)

The distance by which manual intervals will increase for each neighborhood test.

Double
Number of Increments
(Optional)

The number of neighborhood sizes to test when using manual intervals. The first neighborhood size is the value of the Minimum Number of Neighbors or Minimum Search Distance parameter.

Long
Number of Neighbors
(Optional)

The number of neighbors that will be used for the user-defined neighborhood type.

Long
Distance Band
(Optional)

The size of the distance band that will be used for the user-defined neighborhood type. All features within this distance will be included as neighbors in the local models.

Double
Number of Neighbors for Golden Search
(Optional)

The customized Golden Search options for individual explanatory variables. For each explanatory variable to be customized, provide the variable, the minimum number of neighbors, and the maximum number of neighbors in the columns.

Value Table
Number of Neighbors for Manual Intervals
(Optional)

The customized manual intervals options for individual explanatory variables. For each explanatory variable to be customized, provide the minimum number of neighbors, number of neighbors increment, and number of increments in the columns.

Value Table
User Defined Number of Neighbors
(Optional)

The customized user-defined options for individual explanatory variables. For each explanatory variable to be customized, provide the number of neighbors.

Value Table
Search Distance for Golden Search
(Optional)

The customized Golden Search options for individual explanatory variables. For each explanatory variable to be customized, provide the variable, the minimum search distance, and the maximum search distance in the columns.

Value Table
Search Distance for Manual Intervals
(Optional)

The customized manual intervals options for individual explanatory variables. For each variable to be customized, provide the variable, the minimum search distance, search distance increments, and number of increments in the columns.

Value Table
User Defined Search Distance
(Optional)

The customized user-defined options for individual explanatory variables. For each variable to be customized, provide the variable and the distance band in the columns.

Value Table
Prediction Locations
(Optional)

A feature class with the locations where estimates will be computed. Each feature in this dataset should contain a value for every explanatory variables specified. The dependent variable for these features will be estimated using the model calibrated for the input feature class data. These feature locations should be close to (within 115 percent of the extent) or within the same study area as the input features.

Feature Layer
Explanatory Variables to Match
(Optional)

The explanatory variables from the prediction locations that match corresponding explanatory variables from the input features.

Value Table
Output Predicted Features
(Optional)

The output feature class that will receive dependent variable estimates for every prediction location.

Feature Class
Robust Prediction
(Optional)

Specifies the features that will be used in the prediction calculations.

  • Checked—Features with values greater than three standard deviations from the mean (value outliers) and features with weights of 0 (spatial outliers) will be excluded from the prediction calculations but will receive predictions in the output feature class. This is the default.
  • Unchecked—Every feature will be used in the prediction calculations.

Boolean
Local Weighting Scheme
(Optional)

Specifies the kernel type that will be used to provide the spatial weighting in the model. The kernel defines how each feature is related to other features within its neighborhood.

  • BisquareA weight of zero will be assigned to any feature outside the neighborhood specified. This is the default.
  • GaussianAll features will receive weights, but weights become exponentially smaller the farther away they are from the target feature.
String
Output Neighborhood Table
(Optional)

A table containing the output statistics of the MGWR model. A bar chart of estimated bandwidths or numbers of neighbors will be included with the output.

Table
Coefficient Raster Workspace
(Optional)

The workspace where the coefficient rasters will be created. When this workspace is provided, rasters are created for the intercept and every explanatory variable. This parameter is only available with a Desktop Advanced license. If a directory is provided, the rasters will be TIFF (.tif) raster type.

Workspace
Scale Data
(Optional)

Specifies whether the values of the explanatory and dependent variables will be standardized (also called Z-score standardization) to have a mean zero and a standard deviation one prior to fitting the model.

  • Checked—The values of the variables will be scaled. The results will contain scaled and unscaled versions of the explanatory variable coefficients.
  • Unchecked—The values of the variables will not be scaled. All coefficients will be unscaled and in original data units.

Boolean
Number of Neighbors for Gradient Search
(Optional)

The customized Gradient Search options for individual explanatory variables. For each explanatory variable to be customized, provide the variable, the minimum number of neighbors, and the maximum number of neighbors in the columns.

Value Table
Search Distance for Gradient Search
(Optional)

The customized Gradient Search options for individual explanatory variables. For each explanatory variable to be customized, provide the variable, the minimum search distance, and the maximum search distance in the columns.

Value Table

Derived Output

LabelExplanationData Type
Coefficient Raster Layers

The output rasters of explanatory variable coefficients.

Raster
Output Layer Group

A group layer of the outputs. The group layer name is the Output Features parameter value with _MGWR_Results appended to the end. It contains the standardized residual and a separate sub-group layer for each explanatory variable. Each sub-group layer includes a Coefficient layer and a Significance layer. The group layer will be added to the Contents pane.

Group Layer

arcpy.stats.MGWR(in_features, dependent_variable, model_type, explanatory_variables, output_features, neighborhood_type, neighborhood_selection_method, {minimum_number_of_neighbors}, {maximum_number_of_neighbors}, {distance_unit}, {minimum_search_distance}, {maximum_search_distance}, {number_of_neighbors_increment}, {search_distance_increment}, {number_of_increments}, {number_of_neighbors}, {distance_band}, {number_of_neighbors_golden}, {number_of_neighbors_manual}, {number_of_neighbors_defined}, {distance_golden}, {distance_manual}, {distance_defined}, {prediction_locations}, {explanatory_variables_to_match}, {output_predicted_features}, {robust_prediction}, {local_weighting_scheme}, {output_table}, {coefficient_raster_workspace}, {scale}, {number_of_neighbors_gradient}, {distance_gradient})
NameExplanationData Type
in_features

The feature class containing the dependent and explanatory variables.

Feature Layer
dependent_variable

The numeric field containing the observed values that will be modeled.

Field
model_type

Specifies the regression model based on the values of the dependent variable. Currently, only continuous data is supported, and the parameter is hidden in the Geoprocessing pane. Do not use categorical, count, or binary dependent variables.

  • CONTINUOUSThe dependent variable represents continuous values. This is the default.
String
explanatory_variables
[explanatory_variables,...]

A list of fields that will be used as independent explanatory variables in the regression model.

Field
output_features

The new feature class containing the coefficients, residuals, and significance levels of the MGWR model.

Feature Class
neighborhood_type

Specifies whether the neighborhood will be a fixed distance or allowed to vary spatially depending on the density of the features.

  • NUMBER_OF_NEIGHBORS The neighborhood size will be a specified number of closest neighbors for each feature. Where features are dense, the spatial extent of the neighborhood will be smaller; where features are sparse, the spatial extent of the neighborhood will be larger.
  • DISTANCE_BANDThe neighborhood size will be a constant or fixed distance for each feature.
String
neighborhood_selection_method

Specifies how the neighborhood size will be determined.

  • GOLDEN_SEARCHAn optimal distance or number of neighbors will be identified by minimizing the AICc value using the Golden Search algorithm. This option takes the longest time to calculate, especially for large or high-dimensional datasets.
  • GRADIENT_SEARCHAn optimal distance or number of neighbors will be identified by minimizing the AICc value using the gradient-based optimization algorithm. This option runs the fastest and requires significantly less memory usage than Golden Search.
  • MANUAL_INTERVALSA distance or number of neighbors will be identified by testing a range of values and determining the value with the smallest AICc. If the neighborhood_type parameter is set to DISTANCE_BAND, the minimum value of this range is provided by the minimum_search_distance parameter. The minimum value is then incremented by the value specified in the search_distance_increment parameter. This is repeated the number of times specified by the number_of_increments parameter. If the neighborhood_type parameter is set to NUMBER_OF_NEIGHBORS, the minimum value, increment size, and number of increments are provided by the minimum_number_of_neighbors, number_of_neighbors_increment, and number_of_increments parameters, respectively.
  • USER_DEFINED The neighborhood size will be specified by either the number_of_neighbors parameter value or the distance_band parameter value.
String
minimum_number_of_neighbors
(Optional)

The minimum number of neighbors that each feature will include in its calculation. It is recommended that you use at least 30 neighbors.

Long
maximum_number_of_neighbors
(Optional)

The maximum number of neighbors that each feature will include in its calculations.

Long
distance_unit
(Optional)

Specifies the unit of distance that will be used to measure the distances between features.

  • FEETINTDistances will be measured in international feet.
  • MILESINTDistances will be measured in statute miles.
  • FEETDistances will be measured in US survey feet.
  • METERSDistances will be measured in meters.
  • KILOMETERSDistances will be measured in kilometers.
  • MILESDistances will be measured in US survey miles.
String
minimum_search_distance
(Optional)

The minimum search distance that will be applied to every explanatory variable. It is recommended that you provide a minimum distance that includes at least 30 neighbors for each feature.

Double
maximum_search_distance
(Optional)

The maximum neighborhood search distance that will be applied to all variables.

Double
number_of_neighbors_increment
(Optional)

The number of neighbors by which manual intervals will increase for each neighborhood test.

Long
search_distance_increment
(Optional)

The distance by which manual intervals will increase for each neighborhood test.

Double
number_of_increments
(Optional)

The number of neighborhood sizes to test when using manual intervals. The first neighborhood size is the value of the minimum_number_of_neighbors or minimum_search_distance parameter.

Long
number_of_neighbors
(Optional)

The number of neighbors that will be used for the user-defined neighborhood type.

Long
distance_band
(Optional)

The size of the distance band that will be used for the user-defined neighborhood type. All features within this distance will be included as neighbors in the local models.

Double
number_of_neighbors_golden
[number_of_neighbors_golden,...]
(Optional)

The customized Golden Search options for individual explanatory variables. For each explanatory variable to be customized, provide the variable, the minimum number of neighbors, and the maximum number of neighbors in the columns.

Value Table
number_of_neighbors_manual
[number_of_neighbors_manual,...]
(Optional)

The customized manual intervals options for individual explanatory variables. For each explanatory variable to be customized, provide the minimum number of neighbors, number of neighbors increment, and number of increments in the columns.

Value Table
number_of_neighbors_defined
[number_of_neighbors_defined,...]
(Optional)

The customized user-defined options for individual explanatory variables. For each explanatory variable to be customized, provide the number of neighbors.

Value Table
distance_golden
[distance_golden,...]
(Optional)

The customized Golden Search options for individual explanatory variables. For each explanatory variable to be customized, provide the variable, the minimum search distance, and the maximum search distance in the columns.

Value Table
distance_manual
[distance_manual,...]
(Optional)

The customized manual intervals options for individual explanatory variables. For each variable to be customized, provide the variable, the minimum search distance, search distance increments, and number of increments in the columns.

Value Table
distance_defined
[distance_defined,...]
(Optional)

The customized user-defined options for individual explanatory variables. For each variable to be customized, provide the variable and the distance band in the columns.

Value Table
prediction_locations
(Optional)

A feature class with the locations where estimates will be computed. Each feature in this dataset should contain a value for every explanatory variables specified. The dependent variable for these features will be estimated using the model calibrated for the input feature class data. These feature locations should be close to (within 115 percent of the extent) or within the same study area as the input features.

Feature Layer
explanatory_variables_to_match
[explanatory_variables_to_match,...]
(Optional)

The explanatory variables from the prediction locations that match corresponding explanatory variables from the input features.

Value Table
output_predicted_features
(Optional)

The output feature class that will receive dependent variable estimates for every prediction location.

Feature Class
robust_prediction
(Optional)

Specifies the features that will be used in the prediction calculations.

  • ROBUSTFeatures with values greater than three standard deviations from the mean (value outliers) and features with weights of 0 (spatial outliers) will be excluded from the prediction calculations but will receive predictions in the output feature class. This is the default.
  • NON_ROBUSTEvery feature will be used in the prediction calculations.
Boolean
local_weighting_scheme
(Optional)

Specifies the kernel type that will be used to provide the spatial weighting in the model. The kernel defines how each feature is related to other features within its neighborhood.

  • BISQUAREA weight of zero will be assigned to any feature outside the neighborhood specified. This is the default.
  • GAUSSIANAll features will receive weights, but weights become exponentially smaller the farther away they are from the target feature.
String
output_table
(Optional)

A table containing the output statistics of the MGWR model. A bar chart of estimated bandwidths or numbers of neighbors will be included with the output.

Table
coefficient_raster_workspace
(Optional)

The workspace where the coefficient rasters will be created. When this workspace is provided, rasters are created for the intercept and every explanatory variable. This parameter is only available with a Desktop Advanced license. If a directory is provided, the rasters will be TIFF (.tif) raster type.

Workspace
scale
(Optional)

Specifies whether the values of the explanatory and dependent variables will be scaled to have mean zero and standard deviation one prior to fitting the model.

  • SCALE_DATAThe values of the variables will be scaled. The results will contain scaled and unscaled versions of the explanatory variable coefficients.
  • NO_SCALE_DATAThe values of the variables will not be scaled. All coefficients will be unscaled and in original data units.
Boolean
number_of_neighbors_gradient
[number_of_neighbors_gradient,...]
(Optional)

The customized Gradient Search options for individual explanatory variables. For each explanatory variable to be customized, provide the variable, the minimum number of neighbors, and the maximum number of neighbors in the columns.

Value Table
distance_gradient
[distance_gradient,...]
(Optional)

The customized Gradient Search options for individual explanatory variables. For each explanatory variable to be customized, provide the variable, the minimum search distance, and the maximum search distance in the columns.

Value Table

Derived Output

NameExplanationData Type
coefficient_raster_layers

The output rasters of explanatory variable coefficients.

Raster
output_layer_group

A group layer of the outputs. The group layer name is the Output Features parameter value with _MGWR_Results appended to the end. It contains the standardized residual and a separate sub-group layer for each explanatory variable. Each sub-group layer includes a Coefficient layer and a Significance layer. The group layer will be added to the Contents pane.

Group Layer

Code sample

MGWR example 1: (Python window)

The following Python window script demonstrates how to use the MGWR function.


import arcpy
arcpy.stats.MGWR("r\data.gdb\house_price", "price", "CONTINUOUS", 
                 "review;beds;areas", r"data.gdb\house_price_fit_model", 
                 "DISTANCE_BAND", "GOLDEN_SEARCH", None, None, None, None, 
                 None, None, None, None, None, None, None, None, None, 
                 "review # #;beds # #; areas # #", None, None, 
                 r"data.gdb\house_price", "review review;beds beds; areas areas", 
                 r"data.gdb\house_price_prediction", "ROBUST", "BISQUARE")
MGWR example 2 (stand-alone script)

The following stand-alone Python script demonstrates how to use the MGWR function.

# Run MGWR to predict house prices using "Number of Neighbors" and "Golden Search"
# Import modules
import arcpy

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

# Run MGWR 
arcpy.stats.MGWR("r\data.gdb\house_price", "price", "CONTINUOUS", 
                 "review;beds;areas", r"data.gdb\house_price_fit_model", 
                 "DISTANCE_BAND", "GOLDEN_SEARCH", None, None, None, None, 
                 None, None, None, None, None, None, None, None, None, 
                 "review # #;beds # #; areas # #", None, None, 
                 r"data.gdb\house_price", "review review;beds beds; areas areas", 
                 r"data.gdb\house_price_prediction", "ROBUST", "BISQUARE")

Related topics