### Install ConvergenceClubs Development Version from GitHub Source: https://github.com/rhobis/convergenceclubs/blob/master/README.md Install the latest development version from GitHub. Ensure the 'devtools' package is installed first. ```r # if not present, install 'devtools' package install.packages("devtools") devtools::install_github("rhobis/ConvergenceClubs") ``` -------------------------------- ### Install ConvergenceClubs from CRAN Source: https://github.com/rhobis/convergenceclubs/blob/master/README.md Use this command to install the package from the Comprehensive R Archive Network. ```r install.packages("ConvergenceClubs") ``` -------------------------------- ### Install ConvergenceClubs Package Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/index.html Install the ConvergenceClubs package from CRAN. For the development version, use devtools::install_github. ```r install.packages("ConvergenceClubs") ``` ```r # if not present, install 'devtools' package install.packages("devtools") devtools::install_github("rhobis/ConvergenceClubs") ``` -------------------------------- ### ConvergenceClubs-package Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/index.html Provides an overview and documentation for the ConvergenceClubs package. ```APIDOC ## ConvergenceClubs-package ### Description ConvergenceClubs: Finding Convergence Clubs. ### Parameters This package documentation does not explicitly list parameters. ``` -------------------------------- ### Plot Transition Paths for All Regions and Average Paths Source: https://github.com/rhobis/convergenceclubs/blob/master/README.md Generates a plot showing the transition paths for all regions within each club, as well as the average transition path for each club. This visualization helps in understanding convergence dynamics. ```r # Plot Transition Paths for all regions in each club and average Transition Path # for all clubs plot(mclubs) ``` -------------------------------- ### Plot Transition Paths for All Clubs Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/plot.convergence.clubs.html Generates a plot showing transition paths for all convergence clubs. Requires an object of class `convergence.clubs`. ```r data("countryGDP") clubs <- findClubs(countryGDP, dataCols=2:35, regions = 1, refCol=35, time_trim = 1/3, cstar = 0, HACmethod = "FQSB") #plot transition paths for all clubs plot(clubs) ``` -------------------------------- ### Plot Transition Paths with Custom Layout Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/plot.convergence.clubs.html Plots transition paths for all clubs using a specified grid layout (e.g., 2 rows, 4 columns). Useful for organizing multiple club plots. ```r plot(clubs, nrows=2,ncols=4) ``` -------------------------------- ### Plot Average Transition Paths with Legend Source: https://github.com/rhobis/convergenceclubs/blob/master/README.md Generates a plot of average transition paths for convergence clubs, including a legend to identify each club. This is useful for distinguishing between different clubs in the visualization. ```r plot(mclubs, clubs=NULL, legend=TRUE) ``` -------------------------------- ### Plot Transition Paths with Custom Line Styles Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/plot.convergence.clubs.html Plots transition paths with custom line styles (dashed, thicker, blue color) and a specified number of columns. Allows for distinct visual representation of paths. ```r plot(clubs, ncols=3, lty='dotdash', lwd=3, col="blue") ``` -------------------------------- ### Find Clubs with FQSB HAC Method and Summarize Results Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/findClubs.html Identifies convergence clubs using the FQSB HAC method and then summarizes the results. This is useful for understanding the club structure and divergent units. ```r clubs <- findClubs(countryGDP, dataCols\=2:35, regions \= 1, refCol\=35, time\_trim \= 1/3, cstar \= 0, HACmethod \= "FQSB") summary(clubs) ``` -------------------------------- ### Plot Transition Paths Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/index.html Plot transition paths for all regions in each club and the average transition path for all clubs. Can also plot only average paths. ```r # Plot Transition Paths for all regions in each club and average Transition Path # for all clubs plot(mclubs) ``` ```r # Plot Only average Transition Paths plot(mclubs, clubs=NULL) ``` ```r plot(mclubs, clubs=NULL, legend=TRUE) ``` -------------------------------- ### summary.convergence.clubs Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/index.html Provides a summary for S3 objects of class 'convergence.clubs'. ```APIDOC ## summary(__) ### Description Summary method for S3 object `convergence.clubs`. ### Parameters This method does not explicitly list parameters in the provided documentation. ``` -------------------------------- ### print.convergence.clubs Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/index.html Prints the details of S3 objects of class 'convergence.clubs'. ```APIDOC ## print(__) ### Description Print method for S3 object `convergence.clubs`. ### Parameters This method does not explicitly list parameters in the provided documentation. ``` -------------------------------- ### Plot Only Average Transition Paths Source: https://github.com/rhobis/convergenceclubs/blob/master/README.md Generates a plot displaying only the average transition paths for each convergence club, omitting individual region paths. This provides a high-level view of club convergence. ```r # Plot Only average Transition Paths plot(mclubs, clubs=NULL) ``` -------------------------------- ### Compute H values with different quantities Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/computeH.html Demonstrates how to use the `computeH` function to retrieve different quantities: 'h' (transition path), 'H' (cross-sectional variance), or 'both'. Ensure the `countryGDP` dataset is loaded before running. ```R data("countryGDP") h <- computeH(countryGDP[,-1], quantity="h") H <- computeH(countryGDP[,-1], quantity="H") b <- computeH(countryGDP[,-1], quantity="both") ``` -------------------------------- ### Plot Transition Paths with Custom Layout and Line Styles Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/plot.convergence.clubs.html Plots transition paths with a custom layout, fixed y-axis scale, and custom line styles (dashed, thicker, blue color). Combines layout control with visual customization. ```r plot(clubs, ncols=3, y_fixed=TRUE, lty='dotdash', lwd=3, col="blue") ``` -------------------------------- ### estimateMod() Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/index.html Performs a log-t test for convergence. ```APIDOC ## estimateMod() ### Description Log-t test for convergence. ### Parameters This function does not explicitly list parameters in the provided documentation. ``` -------------------------------- ### club() Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/index.html Finds a specific club within the convergence analysis. ```APIDOC ## club() ### Description Find a club. ### Parameters This function does not explicitly list parameters in the provided documentation. ``` -------------------------------- ### dim.convergence.clubs Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/index.html The 'dim' method for S3 objects of class 'convergence.clubs'. ```APIDOC ## dim(__) ### Description `dim` method for S3 object `convergence.clubs`. ### Parameters This method does not explicitly list parameters in the provided documentation. ``` -------------------------------- ### dim.convergence.clubs Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/dim.convergence.clubs.html S3 method for convergence.clubs objects. It returns the number of clubs and divergent units. ```APIDOC ## dim.convergence.clubs ### Description This S3 method is designed to work with objects of the class `convergence.clubs`. It calculates and returns dimensions related to clubs and divergent units within the object. ### Method `dim(x, ...)` ### Parameters #### Arguments - **x** (convergence.clubs) - An object of class `convergence.clubs`. - **...** - Other parameters to be passed to the `summary()` function. ### Value An integer vector with two values: - The first value indicates the number of clubs. - The second value indicates the number of divergent units. ``` -------------------------------- ### Plot Transition Paths for Specific Clubs Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/plot.convergence.clubs.html Generates plots for a subset of specified convergence clubs (e.g., clubs 2, 4, and 5). Useful for focusing on particular groups. ```r plot(clubs, clubs=c(2,4,5)) ``` -------------------------------- ### Plot Specific Clubs with Specific Average Paths Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/plot.convergence.clubs.html Plots transition paths for specified clubs (e.g., 2, 4, 5) and displays average transition paths only for a subset of those clubs (e.g., clubs 1 and 3). ```r plot(clubs, clubs=c(2,4,5), avgTP_clubs = c(1,3)) ``` -------------------------------- ### computeH() Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/index.html Computes the H values, likely related to convergence metrics. ```APIDOC ## computeH() ### Description Compute H values. ### Parameters This function does not explicitly list parameters in the provided documentation. ``` -------------------------------- ### Plot Specific Clubs with Specific Average Paths and Legend Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/plot.convergence.clubs.html Plots transition paths for specified clubs (e.g., 2, 4, 5), displays average transition paths for a subset (e.g., 1, 3), and includes a legend. ```r plot(clubs, clubs=c(2,4,5), avgTP_clubs = c(1,3), legend=TRUE) ``` -------------------------------- ### findClubs() Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/index.html Identifies and returns convergence clubs from the data. ```APIDOC ## findClubs() ### Description Finds convergence clubs. ### Parameters This function does not explicitly list parameters in the provided documentation. ``` -------------------------------- ### Plot Only Average Transition Paths with Legend Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/plot.convergence.clubs.html Generates a plot displaying only the average transition paths for all clubs, including a legend. Set `clubs = NULL` to exclude individual club paths. ```r plot(clubs, clubs=NULL, avgTP = TRUE, legend=TRUE) ``` -------------------------------- ### plot.convergence.clubs Function Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/plot.convergence.clubs.html Plots the transition paths of regions in convergence clubs and the average transition paths of those clubs. ```APIDOC ## plot.convergence.clubs ### Description Plots the transition paths of regions in convergence clubs and the average transition paths of those clubs. ### Method S3 method for convergence.clubs ### Signature plot(x, y = NULL, nrows = NULL, ncols = NULL, clubs, avgTP = TRUE, avgTP_clubs, y_fixed = FALSE, legend = FALSE, save = FALSE, filename, path, width = 7, height = 7, device = c("pdf", "png", "jpeg"), res, ...) ### Arguments - **x** (convergence.clubs): An object of class `convergence.clubs`. - **y** (unused): Added for compatibility with the generic `plot` function. - **nrows** (numeric | NULL): Number of rows for the graphical layout. If NULL, it is automatically defined. - **ncols** (numeric | NULL): Number of columns for the graphical layout. If NULL, it is automatically defined. - **clubs** (numeric vector | NULL): Indicates for which clubs the transition path plot should be generated. Optional; if omitted, plots for all clubs are produced. If `NULL`, transition paths are not plotted for any club. - **avgTP** (logical): Indicates if a plot of the average transition paths of the convergence clubs should be produced. Defaults to `TRUE`. - **avgTP_clubs** (numeric vector): Indicates for which clubs the average transition path should be displayed. Optional; if omitted, average transition paths for all clubs are plotted. - **y_fixed** (logical): Should the scale of the y axis be the same for all plots? - **legend** (logical): Should a legend be displayed? - **save** (logical): Should the plot be saved as a file? - **filename** (string): Optional name of the file where the plot should be saved (e.g., "plot.pdf"). - **path** (string): Optional path of the directory where the plot should be saved. - **width** (numeric): The width of the plot in inches. Defaults to 7. - **height** (numeric): The height of the plot in inches. Defaults to 7. - **device** (string): Format to be used to save the plot; one of "pdf", "png", or "jpeg". - **res** (numeric): The resolution of the image in ppi; only used with `device="png"` and `device="jpeg"`. - **...** (any): Other parameters to pass to the generic `plot()` function. ### Details - `nrows` and `ncols` can be used to define the plot layout dimensions. If neither is specified, the layout is chosen automatically. - Graphical parameters for the horizontal line at y=1 can be modified using `lty` (line type), `lwd` (line width), and `col` (line color). - If `legend=TRUE` and region names are available, they are truncated to fit. `cex` can adjust legend label size (default 0.8). - When using RStudio, ensure the plot window is sufficiently large to avoid errors. ### Examples ```R data("countryGDP") clubs <- findClubs(countryGDP, dataCols=2:35, regions = 1, refCol=35, time_trim = 1/3, cstar = 0, HACmethod = "FQSB") # Plot transition paths for all clubs plot(clubs) # Plot with fixed y-axis scale plot(clubs, y_fixed=TRUE) # Plot with specified layout plot(clubs, nrows=2, ncols=4) # Plot with custom line style and color plot(clubs, ncols=3, lty='dotdash', lwd=3, col="blue") # Plot specific clubs plot(clubs, clubs=c(2,4,5)) # Plot specific clubs without average transition paths plot(clubs, nrows=1, ncols=3, clubs=c(2,4,5), avgTP = FALSE) # Plot specific clubs with legend plot(clubs, nrows=1, ncols=3, clubs=c(2,4,5), avgTP = FALSE, legend=TRUE) # Plot specific clubs with specific average transition paths plot(clubs, clubs=c(2,4,5), avgTP_clubs = c(1,3)) # Plot specific clubs with specific average transition paths and legend plot(clubs, clubs=c(2,4,5), avgTP_clubs = c(1,3), legend=TRUE) # Only plot average transition paths plot(clubs, clubs=NULL, avgTP = TRUE, legend=TRUE) ``` ``` -------------------------------- ### Find Clubs with AQSB HAC Method Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/findClubs.html Identifies convergence clubs using the AQSB HAC method. Ensure countryGDP data and relevant parameters are defined. ```r clubs <- findClubs(countryGDP, dataCols\=2:35, regions \= 1, refCol\=35, time\_trim \= 1/3, cstar \= 0, HACmethod \= "AQSB") ``` -------------------------------- ### Merge Convergence Clubs using Phillips and Sul Method Source: https://github.com/rhobis/convergenceclubs/blob/master/README.md Merges previously found convergence clubs using the Phillips and Sul (PS) method. Divergent regions are not merged in this specific call. ```r # Merge clusters mclubs <- mergeClubs(clubs, mergeMethod='PS', mergeDivergent=FALSE) summary(mclubs) ``` -------------------------------- ### coreG() Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/index.html Identifies the core or primary group in the convergence analysis. ```APIDOC ## coreG() ### Description Find core (primary) group. ### Parameters This function does not explicitly list parameters in the provided documentation. ``` -------------------------------- ### Load countryGDP Dataset Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/countryGDP.html Loads the countryGDP dataset into the R environment. This dataset contains GDP information for 152 countries over 34 years. ```r data(countryGDP) ``` -------------------------------- ### Merge Convergence Clubs (Phillips and Sul) Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/index.html Merge convergence clubs using the Phillips and Sul (2009) method. Optionally merge divergent units. ```r # Merge clusters using Phillips and Sul (2009) method mclubs <- mergeClubs(clubs, mergeMethod='PS', mergeDivergent=FALSE) summary(mclubs) ``` -------------------------------- ### mergeClubs() Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/index.html Merges identified convergence clubs. ```APIDOC ## mergeClubs() ### Description Merge convergence clubs. ### Parameters This function does not explicitly list parameters in the provided documentation. ``` -------------------------------- ### Plot Specific Clubs without Average Paths and with Legend Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/plot.convergence.clubs.html Plots transition paths for specified clubs (e.g., 2, 4, 5) without average paths, and includes a legend. Uses a custom layout (1 row, 3 columns). ```r plot(clubs, nrows=1, ncols=3, clubs=c(2,4,5), avgTP = FALSE, legend=TRUE) ``` -------------------------------- ### Merge Convergence Clubs (von Lyncker and Thoennessen) Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/index.html Merge convergence clubs using the von Lyncker and Thoennessen (2016) method. Optionally merge divergent units. ```r # Merge clusters using von Lyncker and Thoennessen (2016) method mclubs <- mergeClubs(clubs, mergeMethod='vLT', mergeDivergent=FALSE) summary(mclubs) ``` -------------------------------- ### Find Convergence Clubs Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/mergeDivergent.html Clusters countries using GDP data from 1970 to 2003. This is a prerequisite for merging divergent units. ```R data("countryGDP") #Cluster Countries using GDP from year 1970 to year 2003 clubs <- findClubs(countryGDP, dataCols=2:35, regions = 1, refCol=35, time_trim = 1/3, cstar = 0, HACmethod = "AQSB") summary(clubs) ``` -------------------------------- ### findClubs Function Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/findClubs.html Finds convergence clubs by means of Phillips and Sul clustering procedure. ```APIDOC ## findClubs ### Description Finds convergence clubs by means of Phillips and Sul clustering procedure. ### Arguments - **X** (dataframe) - Required - dataframe containing data (preferably filtered data in order to remove business cycles) - **dataCols** (integer vector) - Required - the column indices of the data - **regions** (integer scalar) - Optional - the index of a column with codes of the regions - **refCol** (integer scalar) - Required - the index of the column to use for ordering data - **time_trim** (numeric) - Optional - 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. Default is 1/3. - **cstar** (numeric scalar) - Optional - the threshold value of the sieve criterion \(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) - Optional - indicating whether a Fixed Quadratic Spectral Bandwidth (`HACmethod="FQSB"`) or an Adaptive Quadratic Spectral Bandwidth (`HACmethod="AQSB"`) should be used for the truncation of the Quadratic Spectral kernel in estimating the _log-t_ regression model with heteroskedasticity and autocorrelation consistent standard errors. The default method is "FQSB". ### Value An object of class `convergence.clubs`, containing a list of Convergence Clubs. For each club, a list is returned with the following objects: `id` (a vector containing the row indices of the regions in the club), `model` (a list containing information about the model used to run the t-test on the regions in the club), `regions` (a vector containing the names of the regions of the club, optional, only included if parameter `regions` is given). ### Details Implements the Phillips and Sul clustering procedure to investigate the presence of convergence clubs. Steps include: 1. Cross-section last observation ordering. 2. Core group formation. 3. Sieve the data for club membership. 4. Recursion and stopping rule. ### 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. - Andrews, D. W., 1991. Heteroskedasticity and autocorrelation consistent covariance matrix estimation. Econometrica: Journal of the Econometric Society, 817-858. ### See Also - `[mergeClubs](mergeClubs.html)` - `[mergeDivergent](mergeDivergent.html)` ### Examples ```R data("countryGDP") # NOT RUN { # Cluster Countries using GDP from year 2000 to year 2014 # findClubs(X = countryGDP, dataCols = c(1, 2), refCol = 3, time_trim = 1/3) # } ``` ``` -------------------------------- ### Plot Specific Clubs without Average Paths Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/plot.convergence.clubs.html Plots transition paths for specified clubs (e.g., 2, 4, 5) without displaying the average transition paths. Uses a custom layout (1 row, 3 columns). ```r plot(clubs, nrows=1, ncols=3, clubs=c(2,4,5), avgTP = FALSE) ``` -------------------------------- ### Plot Transition Paths with Fixed Y-axis Scale Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/plot.convergence.clubs.html Plots transition paths for all clubs with a fixed y-axis scale across all subplots for consistent comparison. Use when the range of transition paths varies significantly between clubs. ```r plot(clubs, y_fixed=TRUE) ``` -------------------------------- ### Find Convergence Clubs using GDP Data Source: https://github.com/rhobis/convergenceclubs/blob/master/README.md Loads the 'filteredGDP' dataset and applies the 'findClubs' function to cluster countries based on GDP data from 1970 to 2003. Specifies data columns, unit names, reference column, time trimming, 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) ``` -------------------------------- ### plot.convergence.clubs Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/index.html Generates a plot for S3 objects of class 'convergence.clubs'. ```APIDOC ## plot(__) ### Description Plot method for S3 class `convergence.clubs`. ### Parameters This method does not explicitly list parameters in the provided documentation. ``` -------------------------------- ### estimateMod Function Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/estimateMod.html Estimates the log-t regression model proposed by Phillips and Sul (2007, 2009) to investigate convergence. It utilizes the Andrews estimator for long-run variance with specified kernel bandwidth methods. ```APIDOC ## estimateMod Function ### 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). ### Arguments * **H** (vector) - vector of H values * **time_trim** (numeric) - 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. * **HACmethod** (string) - string indicating whether a Fixed Quadratic Spectral Bandwidth (`HACmethod="FQSB"`) or an Adaptive Quadratic Spectral Bandwidth (`HACmethod="AQSB"`) should be used for the truncation of the Quadratic Spectral kernel in estimating the _log t_ regression model with heteroskedasticity and autocorrelation consistent standard errors. The default method is "FQSB". ### Value A list containing information about the model used to run the t-test on the regions in the club: beta coefficient, standard deviation, t-statistics and p-value. ### Details The following linear model is estimated: $$\log\frac{H\_1}{H\_t} - 2\log(\log{t}) = \alpha + \beta \log{t} + u\_t$$ Heteroskedasticity and autocorrelation consistent (HAC) standard errors are used with Quadratic Spectral kernel (Andrews, 1991), If `HACmethod`\="FQSB", a fixed bandwidth parameter is applied, while with `HACmethod`\="AQSB" an adaptive bandwidth parameter is employed. ### 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. Andrews, D. W., 1991. Heteroskedasticity and autocorrelation consistent covariance matrix estimation. Econometrica: Journal of the Econometric Society, 817-858. ``` -------------------------------- ### Merge Convergence Clubs using von Lyncker and Thoennessen Method Source: https://github.com/rhobis/convergenceclubs/blob/master/README.md Merges previously found convergence clubs using the von Lyncker and Thoennessen (vLT) method. Divergent regions are not merged in this specific call. ```r mclubs <- mergeClubs(clubs, mergeMethod='vLT', mergeDivergent=FALSE) summary(mclubs) ``` -------------------------------- ### coreG Function Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/coreG.html Finds the Core (primary) group according to step 2 of the clustering algorithm by Phillips and Sul (2007, 2009). ```APIDOC ## coreG Function ### Description Finds the Core (primary) group according to step 2 of the clustering algorithm by Phillips and Sul (2007, 2009). ### Signature `coreG(X, dataCols, time_trim, threshold = -1.65, HACmethod = c("FQSB", "AQSB"), type = c("max", "all"))` ### Arguments * **X** (matrix or dataframe) - Containing data (preferably filtered data in order to remove business cycles). * **dataCols** (integer vector) - With the column indices of the data. * **time_trim** (numeric) - 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) - Numeric value indicating the threshold to be used to perform the one-tail t test; default is -1.65. * **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 _log t_ regression model with heteroskedasticity and autocorrelation consistent standard errors. The default method is "FQSB". * **type** (string) - One of "max" or "all"; "max" includes only the region with maximum t-value. The default option is "max"; "all" includes all regions that pass the test t in the core formation (step 2). ### Value A numeric vector containing the row indices of the regions included in the core group; if a core group cannot be found, returns `FALSE`. ### Details According to the second step of the Phillips and Sul clustering algorithm (2007, 2009), the _log t_ regression should be run for the first k units \(2 < k < N\) maximizing k under the condition that \(t-value > -1.65\). In other words, the core group size \(k^ *\) is chosen as follows: $$ k^ * = argmax₂ \{tₖ\} $$ subject to $$\min{tₖ} > -1.65$$ Such behavior is obtained with `type="max"`; if `type="all"`, all units that satisfy \(tₖ > -1.65\) are added to core group. If the condition \(tₖ > -1.65\) does not hold for \(k = 2\) (the first two units), the algorithm drops the first unit and repeats the same procedure for the next pair of units. If \(tₖ > -1.65\) does not hold for any couple of units, the whole panel diverges. ### 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. ``` -------------------------------- ### computeH(X, quantity = "H", id) Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/computeH.html Computes H values (cross-sectional variance) according to the clustering algorithm by Phillips and Sul (2007, 2009). ```APIDOC ## Function: `computeH` ### Description Computes H values (cross-sectional variance) according to the clustering algorithm by Phillips and Sul (2007, 2009). ### Function Signature `computeH(X, quantity = "H", id)` ### Parameters - **X** (matrix or dataframe) - Required - matrix or dataframe containing data (preferably filtered, in order to remove business cycles) - **quantity** (string) - Optional - 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** (numeric vector) - Optional - row index of regions for which H values are to be computed; if missing, all regions are used ### Return Value A numeric vector, a matrix or a list, depending on the value of `quantity` ### Examples ```R data("countryGDP") h <- computeH(countryGDP[,-1], quantity="h") H <- computeH(countryGDP[,-1], quantity="H") b <- computeH(countryGDP[,-1], quantity="both") ``` ``` -------------------------------- ### Find Convergence Clubs Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/index.html Cluster countries using GDP data. Specify data columns, region identifier, reference year, time trimming, cstar value, and HAC method. ```r library(ConvergenceClubs) data("countryGDP") # Cluster Countries using GDP from year 2000 to year 2014, with 2014 as reference year clubs <- findClubs(countryGDP, dataCols=2:35, regions = 1, refCol=35, time_trim = 1/3, cstar = 0, HACmethod = "AQSB") summary(clubs) ``` -------------------------------- ### countryGDP Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/index.html Provides Gross Domestic Product (GDP) data for 152 countries from 1970 to 2003. ```APIDOC ## countryGDP ### Description GDP of 152 Countries from 1970 to 2003. ### Parameters This data object does not explicitly list parameters. ``` -------------------------------- ### club function Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/club.html Adds units to a core group to find the enlarged club using Phillips and Sul's clustering algorithm. ```APIDOC ## club function ### Description Adds 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. ### Signature club(X, dataCols, core, time_trim, HACmethod = c("FQSB", "AQSB"), cstar = 0) ### Arguments * **X** (matrix or dataframe) - Containing data (preferably filtered data in order to remove business cycles). * **dataCols** (integer vector) - The column indices of the data. * **core** (integer vector) - The id's of units in core group. * **time_trim** (numeric) - 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. * **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 \(log t\) regression model with heteroskedasticity and autocorrelation consistent standard errors. The default method is "FQSB". * **cstar** (numeric scalar) - Indicating the threshold value of the sieve criterion \(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. ### Value A list of three objects: * `id` (vector): Containing the row indices of club regions in the original dataframe (input of function `findClubs`). * `rows` (vector): Row indices of club units in the current dataset (input of function `club`). * `model` (list): Containing information about the model used to run the t-test on the regions 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. ``` -------------------------------- ### Merge Divergent Units and Clubs Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/mergeDivergent.html Merges previously identified convergence clubs with any remaining divergent units based on the mergeDivergent algorithm. This step refines the club structure. ```R # Merge clusters and divergent regions mclubs <- mergeClubs(clubs, mergeDivergent=TRUE) summary(mclubs) ``` -------------------------------- ### mergeClubs Function Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/mergeClubs.html Merges a list of clubs created with the function findClubs by either Phillips and Sul method or von Lyncker and Thoennessen procedure. ```APIDOC ## mergeClubs ### Description Merges a list of clubs created with the function `findClubs` by either Phillips and Sul method or von Lyncker and Thoennessen procedure. ### Signature `mergeClubs(clubs, time_trim, mergeMethod = c("PS", "vLT"), mergeDivergent = FALSE, threshold = -1.65)` ### Arguments #### `clubs` - Type: `convergence.clubs` object - Description: An object of class `convergence.clubs` (created by `findClubs` function). #### `time_trim` - Type: numeric - Description: A numeric value between 0 and 1, representing the portion of time periods to trim when running log t regression model; if omitted, the same value used for `clubs` is used. #### `mergeMethod` - Type: character string - Description: Indicates the merging method to use. Methods available are `"PS"` for Phillips and Sul (2009) and `"vLT"` for von Lyncker and Thoennessen (2016). #### `mergeDivergent` - Type: logical - Description: If TRUE, indicates that merging of divergent regions should be tried. #### `threshold` - Type: numeric - Description: A numeric value indicating the threshold to be used with the t-test. ### Value An object of class `convergence.clubs`, containing a list of Convergence Clubs. For each club, a list is returned with the following objects: `id`, a vector containing the row indices of the regions in the club; `model`, a list containing information about the model used to run the t-test on the regions in the club; `regions`, a vector containing the names of the regions of the club (optional, only included if parameter `regions` is given). ### Details Phillips and Sul (2009) suggest a "club merging algorithm" to avoid over determination due to the selection of the parameter \(c^\*\). This algorithm suggests to merge for adjacent groups. In particular, it works as follows: 1. Take the first two groups detected in the basic clustering mechanism and run the log-t test. If the t-statistic is larger than -1.65, these groups together form a new convergence club; 2. Repeat the test adding the next group and continue until the basic condition (t-statistic > -1.65) holds; 3. If convergence hypothesis is rejected, conclude that all previous groups converge, except the last one. Hence, start again the test merging algorithm beginning from the group for which the hypothesis of convergence did not hold. On the other hand, von Lyncker and Thoennessen (2016), propose a modified version of the club merging algorithm that works as follows: 1. Take all the groups detected in the basic clustering mechanism (P) and run the t-test for adjacent groups, obtaining a (M × 1) vector of convergence test statistics t (where \(M = P - 1\) and \(m = 1, \dots, M\)); 2. Merge for adjacent groups starting from the first, under the conditions \(t(m) > -1.65\) and \(t(m) > t(m+1)\). In particular, if both conditions hold, the two clubs determining \(t(m)\) are merged and the algorithm starts again from step 1, otherwise it continues for all following pairs; 3. For the last element of vector M (the value of the last two clubs) the only condition required for merging is \(t(m=M) > -1.65\). ### Examples ```R data("countryGDP") # Cluster Countries using GDP from year 1970 to year 2003 clubs <- findClubs(countryGDP, dataCols=2:35, regions = 1, refCol=35, time_trim = 1/3, cstar = 0, HACmethod = "FQSB") summary(clubs) # Merge clusters mclubs <- mergeClubs(clubs, mergeMethod='PS', mergeDivergent=FALSE) summary(mclubs) ``` ``` -------------------------------- ### ps_andrews_hac Function Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/ps_andrews_hac.html Estimates the long-run variance of errors through Andrews' method with Quadratic Spectral kernel and fixed bandwidth. ```APIDOC ## ps_andrews_hac ### Description Estimate long run variance of errors through Andrews' method. ### Function Signature `ps_andrews_hac(x)` ### Arguments #### Parameters - **x** (vector) - Required - A vector of residuals. ### Value - **numeric** - A numeric value representing the long run variance of errors. ### 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_. ### References Phillips, P. C.; Sul, D., 2007. Transition modeling and econometric convergence tests. Econometrica 75 (6), 1771-1855. ``` -------------------------------- ### mergeDivergent() Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/index.html Merges units that are identified as divergent. ```APIDOC ## mergeDivergent() ### Description Merge divergent units. ### Parameters This function does not explicitly list parameters in the provided documentation. ``` -------------------------------- ### mergeDivergent Function Source: https://github.com/rhobis/convergenceclubs/blob/master/docs/reference/mergeDivergent.html Merges divergent units according to the algorithm proposed by von Lyncker and Thoennessen (2016). This function is part of the ConvergenceClubs R package. ```APIDOC ## mergeDivergent ### Description Merges divergent units according to the algorithm proposed by von Lyncker and Thoennessen (2016). ### Function Signature `mergeDivergent(clubs, time_trim, threshold = -1.65)` ### Arguments #### `clubs` - Type: `convergence.clubs` object - Description: An object of class `convergence.clubs` (created by `findClub` or `mergeClubs` function). #### `time_trim` - Type: numeric - Description: A numeric value between 0 and 1, representing the portion of time periods to trim when running log t regression model. If omitted, the same value used for `clubs` is used. #### `threshold` - Type: numeric - Description: A numeric value indicating the threshold to be used with the t-test. Defaults to -1.65. ### Value A list of Convergence Clubs. For each club, a list is returned with the following objects: - `id`: A vector containing the row indices of the regions in the club. - `model`: A list containing information about the model used to run the t-test on the regions in the club. - `regions`: A vector containing the names of the regions of the club (optional, only included if it is present in the `clubs` object given in input). ### Details The algorithm tests if divergent regions may be included in new convergence clubs by running log t-tests between diverging regions and existing clubs. It iteratively adds regions to clubs if a t-value exceeds a specified threshold, stopping when no more regions can be added. ### Examples ```R data("countryGDP") # Cluster Countries using GDP from year 1970 to year 2003 clubs <- findClubs(countryGDP, dataCols=2:35, regions = 1, refCol=35, time_trim = 1/3, cstar = 0, HACmethod = "AQSB") summary(clubs) # Merge clusters and divergent regions mclubs <- mergeClubs(clubs, mergeDivergent=TRUE) summary(mclubs) ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.