Statalist


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

Re: st: Problem with foreach in Stata 10.1


From   "Joao Ricardo F. Lima" <[email protected]>
To   [email protected]
Subject   Re: st: Problem with foreach in Stata 10.1
Date   Mon, 17 Nov 2008 17:20:08 -0300

Dear Neil,

thanks for your answer. You are right, the subject is wrong. I apologize.
The interesting was that the looping works fine with Stata 9.2.
The first output really was of the version 9.2. You can see again my
second output that shows "Note:  N=Obs used in calculating BIC; see
[R] BIC note" too. I saw the message but didn´t pay attention.

That was exactly what I want.

Best Regards,

Joao Lima


2008/11/17 Neil Shephard <[email protected]>:
> Your title indicated -foreach- but your actually using -forval- and the
> problem isn't related to doing things in a loop.
>
> Joao Ricardo F. Lima wrote:
>> How you can see, the estat ic is repeated in each looping...
>>
>> Can someone reproduce my problem and explain what am I doing wrong?
>>
>> Thanks a lot
>>
>>
>
> It looks to me like you copied and pasted the output from 9.2 in both
> instances.  When I ran the code in Stata 10.1 (Born 11 Aug 2008) there
> was a note at the bottom of the tables output by -estat-....
>
>  Note:  N=Obs used in calculating BIC; see [R] BIC note
>
> On reading this your problem became clearer and looking at the tables
> again I notied that the Obs reported by -estat- did not match those
> reported by -dfuller-, so I took the advice given in that note and used
> thesample sizes estaimted by -dfuller- when calling -estat-...
>
> webuse air2, clear
> forvalues i=1/3 {
>  dfuller air, lags(`i')
>  estat ic, n(`r(N)')
>  }
>
> ...is this what you were expecting (output below)?
>
> Neil
>
> Augmented Dickey-Fuller test for unit root         Number of obs
> =       142
>
>                               ---------- Interpolated Dickey-Fuller
> ---------
>                  Test         1% Critical       5% Critical      10%
> Critical
>               Statistic           Value             Value             Value
> ------------------------------------------------------------------------------
>  Z(t)             -2.345            -3.496            -2.887
> -2.577
> ------------------------------------------------------------------------------
> MacKinnon approximate p-value for Z(t) = 0.1579
>
> -----------------------------------------------------------------------------
>       Model |    Obs    ll(null)   ll(model)     df
> AIC         BIC
> -------------+---------------------------------------------------------------
>           . |    142           .   -1285.563     20     2611.125
> 2670.242
> -----------------------------------------------------------------------------
>               Note:  N=142 used in calculating BIC
>
> Augmented Dickey-Fuller test for unit root         Number of obs
> =       141
>
>                               ---------- Interpolated Dickey-Fuller
> ---------
>                  Test         1% Critical       5% Critical      10%
> Critical
>               Statistic           Value             Value             Value
> ------------------------------------------------------------------------------
>  Z(t)             -1.811            -3.496            -2.887
> -2.577
> ------------------------------------------------------------------------------
> MacKinnon approximate p-value for Z(t) = 0.3751
>
> -----------------------------------------------------------------------------
>       Model |    Obs    ll(null)   ll(model)     df
> AIC         BIC
> -------------+---------------------------------------------------------------
>           . |    141           .   -1285.563     20     2611.125
> 2670.1
> -----------------------------------------------------------------------------
>               Note:  N=141 used in calculating BIC
>
> Augmented Dickey-Fuller test for unit root         Number of obs
> =       140
>
>                               ---------- Interpolated Dickey-Fuller
> ---------
>                  Test         1% Critical       5% Critical      10%
> Critical
>               Statistic           Value             Value             Value
> ------------------------------------------------------------------------------
>  Z(t)             -1.536            -3.497            -2.887
> -2.577
> ------------------------------------------------------------------------------
> MacKinnon approximate p-value for Z(t) = 0.5158
>
> -----------------------------------------------------------------------------
>       Model |    Obs    ll(null)   ll(model)     df
> AIC         BIC
> -------------+---------------------------------------------------------------
>           . |    140           .   -1285.563     20     2611.125
> 2669.958
> -----------------------------------------------------------------------------
>               Note:  N=140 used in calculating BIC
>
>
> --
> "We should make things as simple as possible, but not simpler" - Anon (not Albert Einstein)
>
>
> ***********************************************************************
> This  message  may  contain  confidential and  privileged  information.
> If you  are not the  intended recipient  you should not  disclose, copy
> or distribute information in this e-mail or take any action in reliance
> on its contents.  To do so is strictly  prohibited and may be unlawful.
> Please  inform  the  sender that  this  message has  gone astray before
> deleting it.  Thank you.
>
> 2008 marks the 60th anniversary of the NHS.  It's an opportunity to pay
> tribute to the NHS staff and volunteers who help shape the service, and
> celebrate their achievements.
>
> If you work for the NHS  and  would like  an NHSmail  email account, go
> to: www.connectingforhealth.nhs.uk/nhsmail
> ***********************************************************************
>
> *
> *   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/
>



-- 
-------------------------------
Joao Ricardo Lima
Professor
UFPB-CCA-DCFS
+553138923914
-------------------------------

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index