Bookmark and Share

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


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

RE: st: RE: RE: RE: RE: RE: RE: RE: RE: RE: Foreach Command in Panel Data


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: RE: RE: RE: RE: RE: RE: RE: RE: RE: Foreach Command in Panel Data
Date   Thu, 30 Sep 2010 12:28:08 +0100

Your questions are morphing into how best to work with specific time series commands for panel data. If a time series and/or panel expert on the list can't help, then I'd try Stata tech support. 

Nick 
[email protected] 

Degas Wright

You are correct it is not in the help file.  I am trying the command levelsof to create a macro containing all the values that identify the panels and then run a loop restricting the sample to each panel. 

Steve Samuels

I don't see it in the -help- for -fcast-  in Stata Version 11.1.
Where do you see it documented?

On Wed, Sep 29, 2010 at 4:54 PM, Degas Wright

> Unfortunately when I tried moving the if statement I get the following:
>
> . forvalues xticker=1/`r(max)'{
> . fcast compute f_ if xticker==`xticker'
> }
>
> if not allowed
>
> Is it possible that the fcast command does not allow if statements? I
> understand that you have not used this command before but is there an
> alternate way to handle this loop?

Nick Cox
> I have never used -fcast- but I imagine that
>
> fcast compute f_, step(3) if xticker==`xticker'
>
> should be
>
> fcast compute f_ if xticker==`xticker', step(3)
>
> as -if- qualifiers are not options so far as Stata is concerned.

Degas Wright

> Thank you for the reference to 8/05 FAQ and it worked great for
> calculating the var for my dataset. A follow on question, I have been
> unsuccessful getting the fcast command to work. I have tried
> incorporating it into the original forvalue step and doing a separate
> forvalue step but neither works.
>
> . forvalues xticker=1/`r(max)'{
> .   var r ep mom if xticker==`xticker'
> .}
>
> Works fine, however; when I do the following:
>
> . forvalues xticker =1/`r(max)'{
> .    fcast compute f_, step(3) if xticker==`xticker'
> .}
>
> I get the following error:
>
> Invalid syntax r(198)
>
> I need to perform the var step first and then I can use the fcast
> command.  Also, to address your question on collating the results - I
> will upload the xtickers, forecasted values (f_r), dates into another
> software package to run backtests on how well the forecasted values
> perform in a portfolio selection process.

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index