Hi, Is "adapt=TRUE"(spgwr) not the same as "adaptive Spatial Kernel"(SAM)?The result of "adaptive Spatial Kernel" may be better than fixed bandwidth. If I want to ues "adaptive Spatial Kernel" in spgwr, how to write the code? Thanks a lot. Cheers. > Hi, > I think that I use the same bandwidth and kernel. In SAM, I use "spatial > Weighting Function"=gaussian, adaptive Spatial Kernel, and compute > Geographical Distances based on longitudinal coordinate(X) and latitudinal > coordinate(Y). In spgwr, gweight is gwr.Gauss and adapt is TRUE. > > For example, this is my code:
> PET.bw <- gwr.sel(SPECIES_RI ~ PET, data=variables, > coords=cbind(variables$LONGX, variables$LATY),adapt=TRUE) > PET.gauss <- gwr(SPECIES_RI ~ PET, data=variables, > coords=cbind(variables$LONGX, variables$LATY), bandwidth=PET.bw, > gweight=gwr.Gauss,adapt=TRUE,hatmatrix=TRUE) So where do you pass PET.bw to the gwr() function? adapt=TRUE will treat the adaptive proportion as 1, so include all data points. If you want to compare, use a fixed bandwidth in both, with no CV selection. Then you compare like with like. Note that your messages are *not* reaching the list, they must be sent to: r-sig-geo@stat.math.ethz.ch, not r-sig-geo-requ...@stat.math.ethz.ch You are not thinking carefully and are rushing into things and drawing wrong conclusions. > > Thanks a lot. > > Cheers. > > > > ÔÚ2010-05-12 20:28:47£¬"Roger Bivand" <roger.biv...@nhh.no> дµÀ£º >> On Wed, 12 May 2010, huangykiz wrote: >> >>> Hi, >>> One of SAM author ("Jos¨¦ Alexandre Felizola Diniz >>> Filho"<di...@icb.ufg.br>) say that they also base on GWR3 (the Fotherigham >>> book) and the data used within each kernel >>> may be some slight differences >> >> Naturally, if you are not using exactly the same kernel and bandwidth, you >> should not be surprised by differences in values. Please make sure that >> the bandwidth and kernel are the same and try again. >> >> Roger >> >>> Cheers ÔÚ2010-05-12 20:28:47£¬"Roger Bivand" <roger.biv...@nhh.no> дµÀ£º >On Wed, 12 May 2010, huangykiz wrote: > >> Hi, >> One of SAM author ("Jos¨¦ Alexandre Felizola Diniz Filho"<di...@icb.ufg.br>) >> say that they also base on GWR3 (the Fotherigham book) and the data used >> within each kernel >> may be some slight differences > >Naturally, if you are not using exactly the same kernel and bandwidth, you >should not be surprised by differences in values. Please make sure that >the bandwidth and kernel are the same and try again. > >Roger > >> Cheers. >> ÔÚ2010-05-12 15:27:58£¬"Roger Bivand" <roger.biv...@nhh.no> дµÀ£º >On Wed, 12 May 2010, huangykiz wrote: > >> Hi, >> >> I am sorry I donot know how to install module spgwr from sourceforge (I can >> find it on the web >> http://r-spatial.cvs.sourceforge.net/viewvc/r-spatial/spgwr/R/gwr.R?view=log). >> So I use the code sketch to calculate quasi-global R2. The results are >> different between SAM and spgwr(Attached are the results ). The quasi-global >> R2 in R is 0.4515894, but in SAM is 0.696. >> This is my code: >> >> library(spgwr) >> Environmental_variables<-read.csv("Environmental_variables100.csv",header=TRUE) >> attach(Environmental_variables) >> region_PET.bw <- gwr.sel(SPECIES_RI ~ PET, data=Environmental_variables, >> coords=cbind(Environmental_variables$LONGX, >> Environmental_variables$LATY),adapt=TRUE) >> region_PET.gauss <- gwr(SPECIES_RI ~ PET, data=Environmental_variables, >> coords=cbind(Environmental_variables$LONGX, Environmental_variables$LATY), >> bandwidth=region_PET.bw, gweight=gwr.Gauss,adapt=TRUE,hatmatrix=TRUE) >> names(region_PET.gauss$SDF) >> region_PET.gauss$SDF$localR2 >> 1 - >> (region_PET.gauss$results$rss/crossprod(scale(Environmental_variables$SPECIES_RI, >> scale=FALSE))) >> >> Thank you very much. > >SAM is closed source - ask them how they compute it. For spgwr, the code >is provided, so you can read it for yourself. For the record, the current >gwr() code in spgwr gives the same value as GWR3, which is also closed >source, and where the Effective number of parameters (model: traceS), >Sigma, and Residual sum of squares also agree. I suppose SAM has a >different understanding of GWR internals than the authors of the GWR book. > >Once again: > >Please *do* write to the R-sig-geo list rather than to me directly - >others can answer your question as well, perhaps better, and in a more >timely way than I can. In addition, threads in the list can be searched in >the archives, so others can avoid the same problem later. > >Please summarise to the list if this resolves the problem. > >Roger > >> >> >> >> >> >> ÔÚ2010-05-12 01:16:18£¬"Roger Bivand" <roger.biv...@nhh.no> дµÀ£º >>> On Wed, 12 May 2010, huangykiz wrote: >>> >>>> Hi, I just need one for global, not *each* fit point. In this case, how >>>> can I select or do? Why in other software such as SAM(Spatial Analysis >>>> in Macroecology) just gives one R2? >>> >>> If you believe theirs, good luck! The authors of the GWR book have local >>> R^2 values in GWR3 and formulae that are wrong by their own admission in >>> private emails. The localR2 now agrees with the as-yet unreleased GWR4 >>> from the GWR authors. How SAM can be "better", I don't know. What you are >>> suggesting is that the model fitted with fit points at data points (but >>> not at other fit points) might have a "quasi-global" R^2, based on the RSS >>> of the pooled fit. For the columbus case, that might be: >>> >>> 1 - (col.gauss$results$rss/crossprod(scale(columbus$crime, scale=FALSE))) >>> >>> but I don't know whether this is in any way correct. I've added it as: >>> >>> Quasi-global R2: >>> >>> to the print output of a GWR model fitted with a hatmatrix, and have >>> committed it to sourceforge, project r-spatial, module spgwr. Arguably, it >>> ought to be adjusted by the ratio of degrees of freedom, but I don't trust >>> the DF either. Could you please check out spgwr from sourceforge ,install >>> it from source, and confirm that the "quasi-global R2" does the same as >>> SAM, or use the code sketch above to do the same, and report back? >>> >>> Roger >>> >>>> >>>> Thanks a lot. >>>> >>>> Cheers, >>>> >>>> >>>> >>>> >>>> >>>> ÔÚ2010-05-11 23:59:44£¬"Roger Bivand" <roger.biv...@nhh.no> дµÀ£º >>>>> On Tue, 11 May 2010, huangykiz wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> There are 49 localR2 in the results. Which one do I need? The code >>>>>> "look for localR2:" cannot run. >>>>> >>>>> Well, how many do you want? There is one for each fit point, they are >>>>> *local* R2. Please do try to grasp what GWR does - it fits one moddel for >>>>> *each* fit point. >>>>> >>>>>> >>>>>> Thans a lot >>>>>> >>>>>> Cheers. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> ÔÚ2010-05-11 22:33:59£¬"Roger Bivand" <roger.biv...@nhh.no> дµÀ£º >>>>>>> On Tue, 11 May 2010, huangykiz wrote: >>>>>>> >>>>>>>> Hi, OK. But I need it for compariation. In what some contexts to get >>>>>>>> it? >>>>>>>> May you tell me how to get it? >>>>>>> >>>>>>> library(spgwr) >>>>>>> data(columbus) >>>>>>> col.bw <- gwr.sel(crime ~ income + housing, data=columbus, >>>>>>> coords=cbind(columbus$x, columbus$y)) >>>>>>> col.gauss <- gwr(crime ~ income + housing, data=columbus, >>>>>>> coords=cbind(columbus$x, columbus$y), bandwidth=col.bw, hatmatrix=TRUE) >>>>>>> names(col.gauss$SDF) >>>>>>> >>>>>>> look for localR2: >>>>>>> >>>>>>> col.gauss$SDF$localR2 >>>>>>> >>>>>>> But do not rely on it or use it for anything at all! Like all GWR, it >>>>>>> is >>>>>>> most unreliable! >>>>>>> >>>>>>> Roger Bivand >>>>>>> >>>>>>>> >>>>>>>> Thank you very much for your great helps >>>>>>>> >>>>>>>> Best regards. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> ÔÚ2010-05-11 18:28:44£¬"Roger Bivand" <roger.biv...@nhh.no> дµÀ£º >>>>>>>>> On Tue, 11 May 2010, huangykiz wrote: >>>>>>>>> >>>>>>>>>> Dear professor Bivand, >>>>>>>>>> >>>>>>>>>> I am a strudent. I recently use GWR(Geographically >>>>>>>>>> weighted regression) model. May I ask you a question? There is not >>>>>>>>>> Coefficient of Determination in the results of GWR. How can I get >>>>>>>>>> it? >>>>>>>>>> What is the programs to get it? >>>>>>>>> >>>>>>>>> >>>>>>>>> Please address questions like this to the R-sig-geo list rather than >>>>>>>>> to me >>>>>>>>> directly in future. >>>>>>>>> >>>>>>>>> The local R2 values are available in some contexts when running >>>>>>>>> gwr(), but >>>>>>>>> are not well defined (neither in the GWR book nor in >>>>>>>>> implementations). I >>>>>>>>> advise against their use - they are most probably meaningless. >>>>>>>>> >>>>>>>>> Hope this helps, >>>>>>>>> >>>>>>>>> Roger Bivand >>>>>>>>> >>>>>>>>> >>>>>>>>>> >>>>>>>>>> Thank you very much for your any helps. >>>>>>>>>> >>>>>>>>>> Best regards. >>>>>>>>>> >>>>>>>>>> Yong Huang >>>>>>>>> >>>>>>>>> -- >>>>>>>>> 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.biv...@nhh.no >>>>>>>>> >>>>>>> >>>>>>> -- >>>>>>> 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.biv...@nhh.no >>>>> >>>>> -- >>>>> 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.biv...@nhh.no >>> >>> -- >>> 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.biv...@nhh.no > >-- >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.biv...@nhh.no [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo