我是 R 新手,我正在尝试使用 Roger Bivand 为 R 开发的一些代码来计算地理加权回归。有关代码的讨论,请参阅 help(gwr)。在我的教授的帮助下,我能够让它在自适应带宽下工作:
图书馆(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,适应 = Adaptive.bs1,gweight = gwr.bisquare,coords = coords,hatmatrix = TRUE)
但是,当我尝试使用固定带宽时: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)
我收到以下错误:gwr2 <- gwr(OnTer_tory ~ CL + cinc + Allie_thUS + Island + Landlocked, + adapt = fixed.bs1, gweight = gwr.bisquare, coords = coords, hatmatrix = FALSE) 错误:(adapt <= 1) 不正确
我究竟做错了什么?