Last data update: 2014.03.03

R: Generalised GWR models, including Poisson and Binomial...
gwr.generalisedR Documentation

Generalised GWR models, including Poisson and Binomial options

Description

This function implements generalised GWR

Usage

gwr.generalised(formula, data, regression.points, bw, family ="poisson",
 kernel="bisquare",adaptive=FALSE, p=2, theta=0, longlat=F, dMat, cv=T,tol=1.0e-5, 
 maxiter=20)

Arguments

formula

Regression model formula of a formula object

data

a Spatial*DataFrame, i.e. SpatialPointsDataFrame or SpatialPolygonsDataFrame as defined in package sp

regression.points

a Spatial*DataFrame object, i.e. SpatialPointsDataFrame or SpatialPolygonsDataFrame as defined in package sp

bw

bandwidth used in the weighting function, possibly calculated by bw.ggwr();fixed (distance) or adaptive bandwidth(number of nearest neighbours)

family

a description of the error distribution and link function to be used in the model, which can be specified by “poisson” or “binomial”

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)

p

the power of the Minkowski distance, default is 2, i.e. the 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

cv

if TRUE, cross-validation data will be calculated

tol

the threshold that determines the convergence of the IRLS procedure

maxiter

the maximum number of times to try the IRLS procedure

Value

A list of class “ggwrm”:

GW.arguments

a list class object including the model fitting parameters for generating the report file

GW.diagnostic

a list class object including the diagnostic information of the model fitting

glm.res

an object of class inheriting from “glm” which inherits from the class “lm”, see glm.

SDF

a SpatialPointsDataFrame (may be gridded) or SpatialPolygonsDataFrame object (see package “sp”) integrated with fit.points,GWR coefficient estimates, y value,predicted values, coefficient standard errors and t-values in its "data" slot.

CV

a data vector consisting of the cross-validation data

Author(s)

Binbin Lu binbinlu@whu.edu.cn

References

Charlton, M, Fotheringham, S, and Brunsdon, C (2007), GWR3.0, http://gwr.nuim.ie/.

Fotheringham S, Brunsdon, C, and Charlton, M (2002), Geographically Weighted Regression: The Analysis of Spatially Varying Relationships, Chichester: Wiley.

Examples

data(LondonHP)
## Not run: 
DM<-gw.dist(dp.locat=coordinates(londonhp))
bw.f1 <- bw.ggwr(BATH2~FLOORSZ,data=londonhp, dMat=DM)
res.poisson<-gwr.generalised(BATH2~FLOORSZ, bw=bw.f1,data=londonhp, dMat=DM)
bw.f2 <- bw.ggwr(BATH2~FLOORSZ,data=londonhp, dMat=DM,family ="binomial")
res.binomial<-gwr.generalised(BATH2~FLOORSZ, bw=bw.f2,data=londonhp, dMat=DM,
              family ="binomial")

## End(Not run)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(GWmodel)
Loading required package: maptools
Loading required package: sp
Checking rgeos availability: TRUE
Loading required package: robustbase
Welcome to GWmodel version 1.2-5.
 Note: The default kernel for all the functions have been set as bisquare from this release
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GWmodel/gwr.generalised.Rd_%03d_medium.png", width=480, height=480)
> ### Name: gwr.generalised
> ### Title: Generalised GWR models, including Poisson and Binomial options
> ### Aliases: gwr.generalised gwr.binomial gwr.binomial.wt gwr.poisson
> ###   gwr.poisson.wt gwr.fitted
> ### Keywords: generalised, GWR
> 
> ### ** Examples
> 
> data(LondonHP)
> ## Not run: 
> ##D DM<-gw.dist(dp.locat=coordinates(londonhp))
> ##D bw.f1 <- bw.ggwr(BATH2~FLOORSZ,data=londonhp, dMat=DM)
> ##D res.poisson<-gwr.generalised(BATH2~FLOORSZ, bw=bw.f1,data=londonhp, dMat=DM)
> ##D bw.f2 <- bw.ggwr(BATH2~FLOORSZ,data=londonhp, dMat=DM,family ="binomial")
> ##D res.binomial<-gwr.generalised(BATH2~FLOORSZ, bw=bw.f2,data=londonhp, dMat=DM,
> ##D               family ="binomial")
> ## End(Not run)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>