Page 1 of 1

Forecasting with exogenous series

Posted: Thu Jul 20, 2017 8:52 am
by mgm
Dear Tom,


I need help in order to solve a problem related to forecasting with exogenous series.
I am working on a project that decomposes a series in trend and cycle. The “trend” component i consider as exogenous, and for the cycle i build an ARMA model.
It is something like:

Y(t) – y(t)TREND = cte + rho1 * (Y(t-1) – y(t-1)TREND) + rho2 * (Y(t-2) – y(t-2)TREND) + Ɛt

In this setup, i have values for “y(t)TREND” for t+1, t+2, ...

So, what i need is to forecast y(t+1), given y(t+1)TREND, in the model above.
I want the cycle component to fluctuate around the future mean level (the “exogenous” trend).

I am trying to implement this trough this piece of code:


nonlin beta1 beta2 rho1 rho2 rho3 cte

frml cyc cycle = %s(nameS1) - beta1 - beta2*%s(nameSTrend1)
compute beta1=1
compute beta2=1
compute rho1=1
compute rho2=1
compute rho3=1
compute cte = 0
nlls(frml=cyc) cycle

frml result resCycle = cyc(t) - cte - rho1*cyc(t-1) - rho2*cyc(t-2) - rho3*cyc(t-3)
nlls(frml=result) resCycle

group modelo cyc>>fcycle result>>fresCycle
declare vector[series] fcasts
forecast(model=modelo,from=2015:7,steps=3,results=fcasts,print)
print / fcasts(1) fcasts(2)

set cycle = fcasts(1)
set resCycle = fcasts(2)


The series “%s(nameS1)” is available through “2015:6” and values through “2015:9” are available to “%s(nameSTrend1)”.
The problema is, i am gettting “NAs” for the forecasted “%s(nameS1)”, as if there were no values available for the “%s(nameSTrend1)”.

What is wrong with the code ?

Thank you very much.

Marcos

Re: Forecasting with exogenous series

Posted: Thu Jul 20, 2017 10:48 am
by TomDoan
The problem is that your model never actually defines (explicitly) where the Y is created and the Y's are needed to extend the calculation outside the sample. (The second one implicitly defines it). Instead, you want to rewrite that as

frml result %s(nameS1) = beta1 + beta2*%s(nameSTrend1) + cte + rho1*cyc(t-1) + rho2*cyc(t-2) + rho3*cyc(t-3)

(You would need that to estimate the parameters anyway.)

Re: Forecasting with exogenous series

Posted: Thu Jul 20, 2017 1:36 pm
by mgm
Tom, thank you very much. It worked just fine.