[R-sig-Geo] GWR residual plot, state map did not appear
Milan Sharma
milansharma2012 at yahoo.com
Sun Feb 10 02:28:20 CET 2013
Dear list,
I did GWR residual plot using the same technique as spgwr package. When I do for Georgia data, I get the nice plot (with the state map) with the residuals, but same code applied to my data gives residuals plot (without the state map). My code is given below, if someone can tell me what is the problem.
library(spdep)
library(spgwr)
data<-read.csv("GWRDATA.csv",header=TRUE)
attach(data)
map = SpatialPointsDataFrame(data=data, coords=cbind(Longitude,Latitude))
bw = gwr.sel(Y~x1+x2,data=map,adapt=T)
(gwr.model = gwr(Y~x1+x2,data=map, adapt=bw))
SD.adapt.gauss <- gwr.sel(Y~x1+x2,data=map,adapt=TRUE)
res.adpt <- gwr(Y~x1+x2,data=map,adapt=SD.adapt.gauss)
brks <- c(-0.25, 0, 0.01, 0.025, 0.075)
cols <- grey(5:2/6)
res.adpt$SDF$ols.e <- residuals(lm(yield~temp+precpt,data=map))
spplot(res.adpt$SDF, c("ols.e", "gwr.e"),main="Residuals from OLS and GWR")
Milan
More information about the R-sig-Geo
mailing list