[R-sig-Geo] How to get each bandwidth values on observation points using adaptive kernel in spgwr ?

Roger Bivand Roger.Bivand at nhh.no
Tue Aug 23 11:40:56 CEST 2005


On Tue, 23 Aug 2005, Hisaji ONO wrote:

> Hello.
> 
>  I have two question about latest spgwr package.
> 
>  First, I've modified gwr function's example a little and
> tried to get each bandwidth values on observation points
> using adaptive kernel in spgwr as follows.
> 
>   col.bw <- gwr.sel(crime ~ income + housing,
> data=columbus,adapt=0.5,
>     coords=cbind(columbus$x, columbus$y))
>   col.gauss <- gwr(crime ~ income + housing,
> data=columbus,adapt=0.5,
>     coords=cbind(columbus$x, columbus$y),
> bandwidth=col.bw, hatmatrix=TRUE)
> 
>   I've got a value of "col.gauss$bandwidth."
> 
>   However this result was "null."
> 
>   How to get bandwidth values on observation points?
> 

Well, in the gwr.sel() call, adapt= should be either TRUE or FALSE, not a
non-logical value (a test will be added to the next release o trap this).  
You then pass the adaptive quantile returned from gwr.sel() to adapt=, not 
to bandwidth= (which is ignored if adapt= is not NULL). Given an adaptive 
quantile:

> res <- gw.adapt(cbind(columbus$x, columbus$y), cbind(columbus$x, 
+ columbus$y), quant=0.5)
> str(res)
 num [1:49] 12.81 10.76  9.06 10.60 13.48 ...

gives the distance equivalents used, and I'm adding it to the list of 
returned values from the function.

Note that gwr.sel(..., adapt=TRUE) for the columbus data for the default 
Gaussian kernel gives nonsense results (only including 4% of the data 
points), the Bisquare gives about 65% of the points.

> 
>   And another question about spgwr. How to use
> gwr.morantest function? It can work?
> 

If we use the spdep package, and the columbus dataset there:

> library(spdep)
> data(columbus)
> col.bw <- gwr.sel(CRIME ~ INC + HOVAL, data=columbus,
+ coords=cbind(columbus$X, columbus$Y), adapt=TRUE, gweight=gwr.bisquare)
> col.bisq <- gwr(CRIME ~ INC + HOVAL, data=columbus,
+ coords=cbind(columbus$X, columbus$Y), adapt=col.bw, 
+ gweight=gwr.bisquare, hatmatrix=TRUE)
> res <- gwr.morantest(x=col.bisq, listw=nb2listw(col.gal.nb))

        Leung et al. 2000 three moment approximation for Moran's I

data:  GWR residuals 
statistic = 10.6783, df = 30.912, p-value = 0.0002680
sample estimates:
        I 
0.1194597 

but I agree, the documentation is far from complete. Please use the test 
with care, see for example:

> moran.test(res$GWRresids[,1], listw=nb2listw(col.gal.nb))

        Moran's I test under randomisation

data:  res$GWRresids[, 1]  
weights: nb2listw(col.gal.nb)  
 
Moran I statistic standard deviate = 1.2615, p-value = 0.1036
alternative hypothesis: greater 
sample estimates:
Moran I statistic       Expectation          Variance 
      0.097195544      -0.020833333       0.008754355 

where res is the object returned by gwr.morantest() with the GWR 
residuals. I don't know which is credible.

Roger

> 
>  Regards.
> 
> 

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