gwr.sel {spgwr} | R Documentation |
The function finds a bandwidth for a given geographically weighted regression by optimzing a selected function. For cross-validation, this scores the root mean square prediction error for the geographically weighted regressions, choosing the bandwidth minimizing this quantity.
gwr.sel(formula, data=list(), coords, adapt=FALSE, gweight=gwr.Gauss, method = "cv", verbose = TRUE, longlat=FALSE, RMSE=FALSE, weights)
formula |
regression model formula as in lm |
data |
model data frame as in lm , or may be a SpatialPointsDataFrame or SpatialPolygonsDataFrame object as defined in package sp |
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
gwr.Gauss() default, or gwr.gauss() , the previous default or gwr.bisquare() |
method |
default "cv" for drop-1 cross-validation, or "aic" for AIC optimisation (depends on assumptions about AIC degrees of freedom) |
verbose |
if TRUE (default), reports the progress of search for bandwidth |
longlat |
if TRUE, use distances on an ellipse with WGS84 parameters |
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 |
weights |
case weights used as in weighted least squares, beware of scaling issues — only used with the cross-validation method, probably unsafe |
returns the cross-validation bandwidth.
Use of method="aic" results in the creation of an n by n matrix, and should not be chosen when n is large.
Roger Bivand Roger.Bivand@nhh.no
Fotheringham, A.S., Brunsdon, C., and Charlton, M.E., 2002, Geographically Weighted Regression, Chichester: Wiley; http://www.nuim.ie/ncg/GWR/index.htm
data(columbus) gwr.sel(crime ~ income + housing, data=columbus, coords=cbind(columbus$x, columbus$y)) gwr.sel(crime ~ income + housing, data=columbus, coords=cbind(columbus$x, columbus$y), gweight=gwr.bisquare)