[R] geographically weighted glm

Simon Wood simon at stats.gla.ac.uk
Fri Sep 24 17:41:17 CEST 2004

> I am interested in obtaining R code related to geographically weighted 
> regression.
- package mgcv's gam function allows you to fit `variable parameter 
models' which include geographically weighted regression as a special 
case. For example if you think `income' depends on `age', but expect this 
to vary with space (x,z), then you might fit a model something like:

income = const + \beta(x,z)*age + error

where \beta(x,z) is the geographically varying coefficient. `gam' could be 
used to fit this with a call something like: 

gam(income~age + s(x,z,by=age))

(the Poisson case is handled by using family=poisson, in the usual way). 
The degree of smoothness of the variation in \beta will be chosen 
automatically from the data (although you can over-ride this if you like). 
If you have more than a few thousand data, then you might need to use the 
efficiency tricks covered in ?gam.


> Simon Wood simon at stats.gla.ac.uk        www.stats.gla.ac.uk/~simon/
>>  Department of Statistics, University of Glasgow, Glasgow, G12 8QQ
>>>   Direct telephone: (0)141 330 4530          Fax: (0)141 330 4814

More information about the R-help mailing list