Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • New package: -xtdcce2- and -xtcd2- available on SSC to estimate Common Correlated Effects and test for cross sectional dependence

    Thanks to Kit Baum a new package is available on SSC. I will discuss the package at the Stata User Group Meeting in London next month.

    The package consists of two programs:

    xtdcce2
    Description: xtdcce2 estimates a heterogeneous coefficient model in a dynamic panel with dependence between cross sectional units. It supports the Common Correlated Effects Estimator (CCE) by Pesaran (2006), the Dynamic Common Correlated Effects Estimator (DCCE), proposed by Chudik and Pesaran (2015) and the Mean Group Estimator (MG, Pesaran and Smith, 1995) and the Pooled Mean Group Estimator (PMG, Shin et. Al 1999). Additionally xtdcce tests for cross sectional dependence (if xtcd2 installed) and supports instrumental variable estimations (if ivreg2 installed).

    xtcd2
    Description: xtcd2 tests residuals or a variable for weak cross sectional dependence in a panel data model. The test is based on the test outlined in Pesaran (Econometric Reviews, 2015). Under the null the residuals or the variable are weakly cross sectional dependent. The package supports balanced and unbalanced panels and can be performed as a postestimation command.


    Both require Stata Version 12. A draft explaining the 2 programs is available here.

    More informations are available at www.jan.ditzen.net.


  • #2
    I have some questions
    1. What is the advantage of xtcd2 over the existing xtcd?
    2. Unless I misread the code, you do not demean the residuals in the unbalanced case?
    3. If I'm not mistaken, your calculation of the pairwise correlations is not numerically stable (see https://en.wikipedia.org/wiki/Pearso...on_coefficient).

    I have actually written this command myself, though I never got around to adding it to ssc. It distinguishes itself from the existing xtcd by allowing an infinite number of variables (you can test all residuals at once) and by being 10x faster due to the Mata pairwise correlations (see ssc install pwcorrf).
    Attached Files

    Comment


    • #3
      Thanks to Kit Baum a new version of xtdcce2 is available. The new version, version 1.33, has multiple improvements and novelties. The "small" improvements are:
      • predict, cfresiduals allows the prediction of the error term including the common factors.
      • Improved checks for multicollinearity.
      • The output complies with max linesize.
      • Improved detection of unbalanced panels. This is important if a variable has missings.
      • The number of lags of the cross-sectional averages can be variable specific. For example, variable x can have 2 lags and variable y 1 lag.
      The two "big" novelties are extended functions for the estimation of long run coefficients. The Cross-Sectional Augmented Distributed Lag (CS-DL) and Cross-Sectional Augmented ARDL (CS-ARDL) estimator, developed in Chudik, Mohaddes, Pesaran, Raissi (2016, Long-Run Effects in Large Heterogeneous Panel Data Models with Cross-Sectionally Correlated Errors Essays, Advances of Economics) are supported.

      The CS-DL method allows for an estimation of long run coefficients directly from a dynamic panel equation, without estimating the short run coefficients. For the estimation, the first differences of the dependent variables are added. For example an ARDL(1,2) model with three cross-sectional averages of the independent variable and only contemporanous of the dependent variable is estimated by:
      Code:
      xtdcce2 y x L(0/1).d.x, cr(y x) cr_lags(0 3)
      In earlier versions of xtdcce2, it was possible to estimate the long run coefficients of an ARDL(1,1) model, see the post https://www.statalist.org/forums/for...-cs-ardl-cs-dl

      The CS-ARDL method estimates first the short run coefficients and then calculates the long run coefficients. An ARDL(2,2) model is estimated as:
      Code:
      xtdcce2 y , lr(L(1/2).y L(0/2).x) lr_options(ardl) cr(y x) cr_lags(0 3)
      For more explanations and examples please see the do file. A working paper explaining how to use the extended version of xtdcce2 together with a review of the estimators will be available soon.

      I would be grateful for any feedback or comments. Also please get in touch if bugs are spotted.

      Comment


      • #4
        Hi JanDitzen, what is the Stata command for the Cross Sectional Dependence test that was used by Pesaran after running CS-ARDL and CS-DL approaches ... I have done predict mg or pmg.....Then, xtcd mg or pmg................However, the CD test is still high ..........Any suggestions.. Please

        Comment


        • #5
          Can you please specify more what you did in Stata exactly? If you run the regression with xtdcce2, you can predict the residuals and test them. The value of the statistic should be the same as shown in the output.

          Comment


          • #6
            Hi Jan,

            Sorry , I was I away from Stata list due to forgotten paswoard............Anyway, I do not know which Stata commad for CD test was used by kamiar mohaddes. I have used the following command,

            predict MG or PMG

            then,

            xtcd MG or PMG .........The results were completely different from kamiar mohaddes's paper. do you know which Stata command they have used....

            Regards,
            Marwan

            Comment


            • #7
              Hi Jan,

              Sorry , I was I away from Stata list due to forgotten paswoard............Anyway, I do not know which Stata commad for CD test was used by kamiar mohaddes. I have used the following command,

              predict MG or PMG

              then,

              xtcd MG or PMG .........The results were completely different from kamiar mohaddes's paper. do you know which Stata command they have used....

              Regards,
              Marwan

              Comment


              • #8
                Good evening,

                I recently started using the xtdcce2 command and have encountered the following problem:
                when trying to get the residuals after running the command, I get the following message
                "command xtdcce2133_p is unrecognized"

                Any ideas as to what is going on?

                Best regards,
                George

                Comment


                • #9
                  Just to add to my previous post (#8) that I receive the same message when using all the options for predict after running xtdcce2, including the most recent addition predict, cfresiduals.

                  Best,
                  George

                  Comment


                  • #10
                    Hi George,
                    can you please update xtdcce2 using
                    Code:
                    net install xtdcce2134, from(http://www.ditzen.net/Stata/xtdcce2_beta)
                    Please let me know if this is not working!

                    Thanks,
                    Jan

                    Comment


                    • #11
                      Hi Jan,

                      Thanks for the reply. I updated it but it still gives the same message...

                      Best,
                      George

                      Comment


                      • #12
                        Can you please make sure that any old version of xtdcce2 are uninstalled?
                        Then you can call the new version using the command line xtdcce2134.

                        Comment


                        • #13
                          I uninstalled xtdcce2 (ssc uninstall xtdcce2) and then copied the link you provided (xtdcce2134, version ->1.34). It now asks for the xtset2.ado. It seems it was not installed yet I cannot find it through the ssc.

                          Comment


                          • #14
                            Does xtdcce2 give you a message with more details?
                            You can install xtset2 from my webpage as well. Please use the following:
                            Code:
                            net install xtset2, from(http://www.ditzen.net/Stata)
                            Apologies for the inconvenience. I am moving my Stata archives to github and this takes some time.


                            Please let me know if it works.

                            Comment


                            • #15
                              No, it doesn't give any other message. xtset2 was installed without any issues and I can run xtdcce2134.
                              The only problem I had -and still do- is that when I try to save the residuals i get the message that I mentioned before
                              ""command xtdcce2133_p_int is unrecognized
                              r(199);".
                              I get the same message if I run predict after the estimation and when I include the res() option in the command.
                              I thought it was kinda odd as the CD Statistic and its p-value are presented in the regression output table.

                              PS Thank you for the replies again Jan - much appreciated.

                              Comment

                              Working...
                              X