[R-sig-Geo] mixed geographically weighted regression

Roger Bivand Roger.Bivand at nhh.no
Tue Jan 5 18:00:50 CET 2010

On Tue, 5 Jan 2010, Marco Helbich wrote:

> Dear list,
> I am trying to fit a mixed geographically weighted regression model (with adaptive kernel) using the spgwr package, i.e. I want to hold some of the coefficients fixed at the global level. Thus, I have the following questions:
> 1. Which is the most efficient way to estimate such a model?
> a) I found the posting http://www.mail-archive.com/r-sig-geo@stat.math.ethz.ch/msg00984.html where Roger recommended to first fit a global model, then the GWR using the residuals.
> b) The method proposed in Mei et al. (2006,  pp. 588-589, see http://www.envplan.com/abstract.cgi?id=a3768) first computes the projection matrix of the locally varying part (called S_v) and uses this in a second step to derive the fixed coefficients (this seems to me like an application of the FWL-theorem see http://en.wikipedia.org/wiki/FWL_theorem).
> 2. In order to follow this method, I first have to find the kernel 
> weights at each point. The help-file says that these can be found in the 
> SpatialPointsDataFrame (SDF), but I could not get it from there. Where 
> can I extract them?

The sums of weights for each fit point are in the returned object, but 
this is not what you (do not) want. The S_v matrix in the paper (eq. 3) is 
returned as the hat matrix, I believe. Since you have S_v, you do not need 
the W(u_i, v_i) weights (a diagonal matrix for each fit (and data) point 
i). Given S_v, the unnumbered equation in the middle of the page gives you 
\hat{\beta_c}, doesn't it? I think that I would pre-multiply X_c and Y by 
(I - S_v), then use QR methods to complete, if I wanted to proceed with 

Because of concerns about how these things are done, and how they are 
represented in the literature, I'd look for corrobotation - being able to 
reproduce others' published results for example.

Hope this helps,


> We are using such a code:
> library(spgwr)
> data(georgia)
> g.adapt.gauss <- gwr.sel(PctBach ~ TotPop90 + PctRural + PctEld + PctFB + PctPov + PctBlack, data=gSRDF, adapt=TRUE)
> res.adpt <- gwr(PctBach ~ TotPop90 + PctRural + PctEld + PctFB + PctPov + PctBlack, data=gSRDF, adapt=g.adapt.gauss)
> res.adpt$SDF
> I hope my problem is clear and appreciate every hint! Thank you!
> Best regards
> Marco

Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no

More information about the R-sig-Geo mailing list