Announcement

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

  • Problem with xtunitroot not recognizing variable

    Dear Stata forum members,

    I am interested in performing a test for unit roots in my panel dataset. I am using the Im-Pesaran-Shin (IPS) test, as I am working with an unbalanced panel dataset which looks as follows:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int wbcode2 str46 country double year float(y z)
      4 "Albania"             1981        . 700.2622
     4 "Albania"             1982        . 701.2576
     4 "Albania"             1983        . 700.4279
     4 "Albania"             1984        . 697.0951
     4 "Albania"             1985        . 696.5898
     4 "Albania"             1986        . 699.5364
     4 "Albania"             1987        . 696.0583
     4 "Albania"             1988        . 692.1292
     4 "Albania"             1989        . 699.6201
     4 "Albania"             1990        .  688.527
     4 "Albania"             1991        . 653.3777
     4 "Albania"             1992        . 646.6589
     4 "Albania"             1993        . 657.1221
     4 "Albania"             1994        . 666.5153
     4 "Albania"             1995        . 680.2153
     4 "Albania"             1996 759.1942 689.8364
     4 "Albania"             1997        . 679.7451
     4 "Albania"             1998        . 692.1179
     4 "Albania"             1999        .  701.945
     4 "Albania"             2000        . 709.0192
     4 "Albania"             2001        . 715.6054
     4 "Albania"             2002 755.0409  718.062
     4 "Albania"             2003        . 723.0593
     4 "Albania"             2004        . 728.2089
     4 "Albania"             2005 770.4127 733.0224
     4 "Albania"             2006        . 737.4312
     4 "Albania"             2007        . 742.7509
     4 "Albania"             2008 777.7005 749.7994
     4 "Albania"             2009        . 752.6907
     4 "Albania"             2010        . 755.7471
     6 "Argentina"           1981        . 885.4302
     6 "Argentina"           1982        . 878.8189
     6 "Argentina"           1983        . 881.0916
     6 "Argentina"           1984        . 881.7568
     6 "Argentina"           1985        . 872.3582
     6 "Argentina"           1986 893.8957 878.4457
     6 "Argentina"           1987 880.8799  879.836
     6 "Argentina"           1988        . 875.7877
     6 "Argentina"           1989        . 866.5623
     6 "Argentina"           1990        . 862.7296
     6 "Argentina"           1991 840.1109 873.2861
     6 "Argentina"           1992 844.5835  883.226
     6 "Argentina"           1993 846.8036 887.6558
     6 "Argentina"           1994  843.349 892.0464
     6 "Argentina"           1995  835.522 887.9047
     6 "Argentina"           1996 831.3823 892.0524
     6 "Argentina"           1997 838.1978 898.6461
     6 "Argentina"           1998 829.3229 901.2557
     6 "Argentina"           1999 828.6542 896.6932
     6 "Argentina"           2000 823.6368 894.8403
     6 "Argentina"           2001   812.23 889.3307
     6 "Argentina"           2002 774.5782  876.848
     6 "Argentina"           2003  811.662  884.407
     6 "Argentina"           2004   827.03 892.1624
     6 "Argentina"           2005 837.4753 900.0604
     6 "Argentina"           2006 850.8935 907.3051
     6 "Argentina"           2007 854.4684 914.7261
     6 "Argentina"           2008 860.5446 920.3903
     6 "Argentina"           2009 866.9901 920.3641
     6 "Argentina"           2010 868.5862 928.2607
     7 "Armenia"             1981        .        .
     7 "Armenia"             1982        .        .
     7 "Armenia"             1983        .        .
     7 "Armenia"             1984        .        .
     7 "Armenia"             1985        .        .
     7 "Armenia"             1986        .        .
     7 "Armenia"             1987        .        .
     7 "Armenia"             1988        .        .
     7 "Armenia"             1989        .        .
     7 "Armenia"             1990        . 667.8819
     7 "Armenia"             1991        . 656.3641
     7 "Armenia"             1992        . 604.0199
     7 "Armenia"             1993        . 597.1417
     7 "Armenia"             1994        . 604.7981
     7 "Armenia"             1995        .  613.539
     7 "Armenia"             1996        . 620.8334
     7 "Armenia"             1997        . 625.2849
     7 "Armenia"             1998        . 633.1551
     7 "Armenia"             1999 703.0751 636.9979
     7 "Armenia"             2000        . 643.2015
     7 "Armenia"             2001 699.0588 652.6636
     7 "Armenia"             2002 703.8257  665.205
     7 "Armenia"             2003 709.0377 678.3604
     7 "Armenia"             2004 723.7893 688.2485
     7 "Armenia"             2005 735.6433 701.1245
     7 "Armenia"             2006 742.7406 713.3945
     7 "Armenia"             2007 751.8933 726.1359
     7 "Armenia"             2008 755.9017 732.6488
     7 "Armenia"             2009 744.7542 717.2007
     7 "Armenia"             2010 744.1578 719.0481
     9 "Antigua and Barbuda" 1981        . 849.0743
     9 "Antigua and Barbuda" 1982        . 850.4492
     9 "Antigua and Barbuda" 1983        . 856.5016
     9 "Antigua and Barbuda" 1984        . 867.4309
     9 "Antigua and Barbuda" 1985        . 876.7612
     9 "Antigua and Barbuda" 1986        . 890.3862
     9 "Antigua and Barbuda" 1987        .  899.933
     9 "Antigua and Barbuda" 1988        . 906.5459
     9 "Antigua and Barbuda" 1989        . 912.9224
     9 "Antigua and Barbuda" 1990        . 915.4196
     9 "Antigua and Barbuda" 1991        .  916.552
     9 "Antigua and Barbuda" 1992        . 915.7404
     9 "Antigua and Barbuda" 1993        . 918.7645
     9 "Antigua and Barbuda" 1994        . 922.3918
     9 "Antigua and Barbuda" 1995        . 915.5472
     9 "Antigua and Barbuda" 1996        . 919.4695
     9 "Antigua and Barbuda" 1997        . 921.6172
     9 "Antigua and Barbuda" 1998        . 923.3804
     9 "Antigua and Barbuda" 1999        . 925.0287
     9 "Antigua and Barbuda" 2000        . 924.3232
     9 "Antigua and Barbuda" 2001        . 924.5861
     9 "Antigua and Barbuda" 2002        .  925.397
     9 "Antigua and Barbuda" 2003        .  928.853
     9 "Antigua and Barbuda" 2004        . 934.2868
     9 "Antigua and Barbuda" 2005        . 937.0965
     9 "Antigua and Barbuda" 2006        . 948.3361
     9 "Antigua and Barbuda" 2007        . 957.3103
     9 "Antigua and Barbuda" 2008        . 956.9407
     9 "Antigua and Barbuda" 2009        . 943.9459
     9 "Antigua and Barbuda" 2010        . 938.3828
    10 "Australia"           1981  926.277 960.0023
    10 "Australia"           1982        . 961.5115
    10 "Australia"           1983        . 957.9136
    10 "Australia"           1984        . 961.2773
    10 "Australia"           1985 927.9258 964.9133
    10 "Australia"           1986        . 967.7253
    10 "Australia"           1987        . 968.7257
    10 "Australia"           1988        . 972.7957
    10 "Australia"           1989  930.525 974.9674
    10 "Australia"           1990        . 976.9996
    10 "Australia"           1991        . 975.4856
    10 "Australia"           1992        . 974.7252
    10 "Australia"           1993        . 977.7516
    10 "Australia"           1994        . 980.5826
    10 "Australia"           1995 922.2964 983.2389
    10 "Australia"           1996        . 986.0215
    10 "Australia"           1997        . 988.7983
    10 "Australia"           1998        . 992.2396
    10 "Australia"           1999        . 996.1283
    10 "Australia"           2000        . 998.8112
    end
    The problem is the following. The two variables which I want to investigate for unit roots are the following: y=100*log(median), where median represents median household income within a country, and z=100*log(gdppercapita). When I run the IPS test, where I use the following command
    Code:
    xtunitroot ips z,  lags(aic)
    for the variable z everything works fine. But when I run this test for the variable y, I get the following error message from Stata: no observations r(2000). Stata is telling me that I want to do a certain statistical calculation and there are no observations on which to perform it.
    Some descriptive statistics of the two variables z and y:
    Code:
        Variable |        Obs        Mean    Std. Dev.       Min        Max
    -------------+---------------------------------------------------------
               y |        965    795.3641       102.6   530.2708    1003.75
               z |      4,909    756.8494    155.4241   405.6728   1094.003
    Might anyone have a clue why the IPS command works for the variable z, but not the variable y? Any advice on this would be greatly appreciated.

    I thank you for your time.

    Best,

    Ryan Marapin
    Last edited by Ryan Marapin; 11 Jun 2019, 08:57.

  • #2
    Your problem is that the null hypothesis for the IPS test is that all panels contain unit roots. Your data, however, does not allow calculation for Antigua and Barbuda, because there are no non-missing values of y, nor for Albania, because there are no observations for which both y and L.y are non-missing. Below I show some examples using the first 4 countries in your example data.
    Code:
    . xtset wbcode2 year
           panel variable:  wbcode2 (strongly balanced)
            time variable:  year, 1981 to 2010
                    delta:  1 unit
    
    . xtunitroot ips z,  lags(aic)
    
    Im-Pesaran-Shin unit-root test for z
    ------------------------------------
    Ho: All panels contain unit roots           Number of panels       =      4
    Ha: Some panels are stationary              Avg. number of periods =  27.75
    
    AR parameter: Panel-specific                Asymptotics: T,N -> Infinity
    Panel means:  Included                                        sequentially
    Time trend:   Not included
    
    ADF regressions: 1.00 lags average (chosen by AIC)
    ------------------------------------------------------------------------------
                        Statistic      p-value
    ------------------------------------------------------------------------------
     W-t-bar              0.6136        0.7303
    ------------------------------------------------------------------------------
    
    . xtunitroot ips y,  lags(aic)
    no observations
    r(2000);
    
    . drop if wbcode2==9
    (30 observations deleted)
    
    . xtunitroot ips y,  lags(aic)
    no observations
    r(2000);
    
    . drop if wbcode2==4
    (30 observations deleted)
    
    . xtunitroot ips y,  lags(aic)
    
    Im-Pesaran-Shin unit-root test for y
    ------------------------------------
    Ho: All panels contain unit roots           Number of panels       =      2
    Ha: Some panels are stationary              Avg. number of periods =  16.50
    
    AR parameter: Panel-specific                Asymptotics: T,N -> Infinity
    Panel means:  Included                                        sequentially
    Time trend:   Not included
    
    ADF regressions: 0.00 lags average (chosen by AIC)
    ------------------------------------------------------------------------------
                        Statistic      p-value
    ------------------------------------------------------------------------------
     W-t-bar             -0.1089        0.4566
    ------------------------------------------------------------------------------

    Comment


    • #3
      Dear William,

      Thank you for your response, I appreciate it. I understand now what is the problem.

      Best,

      Ryan

      Comment

      Working...
      X