Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

Re: st: RE: dfuller: why do I get different results?

 From Yuval Arbel To statalist@hsphsun2.harvard.edu Subject Re: st: RE: dfuller: why do I get different results? Date Fri, 18 Nov 2011 14:56:08 +0200

```Nick,

Your answer brings me to my second question:

I am trying to run:

bysort appt: dfuller reduct_per,noconstant regress

but I'm getting the message:

dfuller may not be combined with by

I also tried to use -statsby- but it doesn't work either:

Is there another way to run dfuller by apartments?

On Fri, Nov 18, 2011 at 1:37 PM, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> bysort appt: gen reduct1=reduct_per[_n-1]
>
> and
>
> gen reduct1 = L1.reduct
>
> give identical results only under certain conditions. One is that sorting by -appt- does _not_ itself guarantee that values for each -appt- are sorted in time order. There can be other problems with omitted observations, etc.
>
> Use time-series operators after -tsset- to generate lagged variables.
>
> Nick
> n.j.cox@durham.ac.uk
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Yuval Arbel
> Sent: 18 November 2011 11:30
> To: statalist
> Subject: st: dfuller: why do I get different results?
>
> Dear Statalist Participants,
>
> when I run:
>
> . dfuller reduct_per if appt==2862,noconstant regress
>
> I get the following outcome:
>
> 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.026            -2.641            -1.950            -1.605
>
> ------------------------------------------------------------------------------
> D.reduct_per |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
>  reduct_per |
>         L1. |  -.5409015   .0897625    -6.03   0.000    -.7229484   -.3588546
> ------------------------------------------------------------------------------
>
> Those outcomes imply that the calculated statistic for the unit-root
> test is -6.03
>
> But when I define:
>
> bysort appt: gen reduct1=reduct_per[_n-1]
> bysort appt: gen dreduct1=reduct_per-reduct_per[_n-1]
>
> and I run:
>
>
> regress dreduct1 reduct1 if appt==2862,noconst
>
> I get:
>
> . regress dreduct1 reduct1  if appt==2862,noconst
>
>      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
>
> ------------------------------------------------------------------------------
>    dreduct1 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
>     reduct1 |          0   .0509647     0.00   1.000    -.1034639    .1034639
> ------------------------------------------------------------------------------
>
> .
> Shouldn't I get exactly the same outcomes in both regressions?
>
>
> *
> *   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