Awsreg {SpatialRegimes} | R Documentation |
Spatial clusterwise regression by an iterated spatially weighted regression algorithm
Description
This function implements a spatial clusterwise regression based on the procedure suggested by Andreano et al. (2017) and Bille' et al. (2017).
Usage
Awsreg(data, coly,colx,kernel,kernel2,coords,bw,tau,niter,conv,eta,numout,sout)
Arguments
data |
A data.frame. |
coly |
The dependent variable in the c("y_ols") form. |
colx |
The covariates in the c("x1","x2") form. |
kernel |
Kernel function used to calculate distances between units (default is "bisquare", other values: "exponential", "gaussian","tricube"). |
kernel2 |
Kernel function used to calculate distances between units in the second step (default is "gaussian", other values: "exponential"). |
coords |
The coordinates in terms of longitude and latitude. |
bw |
The bandwidth parameter of the initial weights. |
tau |
The confidence test parameter of the difference between regression parameters. |
niter |
The maximum number of iterations. |
conv |
The smallest accepted difference between the weights in two successive iterations. |
eta |
The parameter that regulates which is the weight of the weights of the previous iteration in the moving average that updates the new weights. |
numout |
The minimum number of areal units accepted for each cluster. |
sout |
Minimum value of weights such as to be considered equal to zero. Parameter used essentially to control clusters consisting of too few areal units. |
Details
Author really thanks Bille' A.G. for her contribution to revising the original code.
Value
A object of Awsreg class with:
groups |
Estimated clusters. |
Author(s)
R. Benedetti
References
Andreano, M.S., Benedetti, R., and Postiglione, P. (2017). "Spatial regimes in regional European growth: an iterated spatially weighted regression approach", Quality & Quantity. 51, 6, 2665-2684.
Bille', A.G., Benedetti, R., and Postiglione, P. (2017). "A two-step approach to account for unobserved spatial heterogeneity", Spatial Economic Analysis, 12, 4, 452-471.
Examples
data(SimData)
SimData = SimData[1:50,]
coords = cbind(SimData$long, SimData$lat)
#######################
dmat<-gw.dist(coords,focus=0,p=2,theta=0,longlat=FALSE)
bw<-bw.gwr(y_ols~A+L+K,
data=SpatialPointsDataFrame(coords,SimData),
approach="AIC",kernel="bisquare",
adaptive=TRUE,p=2,theta=0,longlat=FALSE,dMat=dmat)
#######################
aws<-Awsreg(data=SimData,
coly=c("y_ols"),
colx=c("A","L","K"),
kernel="bisquare",
kernel2="gaussian",
coords=coords,
bw=bw,
tau=0.001,
niter=200,
conv=0.001,
eta=0.5,
numout=15,
sout=1e-05)
SimData$regimes = aws$groups
plot(lat~long,SimData,col=regimes,pch=16)