Learn R Programming

gwer (version 1.0)

gwer: Geographically Weighted Elliptical Regression

Description

The function implements geographically weighted elliptical regression to explore the non-stationarity for certain global bandwidth and chosen weighting scheme.

Usage

gwer(formula, coords, bandwidth, gweight = gwr.Gauss, adapt = NULL,
  spdisp = F, family = Normal, data = sys.parent(),
  dispersion = NULL, weights, subset, fit.points,
  na.action = "na.fail", method = "gwer.fit", longlat = NULL,
  control = glm.control(epsilon = 1e-04, maxit = 100, trace = F),
  model = F, x = F, y = T, contrasts = NULL, parplot = F, offset,
  type = "pearson", gwr.diag = F, ...)

Arguments

formula

regression model formula as in glm.

coords

matrix of coordinates of points representing the spatial positions of the observations.

bandwidth

value of the selected bandwidth (see gwer.sel for bandwidth optimization).

gweight

geographical weighting function, at present gwr.Gauss() is default.

adapt

defines the type of bandwidth used. either NULL (default) or a proportion between 0 and 1 of observations to include in weighting scheme (k-nearest neighbours).

spdisp

if TRUE dispersion parameter varies geographically.

family

a description of the error distribution to be used in the model (see elliptical.family for details of family functions).

data

model data frame, or may be a SpatialPointsDataFrame or SpatialPolygonsDataFrame as defined in package sp.

dispersion

an optional fixed value for dispersion parameter.

weights

an optional vector of weights to be used in the fitting process for local models.

subset

an optional vector specifying a subset of observations to be used in the fitting process.

fit.points

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.

na.action

a function which indicates what should happen when the data contain NAs (see glm).

method

the method to be used in fitting local models. The default method "gwer.fit" uses Fisher's scoring method. The alternative "model.frame" returns the model frame and does no fitting.

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.

control

a list of parameters for controlling the fitting process. For gwer.fit this is passed to glm.control.

model

a logical value indicating whether model frame should be included as a component of the returned value.

x

a logical value indicating whether the response vector used in the fitting process should be returned as components of the returned value.

y

a logical value indicating whether model matrix used in the fitting process should be returned as components of the returned value.

contrasts

an optional list. See the contrasts.arg of model.matrix.default.

parplot

if TRUE the parameters boxplots are plotted.

offset

this can be used to specify an a priori known component to be included in the linear predictor during fitting as in glm.

type

character that indicates the type of residuals should consider as return.

gwr.diag

if TRUE is calculated the diagnostic measures of the model and provided in return.

...

arguments to be used to form the default control argument if it is not supplied directly.

Value

A list of class “gwer”:

SDF

a SpatialPointsDataFrame (may be gridded) or SpatialPolygonsDataFrame object (see package sp) with fit.points, weights, GWR coefficient estimates, dispersion and the residuals of type in its data slot.

coef

regression parameters matrix of the fitted model.

se

standard errors matrix for the parameters of the fitted model.

pvalue

p-value matrix for the significance tests of parameters of the fitted model.

lhat

hat matrix of the geographically weighted elliptical model.

lm

elliptical regression on the same model formula.

Weights

matrix for geographical weighting.

results

a list of results values for fitted geographically weighted elliptical model.

fitted

the fitted mean values of the geographically weighted elliptical model.

diag

a list of diagnostic matrices ('leverage', 'global influence' and 'local influence'), see elliptical.diag for more details.

residuals

a list of all residuals type ('ordinal', 'studentized' and 'deviance').

this.call

the function call used.

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. https://doi.org/10.1111/j.1538-4632.1996.tb00936.x

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

See Also

gwer.sel, elliptical, family.elliptical

Examples

Run this code
# NOT RUN {
data(columbus, package="spData")
fit.lm <- lm(CRIME ~ INC, data=columbus)
summary(fit.lm)
gwer.bw <- gwer.sel(CRIME ~ INC, data=columbus, family = Normal(),
                 coords=cbind(columbus$X, columbus$Y))
fit.gwer <- gwer(CRIME ~ INC, family = Normal(), bandwidth = gwer.bw, 
                 parplot = TRUE, data=columbus, method = "gwer.fit",
                 coords=cbind(columbus$X, columbus$Y))
# }
# NOT RUN {
data(columbus, package="spData")
fit.lm <- lm(CRIME ~ INC, data=columbus)
summary(fit.lm)
gwer.bw <- gwer.sel(CRIME ~ INC, data=columbus, family = Student(df=4),
                 coords=cbind(columbus$X, columbus$Y), method = 'aic')
gwer.fitt <- gwer(CRIME ~ INC, family = Student(df=4), bandwidth = gwer.bw, 
                 parplot = TRUE, data=columbus, method = "gwer.fit",
                 coords=cbind(columbus$X, columbus$Y))
# }

Run the code above in your browser using DataLab