Combining a VAR and a ARMA into a matrix

If you are seeking RATS code for implementing a particular technique or replicating results from a paper, post your request here. Be sure to include complete citations for any papers or books.
Emilie_R
Posts: 7
Joined: Sat Dec 10, 2016 4:27 am

Combining a VAR and a ARMA into a matrix

Unread post by Emilie_R »

Hello,

I want to combine a VAR model (with 2 variables) and an arma to forecast a serie.

I have this example :

Code: Select all

 do time = prevstart,prevend-stepsahead

linreg(define=limpeq,noprint) limp estimstart time reslimp
 # constant limp{1} lpib{0 2 3} dum200901

 boxjenk(define=lpibeq,constant,ar=2,diffs=1,regressors,noprint) lpib estimstart time reslpib
 # dum200804

 vcv(matrix=v2,noprint)
 # reslpib reslimp
 group(vcv=v2) fullmodel lpibeq limpeq

 forecast(model=fullmodel,from=time+1,to=time+stepsahead,stderrs=stderrs11,noprint,results=fore17)
 compute rhat1(time+stepsahead)=fore17(2)(time+stepsahead)
end do 
But, instead of the linreg, i have a VAR so i don't how how to create a matrix that combine those 2 models (VAR + ARMA).
Emilie_R
Posts: 7
Joined: Sat Dec 10, 2016 4:27 am

Re: Combining a VAR and a ARMA into a matrix

Unread post by Emilie_R »

I am blocked here:

Code: Select all

compute estimstart = 2001:01
compute estimend = 2016:02
compute prevstart = 2001:01
compute prevend = 2016:02
compute stepsahead = 1

clear rhat1
do time = prevstart,prevend-stepsahead

system(model=varmodel1)
variables dlsalr dlipc 
lags 1 to 4
det constant DUM200803 DUM200903 
end(system)
estimate(residuals=reslsalr) estimstart time

 BOXJENK(DIFFS=1,CONST,AR=2,MA=1,DEFINE=ARMA) LIPC estimstart time reslipc
 # dum200804

 vcv(matrix=v2,noprint)
 # reslsalr reslipc
 group(vcv=v2) fullmodel varmodel1 arma

 forecast(model=fullmodel,from=time+1,to=time+stepsahead,stderrs=stderrs11,noprint,results=fore14)
 compute rhat1(time+stepsahead)=fore14(2)(time+stepsahead)
end do
I have this message :
## SX22. Expected Type EQUATION or FRML[REAL], Got MODEL Instead
>>>>ullmodel varmodel1 <<<<
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Combining a VAR and a ARMA into a matrix

Unread post by TomDoan »

GROUP takes EQUATIONS or FRML's not MODELs as parameters. Instead, eliminate the GROUP instruction and "add" the ARMA to your model,

forecast(model=varmodel1+arma,from=time+1,to=time+stepsahead,stderrs=stderrs11,noprint,results=fore14)
Emilie_R
Posts: 7
Joined: Sat Dec 10, 2016 4:27 am

Re: Combining a VAR and a ARMA into a matrix

Unread post by Emilie_R »

I checked the detailled instruction in your website so i knew it wasn't going to work but i didn't find any alternative: I didn't know it was possible to simply cumulate models with that instruction!!
And it works perfectly.

Thank you again :D
Post Reply