[R-sig-Geo] stepwise algorithm for GWR
Marco Helbich
marco.helbich at gmx.at
Wed May 13 15:37:34 CEST 2009
Dear list!
I am doing some geographically weighted regression and I am intersted in the most suitable model (the one with the lowest AIC). Because there is no stepwise algorithm, I am trying to write a "brute force" function, which uses all possible variable combination, applies the gwr and returns the AIC value with the used variable combination in a dataframe.
For instance the model below: gwr1: crime ~ income, gwr2: crime ~ housing, gwr3: crime ~ var1, gwr4: crime ~ income + housing, ...
I hope my problem is clear and appreciate every hint! Thank you!
All the best
Marco
library(spgwr)
data(columbus)
columbus[,"var1"] <- rnorm(length(columbus[,1]))
col.bw <- gwr.sel(crime ~ income + housing + var1, data=columbus,
coords=cbind(columbus$x, columbus$y))
col.gauss <- gwr(crime ~ income + housing + var1, data=columbus,
coords=cbind(columbus$x, columbus$y), bandwidth=col.bw, hatmatrix=TRUE)
col.gauss
--
More information about the R-sig-Geo
mailing list