ggwr.sel {spgwr} | R Documentation |
Crossvalidation of bandwidth for generalised GWR
Description
The function finds a bandwidth for a given generalised geographically weighted regression by optimzing a selected function. For cross-validation, this scores the root mean square prediction error for the generalised geographically weighted regressions, choosing the bandwidth minimizing this quantity.
Usage
ggwr.sel(formula, data = list(), coords, adapt = FALSE, gweight = gwr.Gauss,
family = gaussian, verbose = TRUE, longlat = NULL, RMSE=FALSE,
tol=.Machine$double.eps^0.25)
Arguments
formula |
regression model formula as in |
data |
model data frame as in |
coords |
matrix of coordinates of points representing the spatial positions of the observations |
adapt |
either TRUE: find the proportion between 0 and 1 of observations to include in weighting scheme (k-nearest neighbours), or FALSE — find global bandwidth |
gweight |
geographical weighting function, at present
|
family |
a description of the error distribution and link function to
be used in the model, see |
verbose |
if TRUE (default), reports the progress of search for bandwidth |
longlat |
TRUE if point coordinates are longitude-latitude decimal degrees, in which case distances are measured in kilometers; if x is a SpatialPoints object, the value is taken from the object itself |
RMSE |
default FALSE to correspond with CV scores in newer references (sum of squared CV errors), if TRUE the previous behaviour of scoring by LOO CV RMSE |
tol |
the desired accuracy to be passed to |
Value
returns the cross-validation bandwidth.
Note
The use of GWR on GLM is only at the initial proof of concept stage, nothing should be treated as an accepted method at this stage.
Author(s)
Roger Bivand Roger.Bivand@nhh.no
References
Fotheringham, A.S., Brunsdon, C., and Charlton, M.E., 2002, Geographically Weighted Regression, Chichester: Wiley; http://gwr.nuim.ie/
See Also
Examples
if (require(sf)) {
xx <- as(st_read(system.file("shapes/sids.gpkg", package="spData")[1]), "Spatial")
bw <- ggwr.sel(SID74 ~ I(NWBIR74/BIR74) + offset(log(BIR74)), data=xx,
family=poisson(), longlat=TRUE)
bw
}