# NOT RUN {
require(spdep);require(Matrix)
data(boston)
y <- boston.c[, "CMEDV" ]
x <- boston.c[,c("CRIM","ZN","INDUS", "CHAS", "NOX","RM", "AGE",
"DIS" ,"RAD", "TAX", "PTRATIO", "B", "LSTAT")]
xgroup<- boston.c[,"TOWN"]
coords<- boston.c[,c("LAT","LON")]
meig <- meigen(coords=coords)
# meig<- meigen_f(coords=coords) ## for large samples
######## Regression considering residual spatially dependence
res <- resf(y = y, x = x, meig = meig)
res
######## Regression considering residual spatially dependence and NVC
######## (coefficients or NVC is selected)
#res2 <- resf(y = y, x = x, meig = meig, nvc = TRUE)
######## Regression considering residual spatially dependence and NVC
######## (all the coefficients are NVCs)
#res3 <- resf(y = y, x = x, meig = meig, nvc = TRUE, nvc_sel=FALSE)
######## Regression considering residual spatially dependence and group effects
#res4 <- resf(y = y, x = x, meig = meig, xgroup = xgroup)
######## Regression considering group-level spatially dependence and group effects
#meig_g<- meigen(coords=coords, s_id = xgroup)
#res5 <- resf(y = y, x = x, meig = meig_g, xgroup = xgroup)
# }
Run the code above in your browser using DataLab