Hello all,

My current project aims to test whether gdp growth rate varies with different regimes of foreign direct investment. For this reason, I am running a simple threshold model.

$$
gdpgr = \alpha + \beta_1 (fdi < \gamma) + \beta_2 (fdi > \gamma) + \epsilon
$$

My choices to run the above model specifications are XTHREG, THRESHOLD, and Hansen's THRESHOLDREG, based on how my data is organized.

Now, my sample comprises of a list of 32 countries with different start years and different end years, and no gaps. see the description below.

Code:
. // describe the final data 
. xtset ccode year 
       panel variable:  ccode (unbalanced)
        time variable:  year, 1996 to 2017
                delta:  1 unit

. tsset ccode year 
       panel variable:  ccode (unbalanced)
        time variable:  year, 1996 to 2017
                delta:  1 unit
Code:
. xtdescribe // list available time-series, by country 

   ccode:  1, 2, ..., 52                                     n =         32
    year:  1996, 1997, ..., 2017                             T =         22
           Delta(year) = 1 unit
           Span(year)  = 22 periods
           (ccode*year uniquely identifies each observation)

Distribution of T_i:   min      5%     25%       50%       75%     95%     max
                        10      15      19        21        22      22      22

     Freq.  Percent    Cum. |  Pattern
 ---------------------------+------------------------
       15     46.88   46.88 |  1111111111111111111111
        6     18.75   65.63 |  111111111111111111111.
        2      6.25   71.88 |  .......111111111111111
        2      6.25   78.13 |  11111111111111111111..
        1      3.13   81.25 |  .......1111111111.....
        1      3.13   84.38 |  .....11111111111111111
        1      3.13   87.50 |  ....11111111111111111.
        1      3.13   90.63 |  ....111111111111111111
        1      3.13   93.75 |  11111111111111111.....
        2      6.25  100.00 | (other patterns)
 ---------------------------+------------------------
       32    100.00         |  XXXXXXXXXXXXXXXXXXXXXX

. 
. xtpatternvar, gen(pattern) // list available time-series, count 

. tab pattern 

               pattern |      Freq.     Percent        Cum.
-----------------------+-----------------------------------
.......1111111111..... |         10        1.56        1.56
.......111111111111111 |         30        4.67        6.23
.....11111111111111111 |         17        2.65        8.88
....11111111111111111. |         17        2.65       11.53
....111111111111111111 |         18        2.80       14.33
11111111111111111..... |         17        2.65       16.98
111111111111111111.... |         18        2.80       19.78
1111111111111111111... |         19        2.96       22.74
11111111111111111111.. |         40        6.23       28.97
111111111111111111111. |        126       19.63       48.60
1111111111111111111111 |        330       51.40      100.00
-----------------------+-----------------------------------
                 Total |        642      100.00

.
It is my understanding that XTHREG definitely cannot be used here, since the data is NOT balanced.

However, I am NOT sure whether THRESHOLD regression specification would aid my purpose. When I give it a try, I get the following "gaps not allowed" error.

Code:
. // THRESHOLD regression 
. threshold pcig, threshvar(fdi2gdp)
gaps not allowed
r(198);
Is THRESHOLD specification also for perfectly balanced data only?


As a check, I ran the THRESHOLD specification for a subset of my sample that is PERFECTLY BALANCED. However, I land with the same error!

Code:
. // describe the final data 
. xtset ccode year 
       panel variable:  ccode (strongly balanced)
        time variable:  year, 1996 to 2017
                delta:  1 unit

. tsset ccode year 
       panel variable:  ccode (strongly balanced)
        time variable:  year, 1996 to 2017
                delta:  1 unit
. 
. xtdescribe // list available time-series, by country 

   ccode:  1, 4, ..., 52                                     n =         15
    year:  1996, 1997, ..., 2017                             T =         22
           Delta(year) = 1 unit
           Span(year)  = 22 periods
           (ccode*year uniquely identifies each observation)

Distribution of T_i:   min      5%     25%       50%       75%     95%     max
                        22      22      22        22        22      22      22

     Freq.  Percent    Cum. |  Pattern
 ---------------------------+------------------------
       15    100.00  100.00 |  1111111111111111111111
 ---------------------------+------------------------
       15    100.00         |  XXXXXXXXXXXXXXXXXXXXXX

. 
. xtpatternvar, gen(pattern) // list available time-series, count 

. tab pattern 

               pattern |      Freq.     Percent        Cum.
-----------------------+-----------------------------------
1111111111111111111111 |        330      100.00      100.00
-----------------------+-----------------------------------
                 Total |        330      100.00

. 
. // THRESHOLD regression 
. threshold pcig, threshvar(fdi2gdp)
gaps not allowed
r(198);
What am I missing?

P.S: The analysis runs flawlessly Hansen's THRESHOLDREG program specification. However, it does not support any post estimation options.