I am new to R and I am trying to work out geographically weighted regressions using some code that was developed by Roger Bivand for R. Please see help(gwr) for a discussion of the code. With the help of my professor I was able to make it work with an adaptive bandwidth:
library(GWmodel)
DM<-gw.dist(dp.locat=coords)
adaptive.bs1 <- gwr.sel(OnTer_tory ~ CL + cinc + Allie_thUS + Island + Landlocked, adapt = TRUE, method = "cv", gweight = gwr.bisquare, coords = coords)
gwr1 <- gwr(OnTer_tory ~ CL + cinc + Allie_thUS + Island + Landlocked, adapt = adaptive.bs1, gweight = gwr.bisquare, coords = coords, hatmatrix = TRUE)
However, when I try with a fixed bandwidth: fixed.bs1 <- gwr.sel(OnTer_tory ~ CL + cinc + Allie_thUS + Island + Landlocked, adapt = FALSE, method = "cv", gweight = gwr.bisquare, coords = coords)
gwr2 <- gwr(OnTer_tory ~ CL + cinc + Allie_thUS + Island + Landlocked, adapt = fixed.bs1, gweight = gwr.bisquare, coords = coords, hatmatrix = FALSE)
I get the following error: gwr2 <- gwr(OnTer_tory ~ CL + cinc + Allie_thUS + Island + Landlocked, + adapt = fixed.bs1, gweight = gwr.bisquare, coords = coords, hatmatrix = FALSE) Error: (adapt <= 1) is not TRUE
What am I doing wrong?