SkaterF {SpatialRegimes} | R Documentation |
Spatial constrained clusterwise regression by Spatial 'K'luster Analysis by Tree Edge Removal
Description
This function implements a spatial constrained clusterwise regression based on the Skater procedure by Assuncao et al. (2002).
Usage
SkaterF(edges,data,coly,colx,ncuts,crit,method=1,ind_col,lat,long,tau.ch)
Arguments
edges |
A matrix with 2 colums with each row is an edge. |
data |
A data.frame with the informations over nodes. |
coly |
The dependent variable in the c("y_ols") form. |
colx |
The covariates in the c("x1","x2") form. |
ncuts |
The number of cuts. |
crit |
A scalar or two dimensional vector with with criteria for groups. Examples: limits of group size or limits of population size. If scalar, is the minimum criteria for groups. |
method |
1 (default) for OLS, 2 for Quantile regression |
ind_col |
Parameter still not used in this version. |
lat |
Parameter still not used in this version. |
long |
Parameter still not used in this version. |
tau.ch |
Chosen quantile (for method = 2). |
Details
Author really thanks Renato M. Assuncao and Elias T. Krainski for their original code (skater, library spdep).
Value
A object of skaterF class with:
groups |
A vector with length equal the number of nodes. Each position identifies the group of node. |
edges.groups |
A list of length equal the number of groups with each element is a set of edges |
not.prune |
A vector identifying the groups with are not candidates to partition. |
candidates |
A vector identifying the groups with are candidates to partition. |
ssto |
The total dissimilarity in each step of edge removal. |
Author(s)
F. Vidoli
References
F. Vidoli, G. Pignataro and R. Benedetti "Identification of spatial regimes of the production function of Italian hospitals through spatially constrained cluster-wise regression", Socio-Economic Planning Sciences (in press) https://doi.org/10.1016/j.seps.2022.101223
Examples
data(SimData)
coords = cbind(SimData$long, SimData$lat)
#######################
neighbours = tri2nb(coords, row.names = NULL)
bh.nb <- neighbours
lcosts <- nbcosts(bh.nb, SimData)
nb <- nb2listw(bh.nb, lcosts, style="B")
mst.bh <- mstree(nb,5)
edges1 = mst.bh[,1:2]
#######################
ncuts1 = 4
crit1 = 10
coly1 = c("y_ols")
colx1 = c("A","L","K")
# OLS
sk = SkaterF(edges = edges1,
data= SimData,
coly = coly1,
colx= colx1,
ncuts=ncuts1,
crit=crit1,
method=1)
SimData$regimes = sk$groups
# plot(lat~long,SimData,col=regimes,pch=16)
## quantile 0.8
# sk2 = SkaterF(edges = edges1,
# data= SimData,
# coly = coly1,
# colx= colx1,
# ncuts=ncuts1,
# crit=crit1,
# method=2,tau.ch=0.8)
#
# SimData$regimes_q = sk2$groups
# plot(lat~long,SimData,col=regimes_q,pch=16)