Skip to content

GWmodel package results

4 messages · bhartendupandey, lubinbin220 at gmail.com

#
Dear list, 

I am experimenting with the GWmodel package and I just ran an example code
(with LondonHP data) given in the reference manual for gwr.generalised()
function. Incidently, I ran it in two different computers installed with
different versions of the package. I noted differences between the results
(for both poisson and binomial models) from the two versions:

1. GWmodel_1.2-1
2. GWmodel_1.2-3 

Essentially, I noted that the bandwidth estimated using bw.ggwr() function
from the two versions were different, which is ultimately causing the GWR
model results to vary. Now I wonder what is causing the differences in
bandwidth estimates and more importantly, which version of the package is
reliable? 

I ran the following code:

data(LondonHP)
DM<-gw.dist(dp.locat=coordinates(londonhp))
bw.f1 <- bw.ggwr(BATH2~FLOORSZ,data=londonhp, dMat=DM)
res.poisson<-gwr.generalised(BATH2~FLOORSZ, bw=bw.f1,data=londonhp, dMat=DM)
bw.f2 <- bw.ggwr(BATH2~FLOORSZ,data=londonhp, dMat=DM,family ="binomial")
res.binomial<-gwr.generalised(BATH2~FLOORSZ, bw=bw.f2,data=londonhp,
dMat=DM,
family ="binomial")
 
Here is the sessionInfo() from the two computers: 

Computer 1:
R version 3.0.1 (2013-05-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] GWmodel_1.2-3     robustbase_0.91-1 maptools_0.8-30   sp_1.0-15        

loaded via a namespace (and not attached):
[1] DEoptimR_1.0-1  foreign_0.8-53  grid_3.0.1      lattice_0.20-15
[5] tools_3.0.1    

 Computer 2:
R version 3.0.0 (2013-04-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] raster_2.1-16     lattice_0.20-15   GWmodel_1.2-1     robustbase_0.9-10
[5] maptools_0.8-26   sp_1.0-11        

loaded via a namespace (and not attached):
[1] foreign_0.8-53 grid_3.0.0     tools_3.0.0         

loaded via a namespace (and not attached):
[1] DEoptimR_1.0-1  foreign_0.8-53  grid_3.0.1      lattice_0.20-15
tools_3.0.1 

Many thanks for any help and your time.

Best regards,
Bhartendu





--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/GWmodel-package-results-tp7586742.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
1 day later
#
Dear Dr. Lu,

Thank you for your prompt reply.

I understand that these are two different versions with different default
kernel functions. But I noticed something strange here. Even when I specify
the kernel function in bw.ggwr() as "bisquare" and run the code in the two
versions, i.e., GWmodel_1.2-1 and GWmodel_1.2-3, I get different bandwidth
estimates. This further is yielding inconsistent parameter estimates from
the two versions of the package. This is, in fact, keeping me confounded of
the reliability of results from the two versions. Or if the differences here
is merely because I am doing something anomalous.
 
I ran the following codes in two different computers installed with
different versions of the GWmodel package, as stated above: 

rm(list=ls())
require(GWmodel)
data(LondonHP)
DM<-gw.dist(dp.locat=coordinates(londonhp))
bw.f2 <- bw.ggwr(BATH2~FLOORSZ,data=londonhp, dMat=DM,family
="binomial",adaptive=T, kernel='bisquare',approach='AIC')
res.binomial<-gwr.generalised(BATH2~FLOORSZ, bw=bw.f2,data=londonhp,
dMat=DM,
              family ="binomial",adaptive=T, kernel='bisquare')

rm(list=ls())
require(GWmodel)
data(LondonHP)
DM<-gw.dist(dp.locat=coordinates(londonhp))
bw.f2 <- bw.ggwr(BATH2~FLOORSZ,data=londonhp, dMat=DM,family
="binomial",adaptive=F, kernel='bisquare',approach='AIC')
res.binomial<-gwr.generalised(BATH2~FLOORSZ, bw=bw.f2,data=londonhp,
dMat=DM,
              family ="binomial",adaptive=F, kernel='bisquare')


When I run this code in computer 1, I get, 

1.  Adaptive bandwidth: 269 (number of nearest neighbors)
2.  Fixed bandwidth: 36091.69 

and when I run it in computer 2, I get 

1. Adaptive bandwidth: 273 (number of nearest neighbors)
2. Fixed bandwidth: 35582.65  

Computer 1:
R version 3.1.0 (2014-04-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] GWmodel_1.2-3     robustbase_0.91-1 maptools_0.8-30   sp_1.0-15        

loaded via a namespace (and not attached):
[1] DEoptimR_1.0-1  foreign_0.8-61  grid_3.1.0      lattice_0.20-29
[5] tools_3.1.0    


Computer 2:
R version 3.0.0 (2013-04-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] GWmodel_1.2-1     robustbase_0.9-10 maptools_0.8-26   sp_1.0-11        

loaded via a namespace (and not attached):
[1] foreign_0.8-53  grid_3.0.0      lattice_0.20-15 tools_3.0.0   


I thank you for your help and time. 

Best regards,
Bhartendu Pandey




--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/GWmodel-package-results-tp7586742p7586753.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
1 day later