ggwr.Rd
The function implements generalised geographically weighted regression approach to exploring spatial non-stationarity for given global bandwidth and chosen weighting scheme.
regression model formula as in glm
model data frame as in glm
, or may be a SpatialPointsDataFrame or SpatialPolygonsDataFrame object as defined in package sp
matrix of coordinates of points representing the spatial positions of the observations
bandwidth used in the weighting function, possibly
calculated by ggwr.sel
geographical weighting function, at present
gwr.Gauss()
default, or gwr.gauss()
, the previous default or gwr.bisquare()
either NULL (default) or a proportion between 0 and 1 of observations to include in weighting scheme (k-nearest neighbours)
an object containing the coordinates of fit points; often an object from package sp; if missing, the coordinates given through the data argument object, or the coords argument are used
a description of the error distribution and link function to
be used in the model, see glm
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
the type of residuals which should be returned. The alternatives are: "working" (default), "pearson", "deviance" and "response"
A list of class “gwr”:
a SpatialPointsDataFrame (may be gridded) or SpatialPolygonsDataFrame object (see package "sp") with fit.points, weights, GWR coefficient estimates, dispersion if a "quasi"-family is used, and the residuals of type "type" in its "data" slot.
Leung et al. L matrix, here set to NA
GLM global regression on the same model formula.
the bandwidth used.
the function call used.
Fotheringham, A.S., Brunsdon, C., and Charlton, M.E., 2002, Geographically Weighted Regression, Chichester: Wiley; http://gwr.nuim.ie/
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.
if (require(sf)) {
xx <- as(st_read(system.file("shapes/sids.shp", package="spData")[1]), "Spatial")
bw <- 144.4813
if (FALSE) {
bw <- ggwr.sel(SID74 ~ I(NWBIR74/BIR74) + offset(log(BIR74)), data=xx,
family=poisson(), longlat=TRUE)
}
nc <- ggwr(SID74 ~ I(NWBIR74/BIR74) + offset(log(BIR74)), data=xx,
family=poisson(), longlat=TRUE, bandwidth=bw)
nc
if (FALSE) {
nc <- ggwr(SID74 ~ I(NWBIR74/10000) + offset(log(BIR74)), data=xx,
family=poisson(), longlat=TRUE, bandwidth=bw)
nc
nc <- ggwr(SID74 ~ I(NWBIR74/10000) + offset(log(BIR74)), data=xx,
family=quasipoisson(), longlat=TRUE, bandwidth=bw)
nc
}
}
#> Loading required package: sf
#> Linking to GEOS 3.12.0beta1, GDAL 3.7.0, PROJ 9.2.1; sf_use_s2() is TRUE
#> Reading layer `sids' from data source
#> `/home/rsb/lib/r_libs/spData/shapes/sids.shp' using driver `ESRI Shapefile'
#> Simple feature collection with 100 features and 22 fields
#> Geometry type: MULTIPOLYGON
#> Dimension: XY
#> Bounding box: xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965
#> CRS: NA