Announcement

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

  • Threshold Regression in Panel Data

    I am trying to estimate threshold estimation for my balanced panel data. The value of T=12 & N=26. Total number of observations is 312. I installed xthreg in my STATA 16.1 and tried to estimate. However, I am getting the following error:

    Estimating the threshold parameters: 1st ...... thest(): 3200 conformabilit
    > y error
    thestm(): - function returned error
    <istmt>: - function returned error
    r(3200);

    I checked for r(3200) in STATA. It states the following:

    [M-2] error . . . . . . . . . . . . . . . . . . . . . . . . Return code 3200
    conformability error
    A matrix, vector, or scalar has the wrong number of rows and/or
    columns for what is required. Adding a 2 x 3 matrix to a 1 x 4
    would result in this error.

    I am unable to figure out which matrix/vector/scalar has wrong number of rows and/or columns.
    Any help to fix this issue will be of great help to me. Thanks in advance.

    ~Subaran.


  • #2
    Maybe you should show your code and example data.
    Raymond
    Best regards.

    Raymond Zhang
    Stata 17.0,MP

    Comment


    • #3
      Thanks Zhang. Please see the data below.

      Data V4 without HC.dta

      Here is the data. please see below the code. Thanks,

      **** First Set of Results without Human Capital****
      **** With Lag 1****
      xtabond gdpgr Lldebt agedepratioold lgovtconsf linv ltrpcgdp if agedepratioold!=999 & govtconsf !=999 & inv!=999 & trpcgdp !=999, lags(1) artests(2)
      **** with Lag 2****
      xtabond gdpgr L2ldebt agedepratioold lgovtconsf linv ltrpcgdp if agedepratioold!=999 & govtconsf !=999 & inv!=999 & trpcgdp !=999, lags(1) artests(2)
      **** with Lag 3****
      xtabond gdpgr L3ldebt agedepratioold lgovtconsf linv ltrpcgdp if agedepratioold!=999 & govtconsf !=999 & inv!=999 & trpcgdp !=999, lags(1) artests(2)
      **** Same set With more control variables ****
      **** With Lag 1****
      xtabond gdpgr Lldebt agedepratioold lgovtconsf linv ltrpcgdp lpop realintrate credittopriv if agedepratioold!=999 & govtconsf !=999 & inv!=999 & trpcgdp !=999 &realintrate !=999 & credittopriv !=9999 , lags(1) artests(2)
      **** With Lag 2****
      xtabond gdpgr L2ldebt agedepratioold lgovtconsf linv ltrpcgdp lpop realintrate credittopriv if agedepratioold!=999 & govtconsf !=999 & inv!=999 & trpcgdp !=999 &realintrate !=999 & credittopriv !=9999 , lags(1) artests(2)
      **** With Lag 3****
      xtabond gdpgr L3ldebt agedepratioold lgovtconsf linv ltrpcgdp lpop realintrate credittopriv if agedepratioold!=999 & govtconsf !=999 & inv!=999 & trpcgdp !=999 &realintrate !=999 & credittopriv !=9999 , lags(1) artests(2)

      Comment


      • #4
        here is the code for threhold reg

        xthreg gdpgr ldebt agedepratioold lgovtconsf linv ltrpcgdp if agedepratioold!=999 & govtconsf !=
        > 999 & inv!=999 & trpcgdp !=999, rx(ltrpcgdp) qx(ldebt) thnum(1) trim(0.01) grid(400) bs(50)
        Estimating the threshold parameters: 1st ...... thest(): 3200 conformabilit
        > y error
        thestm(): - function returned error
        <istmt>: - function returned error
        r(3200);

        . xthreg gdpgr ldebt ltrpcgdp, rx(ltrpcgdp) qx(ldebt) thnum(1) trim(0.01) grid(400) bs(50)
        Estimating the threshold parameters: 1st ...... thest(): 3200 conformabilit
        > y error
        thestm(): - function returned error
        <istmt>: - function returned error
        r(3200);

        Comment


        • #5
          Dear Subaran, The -xthreg- (search and install) command requires "balanced" data. Please install -xtbalance- or -xtbalance2- command for that purpose.
          Ho-Chuan (River) Huang
          Stata 19.0, MP(4)

          Comment


          • #6
            Thanks Huang. I already installed xthreg. My data is balanced panel too. I am getting the following specific error. Any help will be much appreciated. Thanks

            ~Subaran.

            xthreg gdpgr ldebt ltrpcgdp, rx(ltrpcgdp) qx( centralgovtdebtpcgdp) thnum(1) trim(0.01) grid(400) bs(50)

            Estimating the threshold parameters: 1st ...... thest(): 3200 conformability error

            thestm(): - function returned error

            istmt>: - function returned error

            r(3200);

            Comment


            • #7
              Dear Subaran,
              I can use your data to run xthreg.Here is the result.Maybe you should update the command--xthreg--.
              Code:
              . use "/private/var/folders/38/1b2z7ctd7yd90cdlc7ym_wxm0000gn/T/MicrosoftEdgeDownloads/51aaaa53-cb11-4a7b-8fe2-0dee7e0221c2/Data V4 without H
              > C.dta"
              
              . xtset c_id year
                     panel variable:  c_id (strongly balanced)
                      time variable:  year, 2000 to 2015
                              delta:  1 unit
              
              . xthreg gdpgr ldebt ltrpcgdp, rx(ltrpcgdp) qx( centralgovtdebtpcgdp) thnum(1) trim(0.01) grid(400) bs(50)
              Estimating threshold within range ( 7.0000    , 999.0000  ), obs =  367   
                1st ...  Done
              Bootstrap for single threshold
              .................................................. +   50
              
              Threshold estimator (level = 95):
              -----------------------------------------------------
                   model |    Threshold         Lower         Upper
              -----------+-----------------------------------------
                    Th-1 |       7.0000        7.0000        7.3300
              -----------------------------------------------------
              
              Threshold effect test (bootstrap = 50):
              --------------------------------------------------------------------------------------
               Threshold |       RSS        MSE      Fstat     Prob     Crit10      Crit5      Crit1
              -----------+--------------------------------------------------------------------------
                  Single |    0.0000     0.0000          .    0.000          .          .          .
              --------------------------------------------------------------------------------------
              
              Fixed-effects (within) regression               Number of obs     =        544
              Group variable: c_id                            Number of groups  =         34
              
              R-sq:                                           Obs per group:
                   within  = 0.0296                                         min =         16
                   between = 0.0761                                         avg =       16.0
                   overall = 0.0092                                         max =         16
              
                                                              F(3,507)          =       5.16
              corr(u_i, Xb)  = -0.9258                        Prob > F          =     0.0016
              
              ---------------------------------------------------------------------------------
                        gdpgr |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
              ----------------+----------------------------------------------------------------
                        ldebt |     -1.458      0.452    -3.23   0.001       -2.345      -0.570
                     ltrpcgdp |      1.387      1.436     0.97   0.335       -1.434       4.207
                              |
              _cat#c.ltrpcgdp |
                           1  |      0.667      0.614     1.09   0.278       -0.540       1.873
                              |
                        _cons |      3.026      4.889     0.62   0.536       -6.580      12.632
              ----------------+----------------------------------------------------------------
                      sigma_u |  4.2767904
                      sigma_e |  3.2136097
                          rho |  .63913597   (fraction of variance due to u_i)
              ---------------------------------------------------------------------------------
              F test that all u_i=0: F(33, 507) = 4.04                     Prob > F = 0.0000
              Best regards.

              Raymond Zhang
              Stata 17.0,MP

              Comment


              • #8
                Thanks Raymond.

                Is their any particular syntax to update xthreg. I ran the regression again but ended up with same error like previous!!

                Comment


                • #9
                  Originally posted by Subaran Roy View Post
                  Thanks Raymond.

                  Is their any particular syntax to update xthreg. I ran the regression again but ended up with same error like previous!!
                  My Stata version is 16.1.Maybe you should firstly update your Stata to the latest.if it still end with same error,you can send email to [email protected] and buy the latest version of --xthreg--from Pro Wang Qunyong.The latest version can be used to unbalanced panel data.I have bought it from Pro Wang and it runs better.
                  Code:
                  . which xthreg
                  /Applications/Stata/ado/plus/x/xthreg.ado
                  *! version, 2.0, 16june2020, [email protected]
                  Best
                  Raymond
                  Best regards.

                  Raymond Zhang
                  Stata 17.0,MP

                  Comment


                  • #10
                    Thanks Raymond. I have the STATA 16. 1 too. I will run the code you provided and see if it works. Thanks again.

                    Comment


                    • #11
                      Originally posted by Raymond Zhang View Post

                      My Stata version is 16.1.Maybe you should firstly update your Stata to the latest.if it still end with same error,you can send email to [email protected] and buy the latest version of --xthreg--from Pro Wang Qunyong.The latest version can be used to unbalanced panel data.I have bought it from Pro Wang and it runs better.
                      Code:
                      . which xthreg
                      /Applications/Stata/ado/plus/x/xthreg.ado
                      *! version, 2.0, 16june2020, [email protected]
                      Best
                      Raymond
                      I found my version of xthreg

                      C:\Users\subar\ado\plus\x\xthreg.ado
                      *! version 2014-Jan-9, [email protected]

                      May be this is the reason. I will check with the email ID you provided. Thanks,

                      Comment


                      • #12
                        Hi,

                        I ran the threshold regression using xthreg and got the following result. Does it imply that there is NO threshold in the model? Kindly let me know. Any help will be much appreciated.

                        Click image for larger version

Name:	Picture1.png
Views:	1
Size:	16.0 KB
ID:	1598020










                        Comment


                        • #13
                          Hi everyone! I am trying to estimate a threshold panel regression and get the following output:
                          0b._cat#c.l1ghe 0.558 0.791
                          (0.593) (0.592)
                          1._cat#c.l1ghe -2.597*** -2.386***
                          (0.874) (0.874)
                          I am a bit confused. Does 1 indicate below the threshold or above the threshold. My results make sense if 1 indicates below the threshold. Also, how should I interpret these results:
                          0b._cat#c.lphe_0518 -0.388 0.058 0.116
                          (0.236) (0.136) (0.133)
                          1._cat#c.lphe_0518 0.032 0.204 0.300**
                          (0.136) (0.136) (0.142)
                          2._cat#c.lphe_0518 0.192 -0.225

                          Should it be 0 - below the first threshold, 1 between gamma1 and gamma2 and 2 - above gamma 2?


                          Comment

                          Working...
                          X