Title: | Displays GWR (Geographically Weighted Regression) and Mixed GWR Output and Map |
Version: | 1.1.1.5 |
Description: | Display processing results using the GWR (Geographically Weighted Regression) method, display maps, and show the results of the Mixed GWR (Mixed Geographically Weighted Regression) model which automatically selects global variables based on variability between regions. This function refers to Yasin, & Purhadi. (2012). "Mixed Geographically Weighted Regression Model (Case Study the Percentage of Poor Households in Mojokerto 2008)". European Journal of Scientific Research, 188-196. https://www.researchgate.net/profile/Hasbi-Yasin-2/publication/289689583_Mixed_geographically_weighted_regression_model_case_study_The_percentage_of_poor_households_in_Mojokerto_2008/links/58e46aa40f7e9bbe9c94d641/Mixed-geographically-weighted-regression-model-case-study-The-percentage-of-poor-households-in-Mojokerto-2008.pdf. |
License: | GPL-3 |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.1 |
LazyData: | true |
LazyDataCompression: | xz |
Author: | Asy-Syaja'ul Haqqul Amin [cre, aut], Waris Marsisno [aut] |
Maintainer: | Asy-Syaja'ul Haqqul Amin <haqqul.amin06@gmail.com> |
Imports: | spgwr, sf, psych, ggplot2, dplyr, tidyr |
Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
VignetteBuilder: | knitr |
Config/testthat/edition: | 3 |
Depends: | R (≥ 2.10) |
NeedsCompilation: | no |
Packaged: | 2024-05-17 16:08:05 UTC; User |
Repository: | CRAN |
Date/Publication: | 2024-05-17 16:30:02 UTC |
mgwrhw
Description
displays the GWR and mixed GWR models automatically along with the tests and significance maps that are formed.
Usage
mgwrhw(dpk, pers.reg, coor_lat, coor_long, vardep, GWRonly, kp, alp)
Arguments
dpk |
dataframe all variables that come from the shp data format and have geometric attributes that are usually imported with the st_read function from library(sf) |
pers.reg |
The form of the regression equation that will be used as a GWR model is in the general form y~x1+x2+x3 |
coor_lat |
the name of the variable that is in the dpk dataframe that contains latitude coordinates and is written with quotation marks such as "Latitude" which indicates a column named Latitude |
coor_long |
the name of the variable that is in the dpk dataframe that contains latitude coordinates and is written with quotation marks such as "Longitude" which indicates a column named Longitude |
vardep |
the name of a variable that is in a dpk dataframe that contains one dependent variable and is written with quotation marks such as "y" which indicates a column named y |
GWRonly |
user option to choose to display GWR results only or to form an MGWR model. Option 1 displays GWR output only while option 0 displays GWR and MGWR output. |
kp |
user option to select kernel functions. Option 1 for Fixed Bisquare, option 2 for Fixed Gaussian, option 3 for Adaptive Bisquare, and option 4 for Adaptive Bisquare |
alp |
alpha value (type 1 error) used in spatial regression model |
Value
no return value, called for side effects
This function returns a list with the following objects:
for Mixed GWR model (GWRonly = 0)
the general equation form of the Mixed GWR model is
y_{i}
= \beta_{0}
(u_{i}
,v_{i}
) + \sum
\beta_{k}
(u_{i}
,v_{i}
)x_{ik}
+ \sum
\beta_{k}
x_{ik}
+ \epsilon_{i}
- output
A character vector containing the captured output of GWR model and Mixed GWR model.
- gwr
The result of the GWR model include CV, bandwith, Quasi R square, etc.
- Variability.Test
Results of the variability test for global and local variables.
H_{0}
: \beta_{k}
(u_{1}
,v_{1}
) = \beta_{k}
(u_{2}
,v_{2}
) = ... = \beta_{k}
(u_{n}
,v_{n}
)
H_{1}
: not all \beta_{k}
(u_{i}
,v_{i}
) (i
= 1, 2, ..., n) are equal
F_{Variability.Test_{k}} = \frac{V^{2}_{k}{/}\gamma_{1}}{\widehat{\sigma}}
Conclusion : Reject H_{0}
if F_{Variability.Test_{k}}
\geq
F_{\alpha}
(\frac{\gamma_{1}^{2}}{\gamma_{2}},\frac{\delta_{1}^{2}}{\delta_{2}}
) or p-value < \alpha
.
If H_{0}
is rejected, it means that the k-th variable has a local influence, while if H_{0}
fails to be rejected, it means that the k-th variable has a global influence.
Reference : Leung, Y., Mei, C.L., & Zhang, W.X., (2000). "Statistic Tests for Spatial Non-Stationarity Based on the Geographically Weighted Regression Model", Environment and Planning A, 32 pp. 9-32. doi:10.1068/a3162.
- F1.F2.F3.mgwr.Test
Results of the F1(GoF Mixed GWR), F2(Global Simultaneous), F3(Local Simultaneous) tests.
F1(GoF Mixed GWR) :
H_{0}
: \beta_{k}
(u_{i}
,v_{i}
) = \beta_{k}
H_{1}
: at least there is one \beta_{k}
(u_{i}
,v_{i}
) \neq
\beta_{k}
F(1) = \frac{y^{T}((I-H)-(I-S)^{T}(I-S))y {/} v_{1}} {y^{T}(I-S)^{T}(I-S)y {/} u_{1}}
if H_{0}
is rejected, it shows that the Mixed GWR model is different from the OLS model]
F2(Global Simultaneous) :
H_{0}
: \beta_{q+1}
= \beta_{q+2}
= ... = \beta_{p}
= 0
H_{1}
: at least one of \beta_{k}
\neq
0
F(2) = \frac{y^{T}((I-S_{l})^{T}(I-S_{l})-(I-S)^{T}(I-S))y {/} r_{1}} {y^{T}(I-S)^{T}(I-S)y {/} u_{1}}
If H_{0}
is rejected, it indicates that there is at least one global variable that has a significant effect in the model
F3(Local Simultaneous)
H_{0}
: \beta_{1}
(u_{i}
,v_{i}
) = \beta_{2}
(u_{i}
,v_{i}
) = ... = \beta_{q}
(u_{i}
,v_{i}
) = 0
H_{1}
: at least one of \beta_{k}
(u_{i}
,v_{i}
) \neq
0
F(2) = \frac{y^{T}((I-S_{g})^{T}(I-S_{g})-(I-S)^{T}(I-S))y {/} r_{1}} {y^{T}(I-S)^{T}(I-S)y {/} u_{1}}
If H_{0}
is rejected, it indicates that there is at least one local variable that has a significant effect in the model
Reference : Yasin, & Purhadi. (2012). "Mixed Geographically Weighted Regression Model (Case Study the Percentage of Poor Households in Mojokerto 2008)". European Journal of Scientific Research, 188-196. https://www.researchgate.net/profile/Hasbi-Yasin-2/publication/289689583_Mixed_geographically_weighted_regression_model_case_study_The_percentage_of_poor_households_in_Mojokerto_2008/links/58e46aa40f7e9bbe9c94d641/Mixed-geographically-weighted-regression-model-case-study-The-percentage-of-poor-households-in-Mojokerto-2008.pdf.
- Global.Partial.Test
Results of the global partial test.
H_{0}
: \beta_{k}
= 0 (k-th global variables are not significant)
H_{1}
: \beta_{k}
\neq
0 (k-th global variables are significant)
T_{g} = \frac{\widehat{\beta_{k}}}{\widehat{\sigma}\sqrt{g_{kk}}}
If H_{0}
is rejected, it indicates that the k-th global variable has a significant effect
Reference : Yasin, & Purhadi. (2012). "Mixed Geographically Weighted Regression Model (Case Study the Percentage of Poor Households in Mojokerto 2008)". European Journal of Scientific Research, 188-196. https://www.researchgate.net/profile/Hasbi-Yasin-2/publication/289689583_Mixed_geographically_weighted_regression_model_case_study_The_percentage_of_poor_households_in_Mojokerto_2008/links/58e46aa40f7e9bbe9c94d641/Mixed-geographically-weighted-regression-model-case-study-The-percentage-of-poor-households-in-Mojokerto-2008.pdf.
- map.mgwr
Visualization of Mixed GWR results in the form of a regional map with variables that are significant globally and locally.
- Global_variable
A list of global variables used in the analysis.
- Local_variable
A list of local variables used in the analysis.
- AICc
The corrected Akaike Information Criterion.
- AIC
The Akaike Information Criterion.
- R_square
The coefficient of determination.
- adj_R_square
The adjusted coefficient of determination.
- table.mgwr
A data frame about output table of MGWR model (include estimator, standar error, t-statistics, p-value).
for GWR model (GWRonly = 1)
the general equation form of the GWR model is
y_{i}
= \beta_{0}
(u_{i}
,v_{i}
) + \sum
\beta_{k}
(u_{i}
,v_{i}
)x_{ik}
+ \epsilon_{i}
- output
A character vector containing the captured output of GWR model.
- gwr
A character vector containing the result of the GWR model include CV, bandwith, Quasi R square, etc.
- GoF.test
A character vector containing the results of the Godness of Fit Test.
- anova_gwr
Results of the anova table.
- map.gwr
Visualization of the GWR results.
- table.gwr
A data frame about output table of GWR model (include estimator, standar error, t-statistics, p-value).
Examples
mod1 = mgwrhw(dpk=redsb, pers.reg = Y ~ X2 + X4 + X5 + X6,
coor_lat = "Latitude", coor_long = "Longitude",
vardep = "Y", GWRonly = 0, kp = 3, alp = 0.05)
mod1$gwr
mod1$Variability.Test
mod1$Global_variable
mod1$Local_variable
mod1$F1.F2.F3.mgwr.Test
mod1$Global.Partial.Test
mod1$map.mgwr
Data to show stunting prevalence in every district from an island
Description
Data to show stunting prevalence in every district from an island
Usage
redsb
Format
An object of class sf
(inherits from data.frame
) with 33 rows and 15 columns.