# Bandwidth Selection

Video 1 : Bandwidth Selection

# Module Description

This module contains functions for automatic bandwidth selection to calibrate basic GW regression (bw.gwr), generalised GWR model (bw.ggwr), GW Principal Components Analysis (bw.gwpca), and GW Discriminant Analysis (bw.gwda)

# Argument

The arguments were taken from Gollini et al.[1]

Argument | bw.gwr | bw.ggwr | bw.gwda | bw.gwpca
--- | --- | --- | --- | ---
`Dependient` | ✔ | ✔ | ✔ | x
`Independient` | ✔ | ✔ | ✔ | x
`Family` | x | ✔ | x | x
`Approach` | ✔ | ✔ | x | x
`Kernel` | ✔ | ✔ | ✔ | ✔
`Power` | ✔ | ✔ | ✔ | ✔
`Theta` | ✔ | ✔ | ✔ | ✔
`Longlat` | ✔ | ✔ | ✔ | ✔
`Adaptative` | ✔ | ✔ | ✔ | ✔
`Cov.gw` | x | x | ✔ | x
`Prior.gw` | x | x | ✔ | x
`Mean.gw` | x | x | ✔ | x
`wqda` | x | x | ✔ | x
`Variables` | x | x | x | ✔
`Robust` | x | x | x | ✔

`Dependient`: Dependent variable of the regression model

`Independient`: Independent(s) variable(s) of the regression model.

`Family`: a description of the model’s error distribution and link function, which can be “poisson” or “binomial”.

`Approach`: specified by CV for cross-validation approach or by Akaike Information Criterion corrected (AICc) approach

`Kernel`: A set of five commonly used kernel functions;

Figure 1. Five kernel functions \(w_{ij}\) is the j-th element of the diagonal of the matrix of geographical weights W(\(u_i\),\(v_i\)), and \(d_{ij}\) is the distance between observations i and j, and b is the bandwidth.

`Power (Minkowski distance)`: the power of the Minkowski distance (p=1 is manhattan distance, p=2 is euclidean distance).

Figure 2. Minkowski distance

`Theta (Angle in radians)`: an angle in radians to rotate the coordinate system, default is 0

`longlat`: if TRUE, great circle distances will be calculated

`Adaptive`:If TRUE, find an adaptive kernel with a bandwidth proportional to the number of nearest neighbors (i.e. adaptive distance); otherwise, find a fixed kernel (bandwidth is a fixed distance)

`Cov.gw`:if TRUE, localised variance-covariance matrix is used for GW discriminant analysis; otherwise, global variance-covariance matrix is used

`Prior.gw`: if TRUE, localised prior probability is used for GW discriminant analysis; otherwise, fixed prior probability is used

`Mean.gw`: if true, localised mean is used for GW discriminant analysis; otherwise, global mean is used

`wqda` : if TRUE, a weighted quadratic discriminant analysis will be applied; otherwise a weighted linear discriminant analysis will be applied

`Variables`: a vector of variable names to be evaluated

`Robust`: if TRUE, robust GWPCA will be applied; otherwise basic GWPCA will be applied

# Value

Returns the adaptive or fixed distance bandwidth.

A critical issue is deciding between two types of spatial kernels: fixed kernels and adaptive kernels. A fixed kernel, by definition, uses a fixed bandwidth to define a region around all regression points. The distance to a given point determines the extent of the kernel, which is identical at any point in space. An adaptive kernel defines a region around points by using varying bandwidth. The number of nearest neighbors from a given regression point determines the kernel’s size. Where the data is sparse, the kernels have larger bandwidths.

Continuous kernels and kernels with compact support are two different types of kernel functions. The uniform, Gaussian, and exponential kernel functions are used to weight all data in the study region. Kernels with compact support are used to give nonzero weight to observations within a specific distance and zero weight to observations beyond that distance.

# References

[1] Gollini, I., Lu, B., Charlton, M., Brunsdon, C., & Harris, P. (2015). GWmodel: An R Package for Exploring Spatial Heterogeneity Using Geographically Weighted Models. Journal of Statistical Software, 63(17), 1–50. https://doi.org/10.18637/jss.v063.i17