# bw.gwer: Optimization of Bandwidth for Geographically Weighted... In gwer: Geographically Weighted Elliptical Regression

## Description

The function compute the optimal bandwidth for a given geographically weighted elliptical regression using three differents methods: cross-validation, AIC and spatial validation. This optimal bandwidth optimzing the selected function.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14``` ```bw.gwer( formula, family = Normal(), data, approach = "CV", kernel = "bisquare", adaptive = F, spdisp = "local", dispersion, p = 2, theta = 0, longlat = F, dMat ) ```

## Arguments

 `formula` regression model formula of a formula `object`. `family` a description of the error distribution to be used in the model (see `family.elliptical` for more details of family functions). `data` a SpatialPointsDataFrame or SpatialPolygonsDataFrame as defined in package sp. `approach` specified by CV for cross-validation approach, by AIC for corrected Akaike information criterion approach or by MI for spatial-validation approach. `kernel` function chosen as follows: gaussian: wgt = exp(-.5*(vdist/bw)^2); exponential: wgt = exp(-vdist/bw); bisquare: wgt = (1-(vdist/bw)^2)^2 if vdist < bw, wgt=0 otherwise; tricube: wgt = (1-(vdist/bw)^3)^3 if vdist < bw, wgt=0 otherwise; boxcar: wgt=1 if dist < bw, wgt=0 otherwise. `adaptive` if TRUE calculate an adaptive kernel where the bandwidth (bw) corresponds to the number of nearest neighbours (i.e. adaptive distance); default is FALSE, where a fixed kernel is found (bandwidth is a fixed distance). `spdisp` if TRUE, by default, the dispersion parameter vary geographically in estimation process. `dispersion` an optional fixed value for dispersion parameter. `p` the power of the Minkowski distance, default is 2 (Euclidean distance). `theta` an angle in radians to rotate the coordinate system, default is 0 `longlat` if TRUE, great circle distances will be calculated. `dMat` a pre-specified distance matrix, it can be calculated by the function `gw.dist`.

## Value

returns the bandwidth optimization value.

## References

Brunsdon, C., Fotheringham, A. S. and Charlton, M. E. (1996). Geographically weighted regression: a method for exploring spatial nonstationarity. Geographical analysis, 28(4), 281-298. doi: 10.1111/j.1538-4632.1996.tb00936.x

Cysneiros, F. J. A., Paula, G. A., and Galea, M. (2007). Heteroscedastic symmetrical linear models. Statistics & probability letters, 77(11), 1084-1090. doi: 10.1016/j.spl.2007.01.012

Fang, K. T., Kotz, S. and NG, K. W. (1990, ISBN:9781315897943). Symmetric Multivariate and Related Distributions. London: Chapman and Hall.

`gwer`, `elliptical`, `family.elliptical`
 ```1 2 3 4``` ```data(georgia, package="spgwr") fit.formula <- PctBach ~ TotPop90 + PctRural + PctFB + PctPov gwer.bw.n <- bw.gwer(fit.formula, data = gSRDF, family = Student(3), longlat = TRUE, adapt = TRUE) ```