Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: How to generate a table with the outcomes of unit-root tests from unbalanced panel?


From   Yuval Arbel <yuval.arbel@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to generate a table with the outcomes of unit-root tests from unbalanced panel?
Date   Fri, 18 Nov 2011 10:14:14 +0200

Eventually, I found the following solution to the problem:

. bysort appt: gen reduct1=reduct_per[_n-1]
(9547 missing values generated)

. bysort appt: gen dreduct=reduct_per-reduct_per[_n-1]
(9547 missing values generated)

. bysort appt: reg dreduct reduct1,noconstant

-------------------------------------------------------------------------------------------------------------------
-> appt = 2851

      Source |       SS       df       MS              Number of obs =      27
-------------+------------------------------           F(  1,    26) =    0.83
       Model |  6.97026022     1  6.97026022           Prob > F      =  0.3703
    Residual |   218.02974    26  8.38575922           R-squared     =  0.0310
-------------+------------------------------           Adj R-squared = -0.0063
       Total |         225    27  8.33333333           Root MSE      =  2.8958

------------------------------------------------------------------------------
     dreduct |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     reduct1 |   .0061958   .0067958     0.91   0.370    -.0077733    .0201648
------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------
-> appt = 2862

      Source |       SS       df       MS              Number of obs =      36
-------------+------------------------------           F(  1,    35) =    0.00
       Model |           0     1           0           Prob > F      =  1.0000
    Residual |         625    35  17.8571429           R-squared     =  0.0000
-------------+------------------------------           Adj R-squared = -0.0286
       Total |         625    36  17.3611111           Root MSE      =  4.2258

------------------------------------------------------------------------------
     dreduct |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     reduct1 |          0   .0509647     0.00   1.000    -.1034639    .1034639
------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------
-> appt = 2906

      Source |       SS       df       MS              Number of obs =      93
-------------+------------------------------           F(  1,    92) =    1.22
       Model |  91.7955488     1  91.7955488           Prob > F      =  0.2731
    Residual |  6946.26495    92  75.5028799           R-squared     =  0.0130
-------------+------------------------------           Adj R-squared =  0.0023
       Total |   7038.0605    93  75.6780699           Root MSE      =  8.6892

------------------------------------------------------------------------------
     dreduct |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     reduct1 |  -.0265432   .0240726    -1.10   0.273    -.0743535    .0212672
------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------
-> appt = 2907

      Source |       SS       df       MS              Number of obs =     102
-------------+------------------------------           F(  1,   101) =    3.28
       Model |  90.3682494     1  90.3682494           Prob > F      =  0.0732
    Residual |  2784.53244   101  27.5696281           R-squared     =  0.0314
-------------+------------------------------           Adj R-squared =  0.0218
       Total |  2874.90069   102  28.1853009           Root MSE      =  5.2507

------------------------------------------------------------------------------
     dreduct |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     reduct1 |  -.0418621   .0231222    -1.81   0.073    -.0877303    .0040061
------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------
-> appt = 2908

      Source |       SS       df       MS              Number of obs =      98
-------------+------------------------------           F(  1,    97) =    0.00
       Model |           0     1           0           Prob > F      =  1.0000
    Residual |        7225    97  74.4845361           R-squared     =  0.0000
-------------+------------------------------           Adj R-squared = -0.0103
       Total |        7225    98  73.7244898           Root MSE      =  8.6304

------------------------------------------------------------------------------
     dreduct |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     reduct1 |          0   .0195403     0.00   1.000    -.0387822    .0387822
------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------
-> appt = 2912

      Source |       SS       df       MS              Number of obs =      84
-------------+------------------------------           F(  1,    83) =    0.00
       Model |           0     1           0           Prob > F      =  1.0000
    Residual |        4900    83  59.0361446           R-squared     =  0.0000
-------------+------------------------------           Adj R-squared = -0.0120
       Total |        4900    84  58.3333333           Root MSE      =  7.6835

------------------------------------------------------------------------------
     dreduct |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     reduct1 |          0   .0234018     0.00   1.000    -.0465453    .0465453
------------------------------------------------------------------------------





