Ⅰ. Introduction
GWR
GWR (Geographically Weighted Regression) is a statistical method used in Geographic Information Science (GIS) to explore spatial data relationships.
In real life, certain phenomena may vary based on geographical location. For instance, housing prices might be influenced by specific factors of the city they are located in. Unlike traditional regression models that assume a fixed relationship between each observation, regardless of spatial location, GWR takes into account the variations in model parameters due to geographical position.
Main Features:
1.Considering Geographical Location: Each geographical location has a regression equation, and the model parameters are allowed to vary spatially.
2.Weight Function: Regression parameters for each location are calculated using geographical weighting, where observations closer to the location have a greater influence on its regression parameters.
3.Model Interpretation: A parameter map can be generated to illustrate how a specific parameter varies with geographical location, aiding in the explanation of spatial variability.
4.Higher Complexity: It contributes to the exploration of spatial variability.The need for this level of complexity should be evaluated, along with ensuring ample data support.
Plugin Advantage
1.User-Friendly
Users only need to install R and the Processing R Provider plugin in QGIS. After copying the relevant program documentation to the specified path, it can be used. If adjustments are needed later on, the program documentation can be directly modified.
2.QGIS Variable Name Truncation Issue
When processing data, QGIS truncates variable names that exceed ten characters. However, in the parameter menu, the original full variable names are retained. Therefore, this procedure also truncates the variable names selected by the user in the manner of QGIS to prevent issues arising from discrepancies between the backend data variables in QGIS and the user's selection. Nevertheless, since QGIS's truncation method is related to the order of the variables, problems may still arise if the user's selected variable order differs from the original data's variable order.
Ⅱ. Installation Procedure
Step 1
Install QGIS & R
Step 2
After opening QGIS, click on 'Plugins' in the top menu, then select 'Manage and install Plugins'.
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_1.jpg)
Step 3
Search for 'Processing R Provider', then click on 'Install Plugin' > 'Close'.
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_2-1024x888.jpg)
Step 4
After restarting QGIS, click on 'Setting' > 'Options' in the top menu.
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_3.jpg)
Step 5
Click on 'Processing' > 'Providers' > 'R', and set the R folder path (e.g., C:\Program Files\R\R-4.3.1; the actual path may vary depending on the system, version, or directory).
※ If the installed version of R is 64-bit, make sure to check the 'Use 64-bit version' option.
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_4-1024x759.png)
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_5-1024x283.png)
Step 6
Open the folder named 'R scripts folder'.
※This folder is used to store GWR or other R program files (the path is under the QGIS installation directory).
Step 7
Add gwr.rsx and gwr.help program files under the R scripts folder directory.
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_6-1-1024x200.png)
Step 8
Restart QGIS and verify in the Processing ToolBox whether the R category and the GWmodel folder within it have been successfully installed. If you see the Geographical Weighted Regression program within the GWmodel category and it can be opened normally, it indicates the installation is complete.
※ If there's an issue when starting the Geographical Weighted Regression program, the problem might be with the R folder path from Step 2.
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_7-1024x544.png)
Ⅲ. Steps
Step 1 Import Data
● Import spatial point data or polygon data.
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_1-1024x544.png)
● After importing the data, launch the Geographical Weighted Regression process and select the input data in the Layer section.
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_2-1024x123.png)
Step 2 Select Parameters
This section is the primary user interface. Users can select the corresponding parameters and inputs based on their needs, and define the output data path.
● Dependent Variable
All variables are single-choice menus, allowing you to select the corresponding response variable according to your needs.
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_3-1024x98.png)
● Expanatory Variables
All variables are multiple-choice menus, allowing you to select the corresponding explanatory variables according to your needs.
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_4-3-1024x680.png)
● Selection of Kernel, Approach, and Fixed / Adaptive
Selecting the parameters for calculating bandwidth and the parameters for the subsequent model.
○ List of Kernel Functions – Gaussian, Exponential, Bisquare, Tricube, and Boxcar.
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_5-2-1024x232.png)
○ List of GWR Approach – CV, AIC, AICc, and BIC.
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_6-3-1024x201.png)
○ Fixed or Adaptive bandwidth
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_7-2.png)
● Selection of Other Parameters
All have default values and can be adjusted according to the situation.
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_8-1024x179.png)
● Output Data Path ( Floder Path )
Specify the data output path.
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_9-1024x89.png)
Step 3 Output Results
● Document Output
During the QGIS process, two main types of data are primarily output:
1. Scores for Different Bandwidths: Due to the selection of fixed bandwidth in the parameters and the choice based on CV scores, the output results will have different bandwidths and their corresponding scores (see lower left figure).
2. Model Results: You can view the basic information of the model (see lower right figure). This content will be simultaneously output as a document to the user's specified output path.
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_10.png)
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_11-1024x933.png)
● Data Output
1. When completing the procedure, a 'GWR_result' folder will be created in the path specified by the user (see lower left figure). This folder contains two main components:
1. "GWR_result.txt": Information document of the model (refer to the lower right figure).
2. Model output is in Shapefile format: It includes four files - 'GWR_result.shp', 'GWR_result.shx', 'GWR_result.dbf', and 'GWR_result.prj'. If users want to utilize these files, they can import the 'GWR_result.shp' file into QGIS (see lower right figure). After the process is completed, QGIS will add a new 'Output' layer, with content identical to that of the 'GWR_result.shp' file, both representing the model's output result.
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_12-1024x235.png)
![](https://gisplugin.geohealth.tw/wp-content/uploads/2023/08/image_13-1024x382.png)
For more information, you can refer the following:
[1] Chan, T. C., Chiang, P. H., Su, M. D., Wang, H. W., & Liu, M. S. Y. (2014). Geographic disparity in chronic obstructive pulmonary disease (COPD) mortality rates among the Taiwan population. PloS one, 9(5), e98170.
[2] Fotheringham, A. S., Crespo, R., & Yao, J. (2015). Geographical and temporal weighted regression (GTWR). Geographical Analysis, 47(4), 431-452.
[3] Nugroho, W. H., & Sumarminingsih, E. (2021, March). Geographically and Temporally Weighted Regression Model with Gaussian Kernel Weighted Function and Bisquare Kernel Weighted Function. In IOP Conference Series: Materials Science and Engineering (Vol. 1115, No. 1, p. 012063). IOP Publishing.
[4] Wu, B., Li, R., & Huang, B. (2014). A geographically and temporally weighted autoregressive model with application to housing prices. International Journal of Geographical Information Science, 28(5), 1186-1204.