### Install ConvergenceClubs Development Version from GitHub Source: https://cran.r-project.org/web/packages/ConvergenceClubs/readme/README.html Installs the development version of the ConvergenceClubs package from GitHub. Requires the 'devtools' package to be installed first. ```r # if not present, install 'devtools' package install.packages("devtools") devtools::install_github("rhobis/ConvergenceClubs") ``` -------------------------------- ### Install ConvergenceClubs from CRAN Source: https://cran.r-project.org/web/packages/ConvergenceClubs/readme/README.html Installs the ConvergenceClubs package from the Comprehensive R Archive Network (CRAN). ```r install.packages("ConvergenceClubs") ``` -------------------------------- ### Plot Transition Paths for Convergence Clubs Source: https://cran.r-project.org/web/packages/ConvergenceClubs/readme/README.html Plots the transition paths for all regions within each club, as well as the average transition path for all clubs. This visualization helps in understanding the convergence dynamics. ```r # Plot Transition Paths for all regions in each club and average Transition Path # for all clubs plot(mclubs) ``` -------------------------------- ### Plot Average Transition Paths Only Source: https://cran.r-project.org/web/packages/ConvergenceClubs/readme/README.html Plots only the average transition paths for each convergence club, without showing individual region paths. Useful for a high-level overview of club convergence. ```r # Plot Only average Transition Paths plot(mclubs, clubs=NULL) plot(mclubs, clubs=NULL, legend=TRUE) ``` -------------------------------- ### Find Convergence Clubs with Incremental Cstar Method Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Clusters countries using GDP data, applying the Phillips and Sul method with an incremental cstar adjustment. Requires the `filteredGDP` dataset. ```R data("filteredGDP") # Cluster Countries using GDP from year 1970 to year 2003 clubs <- findClubs(filteredGDP, dataCols=2:35, unit_names = 1, refCol=35, time_trim = 1/3, HACmethod = "FQSB", cstar = 0, cstar_method = 'incremental', cstar_increment = 0.1) ``` -------------------------------- ### Extract transition paths from a `convergence.clubs` object Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Extracts transition paths for each club from a `convergence.clubs` object. The output can be a list of data frames or a single data frame, with an option to include unit names. ```APIDOC ## Extract transition paths from a `convergence.clubs` object Extracts transition paths for each club from a `convergence.clubs` object. The output can be a list of data frames or a single data frame, with an option to include unit names. ### Usage ```R transition_paths( clubs, include_unit_names = TRUE, output_type = c("list", "data.frame") ) ``` ### Arguments * `clubs`: An object of class `convergence.clubs` (created by either function `findClubs` or `mergeClubs`). * `include_unit_names`: Logical, if `TRUE` (the default) adds a column with unit names (only if present in the `convergence.clubs` object passed to `clubs`). * `output_type`: String indicating if the function should output a list or a data frame. Possible options are "list" and "data.frame", default is "list". ### Value If `output_type=="list"`, a list of data frames, one for each club; each data frame will contain transition paths for the units in the correspondent club. If `output_type=="data.frame"`, a data.frame. ``` -------------------------------- ### Extract Transition Paths from Convergence Clubs Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Extracts transition paths from a convergence.clubs object. Can output results as a data frame. ```R # Extract Transition Paths tp <- transition_paths(clubs) tp <- transition_paths(clubs, output_type = 'data.frame') ``` -------------------------------- ### Summary Method for Convergence Clubs Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Provides a summary for an S3 object of class 'convergence.clubs'. This method is used to generate and display summary statistics. ```R summary(object, ...) ``` -------------------------------- ### plot.convergence.clubs Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Plots the transition paths of units within convergence clubs and their average transition paths. This method is part of the S3 class 'convergence.clubs'. ```APIDOC ## plot.convergence.clubs ### Description Plot the transition paths of units in the convergence clubs and the average transition paths of those clubs. ### Usage ```R ## S3 method for class 'convergence.clubs' plot( x, y = NULL, nrows = NULL, ncols = NULL, clubs, avgTP = TRUE, avgTP_clubs, y_fixed = FALSE, legend = FALSE, save = FALSE, filename, path, width = 20, height = 15, device = c("pdf", "png", "jpeg"), res, plot_args, legend_args, breaks, ... ) ``` ``` -------------------------------- ### Print method for S3 object `summary.convergence.clubs` Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Prints a summary table for an object of class `summary.convergence.clubs`. This is typically used after calling the `summary()` method on a `convergence.clubs` object. ```APIDOC ## Print method for S3 object `summary.convergence.clubs` Prints a summary table for an object of class `summary.convergence.clubs`. This is typically used after calling the `summary()` method on a `convergence.clubs` object. ### Usage ```R print_table(x, ...) ``` ### Arguments * `x`: An object of class `summary.convergence.clubs`. * `...`: Only present for compatibility with function `print()`. ``` -------------------------------- ### Summary method for S3 object `convergence.clubs` Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Provides a summary of a `convergence.clubs` object. This method is part of the S3 object system in R and is automatically called when you apply the `summary()` function to an object of this class. ```APIDOC ## Summary method for S3 object `convergence.clubs` Provides a summary of a `convergence.clubs` object. This method is part of the S3 object system in R and is automatically called when you apply the `summary()` function to an object of this class. ### Usage ```R ## S3 method for class 'convergence.clubs' summary(object, ...) ``` ### Arguments * `object`: An object of class `convergence.clubs`. * `...`: Other parameters to pass to function `summary()`. ``` -------------------------------- ### Plot Transition Paths for All Clubs Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Plots the transition paths for all identified convergence clubs. Supports fixed y-axis, custom layout dimensions (nrows, ncols), and graphical parameters like line type (lty), line width (lwd), and color (col). ```R plot(clubs) ``` ```R plot(clubs, y_fixed=TRUE) ``` ```R plot(clubs, nrows=2,ncols=4) ``` ```R plot(clubs, ncols=3, lty='dotdash', lwd=3, col="blue") ``` ```R plot(clubs, ncols=3, y_fixed=TRUE, lty='dotdash', lwd=3, col="blue") ``` -------------------------------- ### BibTeX Entry for ConvergenceClubs Package Source: https://cran.r-project.org/web/packages/ConvergenceClubs/citation.html Use this BibTeX entry to cite the ConvergenceClubs package in academic papers and bibliographies. It includes author, title, year, journal, and URL. ```bibtex @Article{ author = {Roberto Sichera and Pietro Pizzuto}, title = {ConvergenceClubs: A Package for Performing the Phillips and Sul's Club Convergence Clustering Procedure}, year = {2019}, journal = {The R Journal}, url = {https://journal.r-project.org/archive/2019/RJ-2019-021/index.html}, } ``` -------------------------------- ### Find Convergence Clubs with AQSB HAC Method Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Clusters countries using GDP data, applying the Phillips and Sul method with the AQSB HAC method and a cstar of 0. Requires the `filteredGDP` dataset. ```R # Cluster Countries using GDP from year 1970 to year 2003 clubs <- findClubs(filteredGDP, dataCols=2:35, unit_names = 1, refCol=35, time_trim = 1/3, HACmethod = "AQSB", cstar = 0) ``` -------------------------------- ### Find Convergence Clubs using Phillips and Sul Procedure Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Applies the Phillips and Sul clustering algorithm to identify convergence clubs. Requires a dataframe with time-series data, specifying data columns, a reference column for ordering, and optional unit names. Parameters control time trimming, HAC method, and cstar thresholding. ```R findClubs( X, dataCols, unit_names = NULL, refCol, time_trim = 1/3, HACmethod = c("FQSB", "AQSB"), cstar = 0, cstar_method = c("fixed", "incremental"), cstar_increment = 0.1, cstar_cap = 3 ) ``` -------------------------------- ### Plot Convergence Club Transition Paths Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Plots the transition paths of individual units within convergence clubs and their average transition paths. Allows customization of plot layout, display of average paths, and saving to a file. ```R plot( x, y = NULL, nrows = NULL, ncols = NULL, clubs, avgTP = TRUE, avgTP_clubs, y_fixed = FALSE, legend = FALSE, save = FALSE, filename, path, width = 20, height = 15, device = c("pdf", "png", "jpeg"), res, plot_args, legend_args, breaks, ... ) ``` -------------------------------- ### Extract Transition Paths Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Extracts transition paths for each club from a 'convergence.clubs' object. Allows including unit names and choosing between list or data frame output. ```R transition_paths( clubs, include_unit_names = TRUE, output_type = c("list", "data.frame") ) ``` -------------------------------- ### Estimate log-t regression model for convergence Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Estimates the log-t regression model using the Phillips and Sul (2007, 2009) methodology. Supports Fixed Quadratic Spheric Bandwidth (FQSB) or Adaptive Quadratic Spheric Bandwidth (AQSB) for HAC standard errors. Use when investigating convergence patterns in panel data. ```R estimateMod(H, time_trim = 1/3, HACmethod = c("FQSB", "AQSB")) ``` -------------------------------- ### Load GDP Dataset in R Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Loads the GDP dataset, which contains per-capita GDP for 152 countries from 1970 to 2003. This dataset is useful for demonstrating the package's functionality. ```r data(GDP) ``` -------------------------------- ### Plot Transition Paths for Specific Clubs Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Plots transition paths for a subset of clubs. Allows specifying which clubs to plot, custom layout, and options to disable average transition path calculation (avgTP) or enable legend display. Can also specify clubs for averaging transition paths (avgTP_clubs). ```R plot(clubs, clubs=c(2,4,5)) ``` ```R plot(clubs, nrows=1, ncols=3, clubs=c(2,4,5), avgTP = FALSE) ``` ```R plot(clubs, nrows=1, ncols=3, clubs=c(2,4,5), avgTP = FALSE, legend=TRUE) ``` ```R plot(clubs, clubs=c(2,4,5), avgTP_clubs = c(1,3)) ``` ```R plot(clubs, clubs=c(2,4,5), avgTP_clubs = c(1,3), legend=TRUE) ``` -------------------------------- ### Convergence Clubs Algorithm Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html This function implements the Phillips and Sul (2007, 2009) algorithm to identify convergence clubs in a dataset. It performs a log-t regression and identifies core groups based on specified criteria. ```APIDOC ## Convergence Clubs Algorithm ### Description Implements the Phillips and Sul (2007, 2009) algorithm to identify convergence clubs. ### Arguments - **X** (dataframe) - Dataframe containing the data. Must not contain NA or NaN values. - **dataCols** (integer vector) - Column indices of the data to be used. - **time_trim** (numeric) - Portion of time periods to trim (0 to 1). Default is 1/3. - **threshold** (numeric) - Threshold for the one-tail t-test. Default is -1.65. - **HACmethod** (string) - Method for HAC standard errors: "FQSB" (Fixed Quadratic Spheric Bandwidth) or "AQSB" (Adaptive Quadratic Spheric Bandwidth). Default is "FQSB". - **type** (string) - Type of region to include: "max" (maximum t-value region) or "all" (all units passing the test). Default is "max". ### Details The function identifies core group size `k*` by maximizing `k` subject to `min(t_k) > -1.65`. If `type="all"`, all units satisfying `t_k > -1.65` are included. The algorithm handles cases where the condition does not hold for initial units or pairs. ### Value A numeric vector containing the row indices of units in the core group, or `FALSE` if no core group is found. ### References Phillips, P. C.; Sul, D., 2007. Transition modeling and econometric convergence tests. Econometrica 75 (6), 1771-1855. Phillips, P. C.; Sul, D., 2009. Economic transition and growth. Journal of Applied Econometrics 24 (7), 1153-1185. ``` -------------------------------- ### Export Customized Plots of Convergence Clubs Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Customize plots of convergence clubs by controlling average transition paths, legends, markers, and saving options. Adjust plot dimensions and label formatting for clarity. ```R plot(clubs, clubs=NULL, avgTP = TRUE, legend=TRUE) ``` ```R plot(clubs, save = TRUE, filename ="name.pdf" , path = tempdir(), width = 15, height = 10) ``` ```R plot(clubs, legend=TRUE, plot_args=list(type='o'), legend_args=list(max_length_labels=4, y.intersp=1), save = TRUE, filename ="name.pdf", path = tempdir(), width = 15, height = 10) ``` ```R plot(clubs, clubs=1, avgTP=FALSE, legend=TRUE, plot_args=list(type='o'), legend_args=list(max_length_labels=8, y.intersp=1), save = TRUE, filename ="name.pdf", path = tempdir(), width = 20, height = 15) ``` ```R plot(clubs, legend=TRUE, plot_args=list(type='o', xmarks=seq(1,34),xlabs=seq(1970,2003), xlabs_dir=0), legend_args=list(max_length_labels=4, y.intersp=1), save = TRUE, filename ="name.pdf" , path = tempdir(), width = 15, height = 10) ``` ```R plot(clubs, legend=TRUE, plot_args=list(type='o', xmarks=seq(1,34,1), xlabs=seq(1970,2003,1), xlabs_dir=2), legend_args=list(max_length_labels=4, y.intersp=1), save = TRUE, filename ="name.pdf" , path = tempdir(), width = 15, height = 10) ``` ```R plot(clubs, clubs=NULL, avgTP=TRUE, legend=TRUE, plot_args=list(type='o', xmarks=seq(1,34), xlabs=seq(1970,2003), xlabs_dir=0), save = TRUE, filename ="name.pdf" , path = tempdir(), width = 15, height = 10) ``` ```R plot(clubs, legend=TRUE, plot_args=list(type='o'), legend_args=list(max_length_labels=4, y.intersp=1), save = TRUE, filename ="name.png" , path = tempdir(), width = 15, height = 10, device= "png", res=100) ``` -------------------------------- ### Print Convergence Clubs Object Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Prints an S3 object of class 'convergence.clubs'. This method is used to display the object's summary or relevant information. ```R print(x, ...) ``` -------------------------------- ### Print method for S3 object `convergence.clubs` Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Prints the contents of a `convergence.clubs` object. This method is part of the S3 object system in R and is automatically called when you try to print an object of this class. ```APIDOC ## Print method for S3 object `convergence.clubs` Prints the contents of a `convergence.clubs` object. This method is part of the S3 object system in R and is automatically called when you try to print an object of this class. ### Usage ```R ## S3 method for class 'convergence.clubs' print(x, ...) ``` ### Arguments * `x`: An object of class `convergence.clubs`. * `...`: Other parameters to pass to function `summary()`. ``` -------------------------------- ### dim method for S3 object convergence.clubs Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Provides the dimensions of a convergence.clubs object, indicating the number of clubs and divergent units. ```APIDOC ## dim method for S3 object convergence.clubs ### Description `dim` method for S3 object `convergence.clubs` ### Usage ``` ## S3 method for class 'convergence.clubs' dim(x, ...) ``` ### Arguments - **x** (object) - An object of class `convergence.clubs`. - **...** - Other parameters to pass to function `summary()`. ### Value An integer vector with two values: the number of clubs and the number of divergent units. ``` -------------------------------- ### Print Summary Table Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Prints a summary table for an S3 object of class 'summary.convergence.clubs'. This function is for displaying tabular results. ```R print_table(x, ...) ``` -------------------------------- ### Find Convergence Club in R Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Adds units to a core group to find an enlarged convergence club, following step 3 of the Phillips and Sul (2007, 2009) clustering algorithm. Requires specifying data columns, core group, and time trimming parameters. ```r club( X, dataCols, core, time_trim, HACmethod = c("FQSB", "AQSB"), cstar = 0, cstar_method = c("fixed", "incremental"), cstar_increment = 0.1, cstar_cap = 3 ) ``` -------------------------------- ### S3 dim method for convergence.clubs object Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Provides the dimensions of a convergence.clubs object, indicating the number of clubs and divergent units. Used for inspecting the results of convergence analysis. ```R dim(x, ...) ``` -------------------------------- ### Log-t test for convergence Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Estimates the log-t regression model to investigate convergence, using the Phillips and Sul (2007, 2009) methodology with HAC standard errors. ```APIDOC ## Log-t test for convergence ### Description Estimates the _log-t_ regression model proposed by Phillips and Sul (2007, 2009) in order to investigate the presence of convergence by adopting the Andrews estimator of long-run variance (fixed or adaptive bandwidth of the kernel). ### Usage ``` estimateMod(H, time_trim = 1/3, HACmethod = c("FQSB", "AQSB")) ``` ### Arguments - **H** (vector) - Vector of H values. - **time_trim** (numeric) - Portion of time periods to trim (0 to 1). Default is 1/3. - **HACmethod** (string) - Method for HAC standard errors: "FQSB" (Fixed Quadratic Spectral Bandwidth) or "AQSB" (Adaptive Quadratic Spectral Bandwidth). Default is "FQSB". ### Details Estimates the linear model: `log(H1/Ht) - 2*log(log(t)) = alpha + beta*log(t) + ut`. Uses HAC standard errors with Quadratic Spectral kernel (Andrews, 1991). Bandwidth can be fixed ("FQSB") or adaptive ("AQSB"). ### Value A named vector containing beta coefficient, standard deviation, t-statistics, and p-value of the t-test. ``` -------------------------------- ### Load Filtered GDP Data Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Loads the filteredGDP dataset, which contains per-capita GDP for 152 countries from 1970 to 2003. Ensure the data is filtered to remove business cycles before analysis. ```R data(filteredGDP) ``` -------------------------------- ### Find Convergence Clubs Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Clusters countries using GDP data to identify convergence clubs. Requires specifying data columns, unit names, reference column, time trimming, cstar value, and HAC method. ```R data("filteredGDP") #Cluster Countries using GDP from year 1970 to year 2003 clubs <- findClubs(filteredGDP, dataCols=2:35, unit_names = 1, refCol=35, time_trim = 1/3, cstar = 0, HACmethod = "FQSB") summary(clubs) ``` -------------------------------- ### Compute H values for Convergence Analysis Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Computes H values (cross-sectional variance) or transition path h values. Use 'h' for transition path, 'H' for variance, or 'both' for a list. Data should be filtered to remove business cycles and must not contain NA/NaN values. ```R data("filteredGDP") h <- computeH(filteredGDP[,-1], quantity="h") H <- computeH(filteredGDP[,-1], quantity="H") b <- computeH(filteredGDP[,-1], quantity="both") ``` -------------------------------- ### coreG Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Finds the core (primary) group according to step 2 of the clustering algorithm by Phillips and Sul (2007, 2009). This function identifies the main group of units that exhibit convergence behavior. ```APIDOC ## Find core (primary) group ### Description Find the Core (primary) group according to step 2 of the clustering algorithm by Phillips and Sul (2007, 2009) ### Usage ``` coreG( X, dataCols, time_trim, threshold = -1.65, HACmethod = c("FQSB", "AQSB"), type = c("max", "all") ) ``` ### Arguments `X` | dataframe containing data (preferably filtered data in order to remove business cycles). Data must not contain any NA or NaN values, otherwise the clustering procedure will be stopped with an error. `dataCols` | integer vector with the column indices of the data `time_trim` | a numeric value between 0 and 1, representing the portion of time periods to trim when running log t regression model. Phillips and Sul (2007, 2009) suggest to discard the first third of the period. `threshold` | numeric scalar, indicating the threshold value of the sieve criterion `c∗c^*c∗` to include units in the detected core (primary) group (step 3 of Phillips and Sul (2007, 2009) clustering algorithm). The default value is 0. `HACmethod` | string indicating whether a Fixed Quadratic Spheric Bandwidth (`HACmethod="FQSB"`) or an Adaptive Quadratic Spheric Bandwidth (`HACmethod="AQSB"`) should be used for the truncation of the Quadratic Spectral kernel in estimating the `logtlog tlogt` regression model with heteroskedasticity and autocorrelation consistent standard errors. The default method is "FQSB". `type` | a string specifying whether cstar should be mantained fixed (`cstar_method="fixed"`) or increased iteratively until the whole club satisfies the condition `tvalue>−1.65tvalue>-1.65tvalue>−1.65` (`cstar_method="incremental"`). Default is `cstar_method="fixed"` (see Details). ### Value A list of three objects: `id`, a vector containing the row indices of club units in the original dataframe (input of function `findClubs`); `rows`, a vector of row indices of club units in the current dataset (input of function `club`); `model`, a list containing information about the model used to run the t-test on the units in the club. ### References Phillips, P. C.; Sul, D., 2007. Transition modeling and econometric convergence tests. Econometrica 75 (6), 1771-1855. Phillips, P. C.; Sul, D., 2009. Economic transition and growth. Journal of Applied Econometrics 24 (7), 1153-1185. ``` -------------------------------- ### Find Convergence Clubs using GDP Data Source: https://cran.r-project.org/web/packages/ConvergenceClubs/readme/README.html Clusters countries into convergence clubs using filtered GDP data from 1970 to 2003. Specifies data columns, unit names, reference column, time trimming, cstar value, and HAC method. ```r library(ConvergenceClubs) data("filteredGDP") # Cluster Countries using GDP from year 1970 to year 2003 clubs <- findClubs(filteredGDP, dataCols=2:35, unit_names = 1, refCol=35, time_trim = 1/3, cstar = 0, HACmethod = "FQSB") summary(clubs) ``` -------------------------------- ### Find Convergence Clubs Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Clusters countries using GDP data and applies Phillips and Sul clustering procedure. Requires specifying data columns, reference column, time trim, cstar, and HAC method. ```R data("filteredGDP") # Cluster Countries using GDP from year 1970 to year 2003 clubs <- findClubs(filteredGDP, dataCols=2:35, unit_names = 1, refCol=35, time_trim = 1/3, cstar = 0, HACmethod = "FQSB") summary(clubs) ``` -------------------------------- ### Find Convergence Clubs using GDP Data Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Clusters countries based on GDP data from a specified range of years. Requires filtered GDP data and specifies parameters for clustering such as time trimming, a constant threshold (cstar), and the HAC method. ```R data("filteredGDP") # Cluster Countries using GDP from year 1970 to year 2003 clubs <- findClubs(filteredGDP, dataCols=2:35, unit_names = 1, refCol=35, time_trim = 1/3, cstar = 0, HACmethod = "FQSB") ``` -------------------------------- ### Merge Convergence Clubs using Phillips and Sul Method Source: https://cran.r-project.org/web/packages/ConvergenceClubs/readme/README.html Merges previously identified convergence clubs using the Phillips and Sul (2009) procedure. Divergent units are not merged in this specific call. ```r # Merge clusters mclubs <- mergeClubs(clubs, mergeMethod='PS', mergeDivergent=FALSE) summary(mclubs) ``` -------------------------------- ### findClubs Function Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Finds convergence clubs by means of the Phillips and Sul clustering procedure. This function takes a dataframe of data, specifies which columns contain the data, and optionally includes unit names and a reference column for ordering. It also allows for time trimming, selection of HAC methods, and configuration of parameters for identifying the core group. ```APIDOC ## findClubs ### Description Find convergence clubs by means of Phillips and Sul clustering procedure. ### Usage ```R findClubs( X, dataCols, unit_names = NULL, refCol, time_trim = 1/3, HACmethod = c("FQSB", "AQSB"), cstar = 0, cstar_method = c("fixed", "incremental"), cstar_increment = 0.1, cstar_cap = 3 ) ``` ### Arguments * `X` (dataframe): Dataframe containing data. Data must not contain any NA or NaN values. Each row represents a unit and each column represents a time period. * `dataCols` (integer vector): Column indices of the data. * `unit_names` (integer scalar, optional): Index of a column with codes of the units. * `refCol` (integer scalar): Index of the column to use for ordering data. * `time_trim` (numeric): Portion of time periods to trim (0 to 1). Default is 1/3. * `HACmethod` (string): Method for estimating log-t regression model with heteroskedasticity and autocorrelation consistent standard errors. Options are "FQSB" (Fixed Quadratic Spectral Bandwidth) or "AQSB" (Adaptive Quadratic Spectral Bandwidth). Default is "FQSB". * `cstar` (numeric): Threshold value of the sieve criterion (c∗) to include units in the detected core group. Default is 0. * `cstar_method` (string): Method for cstar. Options are "fixed" or "incremental". Default is "fixed". * `cstar_increment` (numeric): Increment to cstar, used if `cstar_method` is "incremental". Default is 0.1. * `cstar_cap` (scalar): Maximum value for `cstar`. Default is 3. ``` -------------------------------- ### findClubs Function Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Finds clubs of convergence given a dataset with units in rows and years in columns. Returns an object of class 'convergence.clubs'. ```APIDOC ## findClubs ### Description Finds clubs of convergence, given a dataset with units in rows and years in columns, returning an object of class `convergence.clubs`. ### Usage ```R findClubs(X, dataCols, time_trim, HACmethod = c("FQSB", "AQSB"), cstar = 0, cstar_method = c("fixed", "incremental"), cstar_increment = 0.1, cstar_cap = 3) ``` ### Arguments * `X`: A matrix or data frame with units in rows and years in columns. * `dataCols`: A vector of column indices or names corresponding to the years in `X`. * `time_trim`: The number of years to trim from the end of the time series. * `HACmethod`: Method for Heteroskedasticity and Autocorrelation Consistent (HAC) covariance matrix estimation. Options are "FQSB" or "AQSB". * `cstar`: The threshold value for `cstar`. * `cstar_method`: Method for determining `cstar`. Options are "fixed" or "incremental". * `cstar_increment`: The increment for the "incremental" `cstar_method`. * `cstar_cap`: The cap for `cstar`. ### Details This function implements the core logic for identifying convergence clubs as described by Phillips and Sul (2009). ``` -------------------------------- ### Export customized plots Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html This function allows for the export of customized plots related to convergence clubs. It offers various options for customizing the plot appearance, including average transition paths, line types, markers, legends, and labels. Plots can be saved in different formats like PDF or PNG with specified dimensions and resolution. ```APIDOC ## Export customized plots This function allows for the export of customized plots related to convergence clubs. It offers various options for customizing the plot appearance, including average transition paths, line types, markers, legends, and labels. Plots can be saved in different formats like PDF or PNG with specified dimensions and resolution. ### Usage ```R plot(clubs, clubs = NULL, avgTP = TRUE, legend = TRUE, save = FALSE, filename = "name.pdf", path = tempdir(), width = 15, height = 10, device = "pdf", res = 100, plot_args = list(), legend_args = list()) ``` ### Arguments * `clubs`: An object of class `convergence.clubs`. * `clubs`: Specifies which clubs to plot. If `NULL`, plots all clubs. If a specific club index or name, plots that club. * `avgTP`: Logical, if `TRUE` plots the average transition paths for each club. * `legend`: Logical, if `TRUE` displays a legend. * `save`: Logical, if `TRUE` saves the plot to a file. * `filename`: The name of the file to save the plot to. * `path`: The directory where the plot file will be saved. * `width`: The width of the plot in inches. * `height`: The height of the plot in inches. * `device`: The graphics device to use (e.g., "pdf", "png"). * `res`: The resolution of the plot for devices like PNG. * `plot_args`: A list of additional arguments to pass to the plotting function (e.g., `type`, `xmarks`, `xlabs`, `xlabs_dir`). * `legend_args`: A list of additional arguments to pass to the legend function (e.g., `max_length_labels`, `y.intersp`). ### Examples ```R # Plot average transition paths with legend plot(clubs, clubs = NULL, avgTP = TRUE, legend = TRUE) # Save plot as PDF with specific dimensions, no markers, no legend plot(clubs, save = TRUE, filename = "name.pdf", path = tempdir(), width = 15, height = 10) # Plot with markers, legend, and customized label length plot(clubs, legend = TRUE, plot_args = list(type = 'o'), legend_args = list(max_length_labels = 4, y.intersp = 1), save = TRUE, filename = "name.pdf", path = tempdir(), width = 15, height = 10) # Plot individual clubs with larger dimensions and customized labels plot(clubs, clubs = 1, avgTP = FALSE, legend = TRUE, plot_args = list(type = 'o'), legend_args = list(max_length_labels = 8, y.intersp = 1), save = TRUE, filename = "name.pdf", path = tempdir(), width = 20, height = 15) # Customize x-axis labels (example 1) plot(clubs, legend = TRUE, plot_args = list(type = 'o', xmarks = seq(1, 34), xlabs = seq(1970, 2003), xlabs_dir = 0), legend_args = list(max_length_labels = 4, y.intersp = 1), save = TRUE, filename = "name.pdf", path = tempdir(), width = 15, height = 10) # Customize x-axis labels (example 2) plot(clubs, legend = TRUE, plot_args = list(type = 'o', xmarks = seq(1, 34, 1), xlabs = seq(1970, 2003, 1), xlabs_dir = 2), legend_args = list(max_length_labels = 4, y.intersp = 1), save = TRUE, filename = "name.pdf", path = tempdir(), width = 15, height = 10) # Show only average transition paths with customized x-axis plot(clubs, clubs = NULL, avgTP = TRUE, legend = TRUE, plot_args = list(type = 'o', xmarks = seq(1, 34), xlabs = seq(1970, 2003), xlabs_dir = 0), save = TRUE, filename = "name.pdf", path = tempdir(), width = 15, height = 10) # Save plot as PNG with markers and legend plot(clubs, legend = TRUE, plot_args = list(type = 'o'), legend_args = list(max_length_labels = 4, y.intersp = 1), save = TRUE, filename = "name.png", path = tempdir(), width = 15, height = 10, device = "png", res = 100) ``` -------------------------------- ### mergeClubs Function Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Merges convergence clubs based on an existing 'convergence.clubs' object using either the Phillips and Sul (2009) or von Lyncker and Thoennessen (2017) procedure. ```APIDOC ## mergeClubs ### Description Takes as argument an object of class `convergence.clubs` and applies the clustering procedure to the convergence clubs contained in the argument, according to either Phillips and Sul (2009) or von Lyncker and Thoennessen (2017) procedure. ### Usage ```R mergeClubs(object, method = c("PhillipsSul", "vonLynckerThoennessen")) ``` ### Arguments * `object`: An object of class `convergence.clubs`. * `method`: The clustering procedure to apply. Options are "PhillipsSul" or "vonLynckerThoennessen". ``` -------------------------------- ### mergeDivergent Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Merges divergent units into existing convergence clubs using the algorithm proposed by von Lyncker and Thoennessen (2017). ```APIDOC ## mergeDivergent ### Description Merges divergent units according the algorithm proposed by von Lyncker and Thoennessen (2017). ### Usage ```R mergeDivergent(clubs, time_trim, estar = -1.65) ``` ### Arguments * `clubs` (convergence.clubs): An object of class `convergence.clubs` (created by `findClub` or `mergeClubs` function). * `time_trim` (numeric): The portion of time periods to trim when running log t regression model (0 to 1). * `estar` (numeric): The threshold `e*` to test if divergent units may be included in one of the new convergence clubs. To be used only if `mergeDivergent=TRUE`. ### Details This function specifically implements the merging of divergent units as described in the von Lyncker and Thoennessen (2017) paper, allowing for a more inclusive club definition. ### References von Lyncker, K.; Thoennessen, R., 2017. Regional club convergence in the EU: evidence from a panel data analysis. Empirical Economics 52 (2), 525-553. ### See Also `findClubs`, `mergeClubs` ``` -------------------------------- ### Merge Convergence Clubs using von Lyncker and Thoennessen Method Source: https://cran.r-project.org/web/packages/ConvergenceClubs/readme/README.html Merges previously identified convergence clubs using the von Lyncker and Thoennessen (2017) procedure. Divergent units are not merged in this specific call. ```r mclubs <- mergeClubs(clubs, mergeMethod='vLT', mergeDivergent=FALSE) summary(mclubs) ``` -------------------------------- ### club Function Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Adds units to a core group according to step 3 of the clustering algorithm by Phillips and Sul (2007, 2009) to find the enlarged club. ```APIDOC ## club ### Description Add units to core group according to step 3 of the clustering algorithm by Phillips and Sul (2007, 2009), in order to find the enlarged club. ### Usage ```R club( X, dataCols, core, time_trim, HACmethod = c("FQSB", "AQSB"), cstar = 0, cstar_method = c("fixed", "incremental"), cstar_increment = 0.1, cstar_cap = 3 ) ``` ### Arguments * `X`: A matrix or data frame with units in rows and years in columns. * `dataCols`: A vector of column indices or names corresponding to the years in `X`. * `core`: A vector of indices representing the core group units. * `time_trim`: The number of years to trim from the end of the time series. * `HACmethod`: Method for Heteroskedasticity and Autocorrelation Consistent (HAC) covariance matrix estimation. Options are "FQSB" or "AQSB". * `cstar`: The threshold value for `cstar`. * `cstar_method`: Method for determining `cstar`. Options are "fixed" or "incremental". * `cstar_increment`: The increment for the "incremental" `cstar_method`. * `cstar_cap`: The cap for `cstar`. ``` -------------------------------- ### Estimate Long Run Variance of Errors Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Estimates the long run variance of errors using Andrews' method with a Quadratic Spectral kernel and fixed bandwidth. This is an adaptation of Phillips and Sul (2007)'s code. ```R ps_andrews_hac(x) ``` -------------------------------- ### computeH Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Computes H values (cross-sectional variance) according to the clustering algorithm by Phillips and Sul (2007, 2009). This function calculates the cross-sectional variation `HitH_{it}` which is a quadratic distance measure for the panel from the common limit. ```APIDOC ## computeH ### Description Computes H values (cross-sectional variance) according to the clustering algorithm by Phillips and Sul (2007, 2009) ### Usage ``` computeH(X, quantity = "H", id) ``` ### Arguments `X` | matrix or dataframe containing data (preferably filtered, in order to remove business cycles) ---|--- `quantity` | string indicating the quantity that should be returned. The options are `"H"`, the default, only the vector of cross-sectional variance is returned; `"h"`, only the matrix of transition path h is return; `"both"`, a list containing both h and H is returned. `id` | optional; row index of regions for which H values are to be computed; if missing, all regions are used ### Details The cross sectional variation `HitH_{it}Hit​` is computed as the quadratic distance measure for the panel from the common limit and under the hypothesis of the model should converge to zero as _t_ tends towards infinity: `Ht=N−1∑i=1N(hit−1)2→0,t→∞H_t = N^{-1} ∑_{i=1}^N (h_{it}-1)^2 → 0 , t→ ∞Ht​=N−1∑i=1N​(hit​−1)2→0,t→∞` where `hit=log⁡yit(N−1∑i=1Nlog yit)h_{it} = rac{\log y_{it}}{( N^{-1} ∑_{i=1}^N ​log ​ y_{it} )} hit​=(N−1∑i=1N​logyit​)logyit​​` ### Value A numeric vector, a matrix or a list, depending on the value of `quantity` ### References Phillips, P. C.; Sul, D., 2007. Transition modeling and econometric convergence tests. Econometrica 75 (6), 1771-1855. Phillips, P. C.; Sul, D., 2009. Economic transition and growth. Journal of Applied Econometrics 24 (7), 1153-1185. ### Examples ```R data("filteredGDP") h <- computeH(filteredGDP[,-1], quantity="h") H <- computeH(filteredGDP[,-1], quantity="H") b <- computeH(filteredGDP[,-1], quantity="both") ``` ``` -------------------------------- ### Merge Convergence Clubs and Divergent Units Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Merges identified convergence clubs and optionally includes divergent units. The `mergeDivergent` argument controls the inclusion of units not belonging to any club. ```R # Merge clusters and divergent units mclubs <- mergeClubs(clubs, mergeDivergent=TRUE) summary(mclubs) ``` -------------------------------- ### Long run variance of errors (ps_andrews_hac) Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Estimates the long-run variance of errors using Andrews' method with a Quadratic Spectral kernel and fixed bandwidth. This function is adapted from Phillips and Sul (2007) and is useful for heteroskedasticity and autocorrelation consistent covariance matrix estimation. ```APIDOC ## Long run variance of errors Estimates the long-run variance of errors using Andrews' method with a Quadratic Spectral kernel and fixed bandwidth. This function is adapted from Phillips and Sul (2007) and is useful for heteroskedasticity and autocorrelation consistent covariance matrix estimation. ### Usage ```R ps_andrews_hac(x) ``` ### Arguments * `x`: Vector of residuals. ### Details This function computes the long run variance of residuals of an lm model by means of Andrews' with Quadratic Spectral kernel and fixed bandwidth. The code is an adaptation of Phillips and Sul (2007)'s code, which was written in _GAUSS_. ### Value A numeric value representing the long run variance of errors. ### References Andrews, D. W., 1991. Heteroskedasticity and autocorrelation consistent covariance matrix estimation. Econometrica: Journal of the Econometric Society, 817-858. Phillips, P. C.; Sul, D., 2007. Transition modeling and econometric convergence tests. Econometrica 75 (6), 1771-1855. ``` -------------------------------- ### Merge Divergent Units Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Merges divergent units based on the algorithm by von Lyncker and Thoennessen (2017), using a specified threshold (estar). ```R mergeDivergent(clubs, time_trim, estar = -1.65) ``` -------------------------------- ### axis_marks Function Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Defines the vector of tick marks for the axis of a plot. ```APIDOC ## axis_marks ### Description Define the vector of tick marks for the axis of a plot ### Usage ```R axis_marks(lx) ``` ### Arguments * `lx`: integer scalar, representing the length of the x or y vector. ``` -------------------------------- ### Define Axis Tick Marks in R Source: https://cran.r-project.org/web/packages/ConvergenceClubs/refman/ConvergenceClubs.html Defines the vector of tick marks for a plot axis. This function is useful for customizing plot aesthetics. ```r axis_marks(lx) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.