Page 1 of 1

Combining a VAR and a ARMA into a matrix

Posted: Sat Dec 10, 2016 11:06 am
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).

Re: Combining a VAR and a ARMA into a matrix

Posted: Sat Dec 10, 2016 11:25 am
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 <<<<

Re: Combining a VAR and a ARMA into a matrix

Posted: Sun Dec 11, 2016 4:55 pm
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)

Re: Combining a VAR and a ARMA into a matrix

Posted: Mon Dec 12, 2016 4:19 am
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