On Fri, Nov 18, 2011 at 9:02 AM, Muhammad Anees <anees@aneconomist.com> wrote:
> As the -help dfuller- suggest -dfuller- only saves the following
> Scalars in r() about which you would already be familiar:
>
>
>      r(N)           number of observations
>      r(lags)        number of lagged differences
>      r(Zt)          Dickey-Fuller test statistic
>      r(p)           MacKinnon approximate p-value (if there is a constant or
>                       trend in associated regression)
>
> In running the -reg- and -esttab- is of limited help in earlier
> example. You need to seek help of the ado which results the
> interpolated Dickey-Fuller t-statistic. I hope this shed some light on
> what you need to do.
>
> On Fri, Nov 18, 2011 at 10:52 AM, Yuval Arbel <yuval.arbel@gmail.com> wrote:
>> I believe what I need is to construct a macro with -foreach- command
>> and for each appt number to carry out the -dfuller- command.
>> However, I don't know how exactly to construct such a macro. Can you assist me?
>>
>> On Thu, Nov 17, 2011 at 5:58 PM, Austin Nichols <austinnichols@gmail.com> wrote:
>>> Yuval Arbel <yuval.arbel@gmail.com>:
>>> I doubt you really want -dfuller- output.  You should read at minimum:
>>> http://www.econ.cam.ac.uk/faculty/pesaran/lm.pdf
>>> http://www.econ.cam.ac.uk/faculty/pesaran/wp11/Interpretation-Panel-Unit-September-2011.pdf
>>> and see especially the lit review in the second for recent work.
>>>
>>> On Thu, Nov 17, 2011 at 10:05 AM, Muhammad Anees <anees@aneconomist.com> wrote:
>>>> -Dfuller- runs regression where the Z(t) is the coefficient of the
>>>> estimated lagged Dep.Var with D.(Dep.Var) as the dependent variable.
>>>> Using the estout option after the regress command could do what you
>>>> want.
>>>>
>>>> example is give from my results
>>>>  energyusekt |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
>>>> -------------+----------------------------------------------------------------
>>>>  energyusekt |
>>>>         L1. |   .0349052   .0078295     4.46   0.000      .018976    .0508345
>>>>             |
>>>>       _cons |   384.8409   365.0711     1.05   0.299    -357.9018    1127.584
>>>> ------------------------------------------------------------------------------
>>>>
>>>> . estimates store a
>>>>
>>>> . esttab
>>>>
>>>> ----------------------------
>>>>                      (1)
>>>>             D.energyus~t
>>>> ----------------------------
>>>> L.energyus~t       0.0349***
>>>>                   (4.46)
>>>>
>>>> _cons               384.8
>>>>                   (1.05)
>>>> ----------------------------
>>>> N                      35
>>>> ----------------------------
>>>> t statistics in parentheses
>>>>
>>>> Now using other Stata tools, it can easily be exported.
>>>> regress d.energyusekt l.energyusekt
>>>> On Thu, Nov 17, 2011 at 7:49 PM, Yuval Arbel <yuval.arbel@gmail.com> wrote:
>>>>> Dear statalist participants,
>>>>>
>>>>> I have an unbalanced panel of apartments, which contains 9,547 apartments.
>>>>>
>>>>> I ran the following commands:
>>>>>
>>>>> . tsset t
>>>>>        time variable:  t, 1 to 507798
>>>>>                delta:  1 unit
>>>>>
>>>>> . dfuller reduct_per if appt==2851
>>>>>
>>>>> Dickey-Fuller test for unit root                   Number of obs   =        27
>>>>>
>>>>>                               ---------- Interpolated Dickey-Fuller ---------
>>>>>                  Test         1% Critical       5% Critical      10% Critical
>>>>>               Statistic           Value             Value             Value
>>>>> ------------------------------------------------------------------------------
>>>>>  Z(t)             -0.891            -3.736            -2.994            -2.628
>>>>> ------------------------------------------------------------------------------
>>>>> MacKinnon approximate p-value for Z(t) = 0.7910
>>>>>
>>>>> . dfuller reduct_per if appt==2862
>>>>>
>>>>> Dickey-Fuller test for unit root                   Number of obs   =        37
>>>>>
>>>>>                               ---------- Interpolated Dickey-Fuller ---------
>>>>>                  Test         1% Critical       5% Critical      10% Critical
>>>>>               Statistic           Value             Value             Value
>>>>> ------------------------------------------------------------------------------
>>>>>  Z(t)             -6.784            -3.668            -2.966            -2.616
>>>>> ------------------------------------------------------------------------------
>>>>> MacKinnon approximate p-value for Z(t) = 0.0000
>>>>>
>>>>> . dfuller reduct_per if appt==2906
>>>>>
>>>>> Dickey-Fuller test for unit root                   Number of obs   =        94
>>>>>
>>>>>                               ---------- Interpolated Dickey-Fuller ---------
>>>>>                  Test         1% Critical       5% Critical      10% Critical
>>>>>               Statistic           Value             Value             Value
>>>>> ------------------------------------------------------------------------------
>>>>>  Z(t)             -1.313            -3.518            -2.895            -2.582
>>>>> ------------------------------------------------------------------------------
>>>>> MacKinnon approximate p-value for Z(t) = 0.6233
>>>>>
>>>>> . dfuller reduct_per if appt==2907
>>>>>
>>>>> Dickey-Fuller test for unit root                   Number of obs   =       103
>>>>>
>>>>>                               ---------- Interpolated Dickey-Fuller ---------
>>>>>                  Test         1% Critical       5% Critical      10% Critical
>>>>>               Statistic           Value             Value             Value
>>>>> ------------------------------------------------------------------------------
>>>>>  Z(t)             -2.647            -3.509            -2.890            -2.580
>>>>> ------------------------------------------------------------------------------
>>>>> MacKinnon approximate p-value for Z(t) = 0.0836
>>>>>
>>>>> Now, I would like to produce a table where for each apartment I attach
>>>>> the full output of dfuller
>>>>>
>>>>> I wonder, how can I produce such a table in a way that it can be
>>>>> exported in xls. or csv. formats:
>>>>>
>>>>> I thank you in advance for your assistance.
>>>
>>> *
>>> *   For searches and help try:
>>> *   http://www.stata.com/help.cgi?search
>>> *   http://www.stata.com/support/statalist/faq
>>> *   http://www.ats.ucla.edu/stat/stata/
>>>
>>
>>
>>
>> --
>> Dr. Yuval Arbel
>> School of Business
>> Carmel Academic Center
>> 4 Shaar Palmer Street, Haifa, Israel
>> e-mail: yuval.arbel@gmail.com
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>
>
>
> --
>
> Regards
> ---------------------------
> Muhammad Anees
> Assistant Professor
> COMSATS Institute of Information Technology
> Attock 43600, Pakistan
> www.aneconomist.com
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>



-- 
Dr. Yuval Arbel
School of Business
Carmel Academic Center
4 Shaar Palmer Street, Haifa, Israel
e-mail: yuval.arbel@gmail.com

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index