Sareg {SpatialRegimes} | R Documentation |
Spatial clusterwise regression by a constrained version of the Simulated Annealing
Description
This function implements a spatial clusterwise regression based on the procedure suggested by Postiglione et al. (2013).
Usage
Sareg(data, coly,colx, cont, intemp, rho, niter, subit, ncl, bcont)
Arguments
data |
A data.frame |
coly |
The dependent variable in the c("y_ols") form. |
colx |
The covariates in the c("x1","x2") form. |
cont |
The contiguity matrix. |
intemp |
The initial temperature. |
rho |
The temperature decay rate parameter. |
niter |
The maximum number of iterations. |
subit |
The number of sub-iterations for each iteration. |
ncl |
The number of clusters. |
bcont |
A parameter that regulates the penalty of simulated annealing in non-contiguous configurations of the clusters. |
Value
A object of Sareg class with:
groups |
Estimated clusters. |
Author(s)
R. Benedetti
References
Postiglione, P., Benedetti, R., and Andreano, M.S. (2013). "Using Constrained Optimization for the Identification of Convergence Clubs", Computational Economics, 42, 151-174.
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)
W <- matrix(0,nrow(dmat),ncol(dmat))
W[dmat < 0.2] <- 1
diag(W) <- 0
#######################
sa <- Sareg(data=SimData,
coly = c("y_ols"),
colx = c("A"),
W,
intemp=0.5,
rho=0.96,
niter=30,
subit=3,
ncl=2,
bcont=-4)
SimData$regimes = sa$groups
plot(lat~long,SimData,col=regimes,pch=16)