[R-sig-Geo] differences between gwr.sel and GWR3?

Roger Bivand Roger.Bivand at nhh.no
Sat May 23 20:10:34 CEST 2009


On Sun, 17 May 2009, aslez at ssc.wisc.edu wrote:

> In general, what are the differences between the way in which gwr.sel and
> Fotheringham et al.s GWR3 optimize bandwidths?  Should I be able to
> replicate the optimal bandwidths suggested by GWR3 using gwr.sel?  Using
> various datasets (including the Georgia data which accompanies both
> packages), I have consistently found noticable differences in the
> bandwidths suggested by each program.
>
> Am I missing something?

Well, GWR3 is closed source, and the code in the R contributed package 
spgwr is open source, so that the only way that you can check is to try to 
reverse-engineer the settings that GWR3 may be using. You are not giving 
any specific cases here, so I'll oblige.

Fit the Georgia PctPov ~ PctEld model using X and Y as planar coordinates, 
CV, all observations, and GWR3 gives a bandwidth of 60133.3396 (metres I 
think). Use gwr.sel() in the same setting, and you get a bandwidth of 
59762.81 with a CV score of 2859.344. By reverse engineering (running 
gwr.sel() under debug(), and assigning y, x, coords, weights, and gweight 
to the global environment, and running gwr.cv.f() after gwr.sel() 
finished), and using the GWR3 bandwidth, we find its score (in the 
same metric as CV in gwr.sel()) is 2859.368, not a lot different.

So in this case, the reason seems to be that R's line search function 
optimize() is being slightly more eager in getting to the minimum of the 
CV score function. Both implementations are doing the same thing, but GWR3 
is letting the line search terminate earlier. I think that the same is 
happening with CV in the adaptive case.

Your choice as to what you prefer - I don't think that these differences 
are "noticable", they just stem from the use of different optimizers. In 
gwr.sel() it uses the default tolerances, but GWR3's choice to stop 
earlier is also OK for practical purposes. Using AIC depends on accepting 
extra assumptions about the "right" number of degrees of freedom in the 
number of parameters.

Does this address your concerns?

Hope this helps,

Roger

>
> Adam Slez
> Department of Sociology
> University of Wisconsin-Madison
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
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