Version 1.4.1 of package ConvergenceClubs is on CRAN. The package provides functions for club convergence clustering countries/regions that form convergence clubs, according to the definition of Phillips and Sul (2007, 2009).
The new version adds the possibility to compute transition path \(h\) through function
computeH()
, and a plot()
method for objects of class convergence.clubs
to plot region transition paths and average club transition paths.
The main functions are:
findClubs()
: given a data.frame with data about some regions (by row) over a
number of time periods (typically years, by column), applies the club convergence
clustering algorithm (Phillips and Sul 2007, 2009).
Returns an object of class convergence.clubs
.
mergeClubs()
: takes as argument an object of class convergence.clubs
and
applies the clustering procedure to clubs in the argument,
applying either Phillips and Sul (2009) or von Lyncker and Thoennessen (2017) procedure.
For class convergence.clubs
, the following methods are available:
summary()
: shows the number of regions for each club of convergence
and the number of divergent regions;print()
: prints the convergence.clubs
object, a list with information about
convergence clubs (region ids, beta coefficient, p-value, …) and divergent units;dim()
: return a vector of two elements, representing the number of clubs and
the number of divergent units;plot()
: plots transition path.You can install the package from CRAN by running the following code in R:
install.packages("ConvergenceClubs")
Or, if you want to install the development version from GitHub:
# if not present, install 'devtools' package
if( !require(devtools) ) install.packages("devtools")
# install ConvergenceClubs package
devtools::install_github("rhobis/ConvergenceClubs")
To illustrate the use of ConvergenceClubs, I am going to use the dataset filteredGDP, available in the package. The dataset includes filtered log per–capita GDP data about 152 Countries over 34 years (Phillips and Sul 2009); it also contains a column with the names of the Countries.
library(ConvergenceClubs)
data("filteredGDP")
dim(filteredGDP)
## [1] 152 35
We can use function findClubs()
to cluster the 152 Countries. As the first column
contains the names of the Countries, we set regions=1
and dataCols=2:35
;
we will use the last year as reference, so we also set refCol=35
.
# Cluster Countries using GDP from year 2000 to year 2014, with 2014 as reference year
clubs <- findClubs(filteredGDP, dataCols=2:35, unit_names = 1, refCol=35)
summary(clubs)
## Number of convergence clubs: 7
## Number of divergent units: 0
##
## | # of units | beta | std.err | tvalue | cstar
## -------- ------------- ---------- ---------- ---------- --------
## club1 | 50 | 0.382 | 0.041 | 9.282 | 0
## club2 | 30 | 0.24 | 0.035 | 6.904 | 0
## club3 | 21 | 0.11 | 0.032 | 3.402 | 0
## club4 | 24 | 0.131 | 0.064 | 2.055 | 0
## club5 | 14 | 0.19 | 0.111 | 1.701 | 0
## club6 | 11 | 1.003 | 0.166 | 6.024 | 0
## club7 | 2 | -0.47 | 0.842 | -0.559 | 0
The summary shows that there are 7 clubs and no divergent unit, it also reports how many Countries are included in each club.
Let’s now see if it is possible to merge some clubs together by using function
mergeClubs()
.
It is possible to choose which merging algorithm to use through argument mergeMethod
:
mergeMethod='PS'
applies the Phillips and Sul (2009) procedure, whilemergeMethod='vLT'
uses von Lyncker and Thoennessen (2017) method.# Merge clusters using Phillips and Sul (2009) method
mclubs <- mergeClubs(clubs, mergeMethod='PS')
summary(mclubs)
## Number of convergence clubs: 6
## Number of divergent units: 0
##
## | merged clubs | # of units | beta | std.err | tvalue
## -------- --------------- ------------- ---------- ---------- ----------
## club1 | clubs: 1 | 50 | 0.382 | 0.041 | 9.282
## club2 | clubs: 2 | 30 | 0.24 | 0.035 | 6.904
## club3 | clubs: 3 | 21 | 0.11 | 0.032 | 3.402
## club4 | clubs: 4, 5 | 38 | -0.044 | 0.07 | -0.636
## club5 | clubs: 6 | 11 | 1.003 | 0.166 | 6.024
## club6 | clubs: 7 | 2 | -0.47 | 0.842 | -0.559
# Merge clusters using von Lyncker and Thoennessen (2016) method
mclubs <- mergeClubs(clubs, mergeMethod='vLT')
summary(mclubs)
## Number of convergence clubs: 6
## Number of divergent units: 0
##
## | merged clubs | # of units | beta | std.err | tvalue
## -------- --------------- ------------- ---------- ---------- ----------
## club1 | clubs: 1 | 50 | 0.382 | 0.041 | 9.282
## club2 | clubs: 2 | 30 | 0.24 | 0.035 | 6.904
## club3 | clubs: 3 | 21 | 0.11 | 0.032 | 3.402
## club4 | clubs: 4, 5 | 38 | -0.044 | 0.07 | -0.636
## club5 | clubs: 6 | 11 | 1.003 | 0.166 | 6.024
## club6 | clubs: 7 | 2 | -0.47 | 0.842 | -0.559
Both methods return the same result. Club 5 has been merged into club 4, which now includes 38 Countries (24+14).
Finally, we can use function plot()
to produce transition path plots.
It is possible to plot either region transition paths for each club or average
club transition path, or both of them. It is also possible to choose a subset of
clubs and to save the output to a .pdf, .png or .jpeg file.
Here are some examples:
# Plot Transition Paths for all regions in each club and average Transition Path
# for all clubs
plot(mclubs)
# Plot only clubs 1:4
plot(mclubs, clubs = c(1:4), avgTP = FALSE)
# Plot Only average Transition Paths
plot(clubs, clubs=NULL, avgTP = TRUE, legend=TRUE)
For more details, please consult the package documentation.
An introduction to the package with a description of its usage can also be found in (Sichera and Pizzuto 2019) [link].
To report issues or bugs, or to ask for generic help, you can open an issue on GitHub.