# NOT RUN {
require(spdep)
data(boston)
y <- boston.c[, "CMEDV"]
x <- boston.c[,c("ZN", "INDUS" ,"LSTAT")]
xconst <- boston.c[,c("CRIM", "NOX", "CHAS", "AGE", "DIS", "RAD", "TAX", "PTRATIO", "B", "RM" )]
coords <- boston.c[,c("LAT","LON")]
######## Without the penalty-based SVC selection (just like the usual GWR)
# res <- besf_vc(y=y,x=x,xconst=xconst,coords=coords,allsvc=TRUE)
######## With the penalty-based SVC selection
# res2 <- besf_vc(y=y,x=x,xconst=xconst,coords=coords)
# res$b
# res$s
# res$e
# res$vc
# res$b_vc[1:10,]
# res$bse_vc[1:10,]
# res$t_vc[1:10,]
# res$p_vc[1:10,]
###Plot the first SVC (INDUS)
#
# require(ggplot2)
# ggplot(mapping = aes(x = coords$LON, y = coords$LAT)) +
# geom_point(aes(colour = res$b_vc[,3])) +
# scale_color_gradientn(colours=rev(rainbow(4)))
# }
Run the code above in your browser using DataLab