[R-sig-Geo] all localR2 has NA values in gwr

Danlin Yu yud at mail.montclair.edu
Thu Sep 30 23:14:55 CEST 2010


 From what I see on your code, I would suspect that you kind of confuse 
the bandwidth with numbers of nearest neighbor. In your code, you use 
20, and I assume that meant the 20 nearest neighbors that you want for 
GWR calibration. Yet you didn't specify the adapt parameter in the code, 
which make the code think 20 is a distance value. I am not sure how the 
distance of 20 with longitude and latitude values would be, but I 
suspect this might be the cause. In addition, in the coordinates 
specification, longitude shall be the x, and latitude the y.



to see what happens (I use 0.05 just for testing purpose, which means 5% 
of the total sample as the nearest neighbor for local estimation. Since 
you have more than 10,000 samples, the value will result in a local 
sample (local nearest neighbors) of 500. If you wan to try 20, then you 
can probably use 0.002 for the adapt parameter).

Hope this helps.

Dr. Danlin Yu

On 2010-9-30 12:53, Jorge Fernando Saraiva de Menezes wrote:
> Dear list,
> When I run a gwr using a model with two independent variables my local R2
> only has NA values. I've read in some topic that this is problably because
> the function cannot estimate localR2 correctly.
> I tryed to get the same result with the columbus data, but was not able to.
> Does anyone know what usually cause this? maybe a small or large bandwdth?
> And a side question, when longlat=T,and your coordinates are in WGS84 the
> values of bandwidth must be given in degrees?
> I'm using R2.10.1 and package spgwr version 0.6-2. i give a summary of my
> variables below. also my data is information collected in 10433 islands of
> the American continent, which mean that I have distances between my points
> varying from few meters to thousands of kilometers. I use a bandwidth of 20,
> and used the bisquare method.
> summary of my data
>              y          x1            x2
> Min.      0.00    1.310e-02   4.254e-02
> 1st Qu.  32.00  8.319e-01   1.628e+00
> Median   47.00  1.696e+00  2.005e+01
> Mean     84.25   2.043e+02 1.329e+02
> 3rd Qu. 143.00   5.822e+00 1.758e+02
> Max.    425.00   5.152e+05  3.114e+03
> code
> test=gwr(y~x1+x2,,cbind(latitude,longitude),20,gwr.bisquare,longlat=T)
> Thanks in advance,
> Jorge Menezes
> 	[[alternative HTML version deleted]]
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Danlin Yu, Ph.D.
Associate Professor of GIS and Urban Geography
Department of Earth&  Environmental Studies
Montclair State University
Montclair, NJ, 07043
Tel: 973-655-4313
Fax: 973-655-4072
email: yud at mail.montclair.edu
webpage: csam.montclair.edu/~yu

More information about the R-sig-Geo mailing list