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: Out of sample predictions and removing seasonal adjustments using ARIMA and predict


From   Robson Glasscock <[email protected]>
To   [email protected]
Subject   Re: st: Re: Out of sample predictions and removing seasonal adjustments using ARIMA and predict
Date   Sun, 11 Sep 2011 08:40:23 -0400

Hi Richard,

You may get a better answer, but I hope this is enough to get you started.

(1) There are no observations in the data set with time > 1998q3. Set
the number of observations to 220 since you are predicting through
2000 Q4.

webuse friedman2, clear
set obs 220
replace time= tq(1998q3) + _n - 211 if _n > 211
sort time
generate ld_m1 = log(m1 / L.m1)
generate ld_m1_sa = S4.ld_m1
arima ld_m1_sa, ar(1) ma(4) noconstant
predict pred_ld_m1_sa, dynamic(q(1998q4))

Note that if the last line of the above is unchanged and remains as
"predict pred_ld_m1_sa if tin(1998q4, 2000q4), dynamic(q(1998q4))",
then there are 0's for each prediction.

(2) I don't know

best,
Robson Glasscock

On Sat, Sep 10, 2011 at 12:23 PM, Richard Herron
<[email protected]> wrote:
> I am switching to Stata from R having some difficulties with _predict_
> and seasonal adjustments.
>
> I generate a stationary series with a log-difference then a seasonal
> correction. Next I fit an ARIMA model with which I would like to make
> out of sample predictions.
>
> (1) How do I append my predictions? I don't see an option in _predict_
> and I can't figure out how to add observations.
>
> (2) How do I undo seasonal adjustment? There is a clunky manual
> solution, but it seems that I should use a built-in function or a
> better ARIMA model to handle this.
>
> Thanks!
>
> * begin code
> webuse friedman2, clear
> generate ld_m1 = log(m1 / L.m1)
> generate ld_m1_sa = S4.ld_m1
> arima ld_m1_sa, ar(1) ma(4) noconstant
> predict pred_ld_m1_sa if tin(1998q4, 2000q4), dynamic(q(1998q4))
> * end code
> *
> *   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/
>

*
*   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