### Install xtdcce2 from GitHub Source: https://janditzen.github.io/xtdcce2 Use this command to install the latest version of xtdcce2 directly from the GitHub repository. ```stata net install xtdcce2 , from("https://janditzen.github.io/xtdcce2/") ``` -------------------------------- ### Install xtdcce2 including beta versions Source: https://janditzen.github.io/xtdcce2 This command allows you to access and install beta versions of xtdcce2 in addition to stable releases. ```stata net from https://janditzen.github.io/xtdcce2/ ``` -------------------------------- ### Install xtdcce2 from SSC Source: https://janditzen.github.io/xtdcce2 Install the xtdcce2 package from the Stata Statistical Software Components (SSC) archive. ```stata ssc install xtdcce2 ``` -------------------------------- ### Install xtdcce2 beta versions from ditzen.net Source: https://janditzen.github.io/xtdcce2 Access and install beta versions of xtdcce2 prior to version 1.34 from this historical URL. ```stata net from http://www.ditzen.net/Stata/xtdcce2_beta ``` -------------------------------- ### xtdcce2 Command Syntax Source: https://janditzen.github.io/xtdcce2 This is the primary syntax for the xtdcce2 command, used for estimating heterogeneous coefficient models with common correlated effects in dynamic panels. Ensure your data is xtset and the moremata package is installed. ```stata xtdcce2 _depvar_ [_indepvars_] [_varlist2_ = _varlist_iv_] [ifin] , crosssectional(_varlist_[,cr_lags(_numlist_) rcce[(criterion(er/gr) scale npc(integer))] rcclassifier[(er gr replications(integer) standardize(integer) randomshrinkage noshrinkage)]]) [clustercrosssectional(_varlist_, clustercr(_varlist_) [cr_lags(_numlist_)]) globalcrosssectional(_varlist_[,cr_lags(_numlist_)]) pooled(_varlist_) cr_lags(_numlist_) NOCRosssectional ivreg2options(_string_) e_ivreg2_ ivslow noisily lr(_varlist_) lr_options(_string_) pooledconstant reportconstant pooledvce(_string_) noconstant trend pooledtrend jackknife recursive nocd exponent xtcse2options(_string_) showindividual fullsample fast fast2 blockdiaguse nodimcheck useqr useinvsym noomitted mgmissing] ``` -------------------------------- ### Estimate Static CCE Model with Cross-Sectional Variables Source: https://janditzen.github.io/xtdcce2 Estimates a static Common Correlated Effects (CCE) model by defining all independent and dependent variables in crosssectional(_varlist_). This yields the same results as the previous example. ```stata xtdcce2 d.log_rgdpo log_hc log_ck log_ngd , reportc cr(log_rgdpo log_hc log_ck log_ngd) ``` -------------------------------- ### Instrumental Variables Estimation Source: https://janditzen.github.io/xtdcce2 Estimates the model using instrumental variables, specifying endogenous and exogenous variables. This example uses the lagged level of physical capital as an instrument for its contemporaneous level. ```stata xtdcce2 d.log_rgdpo L.log_rgdpo log_hc log_ck log_ngd (log_ck = L.log_ck), reportc cr(log_rgdpo log_hc log_ck log_ngd) cr_lags(3) ivreg2options(nocollin noid) ``` -------------------------------- ### Predict Command Comparison: xb vs xb2 Source: https://janditzen.github.io/xtdcce2 This table outlines the steps to obtain 'xb' and 'xb2' predictions, highlighting the difference in how partialled out variables are handled in the calculation. ```stata predict coeff, coeff predict partial, partial gen xb = coeff_x * partial_x ``` ```stata predict coeff, coeff gen xb2 = coeff_x * x ``` -------------------------------- ### Run Basic CD Test Source: https://janditzen.github.io/xtdcce2 Estimates a panel regression and then runs the default cross-sectional dependence test. This is a standard first step for analyzing panel data. ```stata reg d.log_rgdpo log_hc log_ck log_ngd xtcd2 ``` -------------------------------- ### Run Wild Bootstrap and Bootstrap Confidence Intervals Source: https://janditzen.github.io/xtdcce2 Performs a wild bootstrap and generates bootstrap confidence intervals, using a fixed seed for reproducibility. ```stata estat bootstrap, seed(123) wild percentile ``` -------------------------------- ### xtdcce2fast Command Syntax Source: https://janditzen.github.io/xtdcce2 This is the optimized syntax for the xtdcce2fast command, designed for speed and large datasets. It shares many options with xtdcce2 but is tailored for performance. ```stata xtdcce2fast _depvar_ [_indepvars_] [ifin] , crosssectional(_varlist_[,cr_lags(_numlist_) rcce[(criterion(er/gr) scale npc(integer))] rcclassifier[(er gr replications(integer) standardize(integer) randomshrinkage noshrinkage)]]) [clustercrosssectional(_varlist_, clustercr(_varlist_) [cr_lags(_numlist_)]) globalcrosssectional(_varlist_[,cr_lags(_numlist_)]) cr_lags(_string_) NOCRosssectional lr(_varlist_) lr_options(_string_) reportconstant noconstant cd fullsample notable cd postframe nopost ] ``` -------------------------------- ### xtcd2 Test for Cross-Sectional Dependence Syntax Source: https://janditzen.github.io/xtdcce2 Provides the general syntax for the `xtcd2` command, which tests for weak cross-sectional dependence. It outlines the optional `varlist` and various command options. ```stata xtcd2 [varlist] [if] [,pesaran cdw pea cdstar rho pca(integer) reps(integer) seed(integer) kdensity name(string) heatplot[(absolute options_heatplot)] contour[(absolute options_contour) noadjust] ] ``` -------------------------------- ### Information Criteria for Static Panels (Default) Source: https://janditzen.github.io/xtdcce2 Obtains Information Criteria (IC1 and IC2) for the current set of cross-section averages defined in `cr(_all)`. This is a baseline for comparing different sets of averages. ```stata xtdcce2 d.log_rgdpo log_hc log_ck log_ngd , cr(_all) reportc estat ic ``` -------------------------------- ### Predict Command Syntax Source: https://janditzen.github.io/xtdcce2 The general syntax for the predict command after xtdcce2 estimation. It allows for the creation of new variables based on various postestimation calculations. ```stata predict [type] _newvar_ _ifin_ [ options ] ``` -------------------------------- ### Calculate PC1 and PC2 using estat ic Source: https://janditzen.github.io/xtdcce2 Use the `estat ic` command after running `xtdcce2` to calculate PC1 and PC2. These criteria help identify the optimal set of cross-section averages for static panel models. ```stata estat ic ``` -------------------------------- ### Bootstrap Confidence Intervals and Standard Errors Source: https://janditzen.github.io/xtdcce2 The 'estat bootstrap' command allows for bootstrapping confidence intervals and standard errors using either wild or cross-section methods. Specify the number of repetitions with 'reps()'. ```stata estat bootstrap , [options] ``` -------------------------------- ### Estimate Static Model with Regularized CCE (NPC) Source: https://janditzen.github.io/xtdcce2 Estimates a static model using Regularized CCE, hard-setting the number of eigenvectors to 3 using the npc() option. ```stata xtdcce2 log_rgdpo log_hc log_ck log_ngd , cr(log_rgdpo log_hc log_ck log_ngd, rcce(npc(3))) ``` -------------------------------- ### General CS-DL Model Estimation Source: https://janditzen.github.io/xtdcce2 This equation represents a general ARDL(py,px) model estimated using the CS-DL approach. It includes cross-sectional averages and differences of explanatory variables up to px lags. ```mathematica (8) y(i,t) = w0(i) + x(i,t) * w2(i) + sum(l=1,px) delta(i,l) * (x(i,t-l) - x(i,t-l-1)) + sum [d(i)*z(i,s)] + e(i,t) ``` -------------------------------- ### Rank Condition Classifier with Default Settings Source: https://janditzen.github.io/xtdcce2 Applies the rank condition classifier to a static model. The `rccl` option is added to the `cr` command to calculate the classifier. ```stata xtdcce2 d.log_rgdpo log_hc log_ck log_ngd , cr(_all, rccl) reportc ``` -------------------------------- ### Estimate CS-ARDL Model with ARDL(3,3,3) using Parentheses Source: https://janditzen.github.io/xtdcce2 Estimates a Cross-Section Augmented ARDL model with ARDL(3,3,3) structure, using parentheses to group variables forming the same long-run coefficient. ```stata xtdcce2 d.y , lr((L(1/3).d.y) (L(0/3).dp) (L(0/3).d.gd) ) lr_options(ardl) cr(d.y dp d.gd) cr_lags(3) fullsample ``` -------------------------------- ### CD Test Asymptotic Distribution Source: https://janditzen.github.io/xtdcce2 Describes the asymptotic distribution of the CD test statistic under the null hypothesis, which follows a standard normal distribution. ```text CD ~ N(0,1) ``` -------------------------------- ### Cross-Section Augmented ARDL (CS-ARDL) Model Source: https://janditzen.github.io/xtdcce2 This equation represents a general ARDL(py,px) model for CS-ARDL estimation. It includes cross-sectional averages and allows for estimation of short run coefficients first, followed by long run coefficients. ```mathematica (9) y(i,t) = b0(i) + sum(l=1,py) b1(i,l) y(i,t-l) + sum(l=0,px) b2(i,l) x(i,t-l) + sum [d(i)*z(i,s)] + e(i,t), ``` -------------------------------- ### Estimate Growth Equation with Lags and Residual Analysis Source: https://janditzen.github.io/xtdcce2 Refine the growth equation estimation by adding lags of cross-sectional averages using xtdcce2 and then analyze the residuals with xtcse2. This addresses potential model mis-specification due to dynamic effects. ```Stata xtdcce2 log_rgdpo L.log_rgdpo log_ck log_ngd log_hc , cr(log_rgdpo log_ck log_ngd log_hc) cr_lags(3) . xtcse2 ,nocd residual lags(3) reps(200) ``` -------------------------------- ### Estimate CS-ARDL Model with ARDL(3,3,3) without Parentheses Source: https://janditzen.github.io/xtdcce2 Estimates a Cross-Section Augmented ARDL model with ARDL(3,3,3) structure, equivalent to the version using parentheses for grouping. ```stata xtdcce2 d.y , lr(L(1/3).d.y L(0/3).dp L(0/3).d.gd) lr_options(ardl) cr(d.y dp d.gd) cr_lags(3) fullsample ``` -------------------------------- ### Dynamic Panel Data Model with Heterogeneous Coefficients Source: https://janditzen.github.io/xtdcce2 This equation represents a dynamic panel data model with heterogeneous coefficients and unobserved common factors. It is the basis for understanding the `xtdcce2` estimator. ```mathematica y(i,t) = b0(i) + b1(i)*y(i,t-1) + x(i,t)*b2(i) + x(i,t-1)*b3(i) + u(i,t) u(i,t) = g(i)*f(t) + e(i,t) ``` -------------------------------- ### Standardize Variable for BKP Table 1 Reproduction Source: https://janditzen.github.io/xtdcce2 Use xtcse2 with the 'standardize' option to prepare a variable for reproducing results from Table 1 of the BKP paper. This ensures consistency with the original study's methodology. ```Stata xtcse2 gdp , standardize. ``` -------------------------------- ### Pooled Estimation Equations Source: https://janditzen.github.io/xtdcce2 These equations represent pooled estimations where parameters are constrained to be the same across units. The pooled(_varlist_) option specifies variables with homogenous coefficients, and pooledconstant pools the constant. ```mathematica (3-p) y(i,t) = b0 + b1*y(i,t-1) + x(i,t)*b2 + e(i,t), (4-p) y(i,t) = b0 + x(i,t)*b2 + d(i)*z(i,t) + e(i,t), (5-p) y(i,t) = b0 + b1*y(i,t-1) + x(i,t)*b2 + sum [d(i)*z(i,s)] + e(i,t). ``` -------------------------------- ### Sequential Information Criteria Calculation Source: https://janditzen.github.io/xtdcce2 Calculates Information Criteria for all possible combinations of cross-section averages and indicates the lowest ones. Use this to explore various combinations systematically. ```stata estat ic, seqential ``` -------------------------------- ### Estimate Static Model with Regularized CCE (GR Criterion) Source: https://janditzen.github.io/xtdcce2 Estimates a static model using Regularized CCE, selecting eigenvectors based on the GR criterion. ```stata xtdcce2 log_rgdpo log_hc log_ck log_ngd , cr(log_rgdpo log_hc log_ck log_ngd, rcce(criterion(gr))) ``` -------------------------------- ### Predict Partialled Out Values Source: https://janditzen.github.io/xtdcce2 Use the 'predict' command with the 'partial' option to create new variables containing the partialled out values of the independent variables. This is useful for understanding the components of the regression. ```stata predict partial, partial ``` -------------------------------- ### Information Criteria for Specific Model Combinations Source: https://janditzen.github.io/xtdcce2 Calculates Information Criteria for specified sets of cross-section averages. The `model()` option allows you to define which combinations to evaluate, useful for targeted analysis. ```stata estat ic, model( (d.log_rgdpo log_hc log_ck log_ngd) (log_hc log_ck log_ngd) (log_hc log_ck ) ) ``` -------------------------------- ### Bootstrap Standard Errors with Fixed Seed Source: https://janditzen.github.io/xtdcce2 Initiates bootstrapping of standard errors with a specified fixed seed for reproducibility. ```stata estat bootstrap, seed(123) ``` -------------------------------- ### Predict Linear Prediction on Non-Partialled Out Variables Source: https://janditzen.github.io/xtdcce2 Use the 'predict' command with the 'xb2' option to calculate the linear prediction using coefficients and original explanatory variables. This is equivalent to multiplying the coefficients by the explanatory variables directly. ```stata predict xb2, xb2 ``` -------------------------------- ### Predict Coefficients for All Cross-Sections Source: https://janditzen.github.io/xtdcce2 Use the 'predict' command with the 'coefficients' option to create a variable containing the estimated cross-section specific values for all coefficients. The new variable name will be prefixed with '_newvar_'. ```stata predict coefficients, coefficients ``` -------------------------------- ### Exponent Estimation in Residuals Source: https://janditzen.github.io/xtdcce2 Formula for estimating the exponent alpha in residuals using pair-wise correlations, as proposed by BKP (2019). ```mathematica alpha = ln(tau' delta tau) / [2 ln(N)] ``` -------------------------------- ### Predict Coefficients and Calculate Mean Source: https://janditzen.github.io/xtdcce2 Predicts the unit-specific coefficients for each variable and then calculates the mean of these coefficients. This mean should match the mean group estimate. ```stata predict coeff, coefficients sum coeff_log_hc. ``` -------------------------------- ### Calculate Information Criteria Source: https://janditzen.github.io/xtdcce2 Use 'estat ic' to calculate information criteria for selecting the optimal number of cross-section averages. Options like 'sequential' and 'model()' can be used for advanced selection. ```stata estat ic , [options] ``` -------------------------------- ### Create Box, Bar, or Range Plot Source: https://janditzen.github.io/xtdcce2 Use the 'estat _graphtype' command to generate box, bar, or range plots. Options like 'combine' and 'individual' can be used to customize combined or individual graphs. ```stata estat _graphtype [_varlist_] {ifin} [,combine(_string_) individual(_string_) nomg cleargraph] ``` -------------------------------- ### Pooled Estimation with Pooled Constant Source: https://janditzen.github.io/xtdcce2 Estimates the model with specified variables and the constant pooled across units. This is achieved using the 'pooled(_varlist_)' and 'pooledconstant' options. ```stata xtdcce2 d.log_rgdpo L.log_rgdpo log_hc log_ck log_ngd , reportc cr(log_rgdpo log_hc log_ck log_ngd) pooled(L.log_rgdpo log_hc log_ck log_ngd) cr_lags(3) pooledconstant ``` -------------------------------- ### rCCE Method Steps Source: https://janditzen.github.io/xtdcce2 The rCCE method involves calculating cross-sectional averages, estimating the number of common factors, and replacing averages with eigenvectors. This method addresses potential bias in pooled and mean group estimators. ```text 1. Calculate cross-sectional averages. 2. Estimate number of common factors using the ER or GR criterion from Ahn and Horenstein (2013). 3. Replace the cross-sectional averages with eigenvectors from the cross-section averages. The eigenvectors are the eigenvectors of the largest eigenvalues and the number is obtained in step 2. ``` -------------------------------- ### Information Criteria for a Single Model Source: https://janditzen.github.io/xtdcce2 Calculates Information Criteria for a single, specified model of cross-section averages using the `single` option. This is faster than calculating for all combinations when you have a specific model in mind. ```stata estat ic, model(log_hc log_ck ) single estat ic, model(log_hc log_ck log_ngd) ``` -------------------------------- ### Standard Error Calculation for Alpha Source: https://janditzen.github.io/xtdcce2 Equation for calculating the standard error of alpha, following BKP (2016) online appendix. ```mathematica sigma(alpha) = [1/T V(q) + 4/N^(alpha) S]^(1/2) * 1/2 * 1/ln(N) ``` -------------------------------- ### CD Test Statistic Formula (Balanced Panel) Source: https://janditzen.github.io/xtdcce2 Presents the formula for the CD test statistic derived by Pesaran (2015) for balanced panel data. ```text CD = [2*T / (N*(N-1))]^(1/2) * sum(i=1,N-1) sum(j=i+1,N) rho(ij), ``` -------------------------------- ### Estimate Exponent of Cross-Sectional Dependence Source: https://janditzen.github.io/xtdcce2 Estimates the exponent of cross-sectional dependence using the xtcse2 command. This command requires the data to be xtset and can predict residuals if no varlist is provided. ```stata xtcse2 [varlist] [if] [, pca(integer) standardize nocenter nocd RESsidual Reps(integer) size(real) tuning(real) lags(integer) ] ``` -------------------------------- ### Estimate CS-DL Model with ARDL(1,3,3) Source: https://janditzen.github.io/xtdcce2 Estimates a Cross-Section Augmented Distributed Lag model with an ARDL(1,3,3) structure, including first and second lags of the first differences of independent variables. ```stata xtdcce2 d.y dp d.gd L(0/2).d.(dp d.gd), cr(d.y dp d.gd) cr_lags(0 3 3) fullsample ``` -------------------------------- ### Variance of Mean Group Coefficient Source: https://janditzen.github.io/xtdcce2 This formula shows how to estimate the variance of the mean group coefficient b1(mg) in a dynamic panel data model. ```mathematica var(b(mg)) = 1/N sum(i=1,N) (b1(i) - b1(mg))^2 ``` -------------------------------- ### Run CD Test on Predicted Residuals Source: https://janditzen.github.io/xtdcce2 Predicts the residuals from a regression model and then performs the cross-sectional dependence test on these residuals. This is useful for testing the assumptions of the regression model. ```stata reg d.log_rgdpo log_hc log_ck log_ngd predict res, residuals xtcd2 res ``` -------------------------------- ### CS-ARDL Long Run Coefficient Calculation Source: https://janditzen.github.io/xtdcce2 This equation shows how the long run coefficients (w2(i)) for independent variables are calculated in the CS-ARDL approach, based on the estimated short run coefficients. ```mathematica (10) w2(i) = sum(l=0,px) b2(i,l) / ( 1 - sum(l=1,py) b1(i,l)) ``` -------------------------------- ### Predict Standard Error of the Prediction Source: https://janditzen.github.io/xtdcce2 Use the 'predict' command with the 'stdp' option to calculate the standard error of the prediction. This helps in assessing the uncertainty associated with the predicted values. ```stata predict stdp, stdp ``` -------------------------------- ### Predict Residuals (e(i,t)) Source: https://janditzen.github.io/xtdcce2 Use the 'predict' command with the 'residuals' option to calculate the residuals of the regression after cross-sectional averages have been partialled out. This represents the idiosyncratic error term. ```stata predict residuals, residuals ``` -------------------------------- ### Estimate CS-ARDL Model with ARDL(1,1,1) Source: https://janditzen.github.io/xtdcce2 Estimates a Cross-Section Augmented ARDL model treating all variables as long-run coefficients. It includes three lags of the cross-sectional averages. ```stata xtdcce2 d.y , lr(L.d.y dp L.dp d.gd L.d.gd) lr_options(ardl) cr(d.y dp d.gd) cr_lags(3) fullsample ``` -------------------------------- ### Variance of Mean Group Coefficient Vector Source: https://janditzen.github.io/xtdcce2 This formula shows how to estimate the variance of the mean group coefficient vector pi(mg), which includes b0(mg) and b1(mg). ```mathematica var(pi(mg)) = 1/N sum(i=1,N) (pi(i) - pi(mg))(p(i)-pi(mg))' ``` -------------------------------- ### Estimate Mean Group Model with Constant Source: https://janditzen.github.io/xtdcce2 Estimate a growth equation using the mean group estimator with the 'nocrosssectional' and 'reportconstant' options to include the constant term. ```stata xtdcce2 d.log_rgdpo L.log_rgdpo log_hc log_ck log_ngd , nocross reportc ``` -------------------------------- ### Estimate CS-DL Model with ARDL(1,1,1) Source: https://janditzen.github.io/xtdcce2 Estimates a Cross-Section Augmented Distributed Lag model with an ARDL(1,1,1) structure. It includes contemporaneous lags of the dependent variable and 3 lags of independent variables. ```stata xtdcce2 d.y dp d.gd d.(dp d.gd), cr(d.y dp d.gd) cr_lags(0 3 3) fullsample ``` -------------------------------- ### Predict Linear Prediction on Partialled Out Variables Source: https://janditzen.github.io/xtdcce2 Use the 'predict' command with the 'xb' option to calculate the linear prediction on variables after cross-sectional averages have been partialled out. This is useful for analyzing the effect of independent variables excluding common factors. ```stata predict xb, xb ``` -------------------------------- ### Information Criteria Formulas Source: https://janditzen.github.io/xtdcce2 These formulas represent four information criteria (IC1, IC2, PC1, PC2) used for selecting the optimal set of cross-section averages. IC1 and IC2 are based on the current set of averages, while PC1 and PC2 relate to the largest possible set. ```mathematica IC1 = ln(S(FM)^2) + m (N+T)/(NT) ln(NT/(N+T)) IC2 = ln(S(FM)^2) + m (N+T)/(NT) ln(c(NT)) PC1 = S(FM)^2 + m S(FMb)^2 (N+T)/(NT) ln(NT/(N+T)) PC2 = S(FM)^2 + m S(FMb)^2 (N+T)/(NT) ln(c(NT)) ``` -------------------------------- ### Estimate Static Model with Regularized CCE (ER Criterion) Source: https://janditzen.github.io/xtdcce2 Estimates a static model using Regularized CCE, selecting the first and second eigenvector of cross-section averages based on the ER criterion. ```stata xtdcce2 log_rgdpo log_hc log_ck log_ngd , cr(log_rgdpo log_hc log_ck log_ngd, rcce) ``` -------------------------------- ### Error Correction Model with Long Run Coefficients (XTPMG Names) Source: https://janditzen.github.io/xtdcce2 Estimates an Error Correction Model (ECM) by specifying long-run variables and using the 'xtpmgnames' option within 'lr_options' to match the naming convention from 'xtpmg'. ```stata xtdcce2 d.c d.pi d.y if year >= 1962 , lr(L.c pi y) p(L.c pi y) nocross lr_options(xtpmgnames) ``` -------------------------------- ### Apply Power Enhancement Approach (PEA) Source: https://janditzen.github.io/xtdcce2 Applies the Power Enhancement Approach (PEA) to improve the power of the weighted cross-sectional dependence test using the 'pea' option. This method is designed for large panel datasets. ```stata xtcd2 res, pea ``` -------------------------------- ### Error Correction Model with Long Run Coefficients (Nodivide) Source: https://janditzen.github.io/xtdcce2 Estimates an Error Correction Model (ECM) by specifying long-run variables and using the 'nodivide' option within 'lr_options'. This internally estimates equation (7) and recalculates long-run coefficients for equation (8). ```stata xtdcce2 d.c d.pi d.y if year >= 1962 , lr(L.c pi y) p(L.c pi y) nocross lr_options(nodivide) ``` -------------------------------- ### Plot Kernel Density of Cross Correlations Source: https://janditzen.github.io/xtdcce2 Performs the cross-sectional dependence test and generates a kernel density plot of the cross-correlations. This helps visualize the distribution of cross-correlations. ```stata xtcd2 res, kdensity ``` -------------------------------- ### CD Test Statistic Formula (Unbalanced Panel) Source: https://janditzen.github.io/xtdcce2 Provides the formula for the CD test statistic for unbalanced panel data, as described by Chudik and Pesaran (2015). ```text CD = [2 / (N*(N-1))]^(1/2) * sum(i=1,N-1) sum(j=i+1,N) [T(ij)^(1/2) * rho(ij)], ``` -------------------------------- ### Predict Residuals Including Common Factors (u(i,t)) Source: https://janditzen.github.io/xtdcce2 Use the 'predict' command with the 'cfresiduals' option to calculate residuals that include the common factors (u(i,t) = g(i)f(g) + e(i,t)). This represents the total error term including common shocks. ```stata predict cfresiduals, cfresiduals ``` -------------------------------- ### Estimate Growth Equation with Cross-Sectional Averages Source: https://janditzen.github.io/xtdcce2 Employ xtdcce2 to estimate a growth equation by incorporating cross-sectional averages. This method accounts for significant cross-sectional dependence identified by xtcse2. ```Stata xtdcce2 log_rgdpo L.log_rgdpo log_ck log_ngd log_hc , cr(log_rgdpo log_ck log_ngd log_hc) . xtcse2, res ``` -------------------------------- ### Estimate Cross-Sectional Dependence Exponent Source: https://janditzen.github.io/xtdcce2 Use xtcse2 to estimate the exponent of cross-sectional dependence for variables before running a growth regression. This helps identify the degree of dependence. ```Stata xtcse2 d.log_rgdpo L.log_rgdpo log_hc log_ck log_ngd. ``` -------------------------------- ### Estimate Static CCE Model with Zero Cross-Sectional Lags Source: https://janditzen.github.io/xtdcce2 Estimates a static Common Correlated Effects (CCE) model with explicitly setting the number of cross-sectional lags to zero. This implies only contemporaneous cross-sectional averages are used, matching the default behavior. ```stata xtdcce2 d.log_rgdpo log_hc log_ck log_ngd , reportc cr(log_rgdpo log_hc log_ck log_ngd) cr_lags(0) ``` -------------------------------- ### General Factor Model Specification Source: https://janditzen.github.io/xtdcce2 This represents a general factor model with 'm' common factors, where 'x(i,t)' depends on unobserved factors and a cross-sectionally independent error term. The model assumes both the time dimension (T) and the number of cross-sectional units (N) increase to infinity. ```mathematica x(i,t) = sum(j=1,m) b(j,i) f(j,t) + u(i,t) i = 1,...,N and t = 1,...,T ``` -------------------------------- ### Power Enhanced CD Test Formula Source: https://janditzen.github.io/xtdcce2 Presents the formula for the Power Enhanced CD test (PEA), which improves the power of the CD test by incorporating absolute values of correlations and a threshold condition. ```text CD = [2*T / (N*(N-1))]^(1/2) * sum(i=1,N-1) sum(j=i+1,N) rho(ij) + sum(i=2,N)sum(j=1,N-1}|rho(ij)|*(|rho(ij)>2 log(N)^(1/2)T^(-1) ``` -------------------------------- ### Bias-Adjusted Estimator for Alpha Source: https://janditzen.github.io/xtdcce2 Formula for the bias-adjusted estimator of alpha in a panel, as derived by Bailey, Kapetanios, and Pesaran (2016). ```mathematica alpha = 1 + 1/2 ln(sigma_x^2)/ln(N_g) - 1/2 ln(mu^2)/ln(N_g) - 1/2 cn / [N_g * ln(N_g) * sigma_x^2] ``` -------------------------------- ### Predict Standard Error of Coefficients for All Cross-Sections Source: https://janditzen.github.io/xtdcce2 Use the 'predict' command with the 'se' option (in conjunction with 'coefficients') to create a variable containing the standard errors of the estimated cross-section specific coefficient values. ```stata predict se, se ``` -------------------------------- ### Factor Strength Definition Source: https://janditzen.github.io/xtdcce2 This equation defines the strength of factors (weak or strong) using a constant 'alpha' between 0 and 1. The limit of N^(-alpha) times the sum of the absolute values of the factor loadings determines the factor dependence characteristics. ```mathematica lim N^(-alpha) sum(j=1,m) abs(b(j,i)) = K < infinity. ``` -------------------------------- ### Weighted CD Test Pairwise Correlation Formula Source: https://janditzen.github.io/xtdcce2 Shows the formula for calculating pairwise correlations used in the Weighted CD test (CDw), incorporating cross-section specific Rademacher weights. ```text rho(ij) = sum(t=1,T) w(i)eps(i,t)eps(j,t)w(j) ``` -------------------------------- ### Repeat Weighted CD Test with Multiple Repetitions Source: https://janditzen.github.io/xtdcce2 Performs the weighted cross-sectional dependence test multiple times with different weights using the 'reps()' option. This can reduce the dependence of the test statistic on specific weight choices. ```stata xtcd2 res, cdw reps(20) ``` -------------------------------- ### Estimate Mean Group Model without Constant Source: https://janditzen.github.io/xtdcce2 Estimate a growth equation using the mean group estimator with the 'nocrosssectional' option. The constant is partialled out when 'reportconstant' is omitted. ```stata xtdcce2 d.log_rgdpo L.log_rgdpo log_hc log_ck log_ngd , nocross ``` -------------------------------- ### Null Hypothesis for CD Test Source: https://janditzen.github.io/xtdcce2 States the null hypothesis for the Pesaran (2015) CD test, asserting weak cross-sectional dependence among error terms. ```text H0: errors are weakly cross sectional dependent. ``` -------------------------------- ### Empirical Model without Lag of Independent Variable Source: https://janditzen.github.io/xtdcce2 This empirical model is a simplified version of equation (1), excluding the lag of the independent variable x(i,t-1). It includes cross-sectional means. ```mathematica y(i,t) = b0(i) + b1(i)*y(i,t-1) + x(i,t)*b2(i) + sum[d(i)*z(i,s)] + e(i,t) ``` -------------------------------- ### Error Correction Model (ECM) Equation Source: https://janditzen.github.io/xtdcce2 This equation transforms a model into an ARDL format for estimating between mean group and pooled estimations, differentiating between homogenous long run and heterogeneous short run effects. ```mathematica (6)y(i,t) = phi(i)*(y(i,t-1) - w0(i) - x(i,t)*w2(i)) + g1(i)*[y(i,t)-y(i,t-1)] + [x(i,t) - x(i,t-1)] * g2(i) + e(i,t), ``` -------------------------------- ### rCCE Overall Error Variance Estimator Source: https://janditzen.github.io/xtdcce2 Definition of s^2, the overall error variance estimator used in the rCCE method. ```mathematica s^2 = 1/(N (T -1)) sum(i=1,N) sum(t=1,T) (y(i,t) - ybar(i) )^2. ``` -------------------------------- ### Rank Condition Classifier with ER and Random Shrinkage Source: https://janditzen.github.io/xtdcce2 Calculates the rank condition classifier using the ER criterion to estimate the number of common factors and a fold-over matrix for dimension shrinkage. This is useful when dealing with potential issues in rank estimation. ```stata xtdcce2 d.log_rgdpo log_hc log_ck log_ngd , cr(_all, rccl(er random)) ``` -------------------------------- ### CD Star Test Statistic Formula Source: https://janditzen.github.io/xtdcce2 Provides the formula for the bias-corrected CD Star test statistic (CD*), which adjusts the standard CD statistic using a bias correction term Theta. ```text CD* = (CD + (T/2*Theta)^(1/2))/(1-Theta) ``` -------------------------------- ### Cross-Section Augmented Distributed Lag (CS-DL) Model Source: https://janditzen.github.io/xtdcce2 This model directly estimates the long run effect of a variable x on y. It includes cross-sectional averages and first differences of explanatory variables to account for lags of the dependent variable. ```mathematica (8) y(i,t) = w0(i) + x(i,t) * w2(i) + delta(i) * (x(i,t) - x(i,t-1)) + sum [d(i)*z(i,s)] + e(i,t) ``` -------------------------------- ### OLS Estimation for Error Correction Models Source: https://janditzen.github.io/xtdcce2 This equation shows the OLS estimation version of the ECM model, which is used by xtdcce2. It allows for IV regressions and the addition of cross-sectional averages. ```mathematica (7) y(i,t) = o0(i) + phi(i)*y(i,t-1) + x(i,t)*o2(i) + g1(i)*[y(i,t)-y(i,t-1)] + [x(i,t) - x(i,t-1)] * g2(i) + e(i,t), ``` -------------------------------- ### Rank Classifier Formula Source: https://janditzen.github.io/xtdcce2 The Rank Classifier (RC) formula indicates if the rank condition holds for consistent estimation in the presence of common factors and strong cross-sectional dependence. RC = 1 implies the rank condition holds. ```mathematica RC = 1 − I (g