VAR Forecast from Difference to Levels

Questions and discussions on Vector Autoregressions

VAR Forecast from Difference to Levels

Postby rmvoller » Thu Dec 27, 2012 6:00 pm

I have ran the following VAR model on two differenced series:

Code: Select all
System(model=dvar)
variables dx dy
lags 1 to 4
det constant
end(system)
estimate  * 2011:1

forecast(model=dvar,from=2011:2,to=2012:3,result=forecast,stderrs=s,print)


When I restrict the time series by a few periods for the in sample forecast I am able to to convert the differenced forecast to levels with the following code:

Code: Select all
set xforecast = forecast(1) + x{1}


But when I run the Var model on the full data series I am unable to convert the differenced forecasts by using the above formula. Below is the code for the Var over the full series. How could I convert my differenced forecast into levels?

Code: Select all
System(model=dvar)
variables dx dy
lags 1 to 4
det constant
end(system)
estimate

forecast(model=dvar,from=2012:3,to=2016:4,result=forecast,stderrs=s,print)


How could I convert my differenced forecast into levels?

Thanks in advance
rmvoller
 
Posts: 4
Joined: Tue Apr 10, 2012 2:36 pm

Re: VAR Forecast from Difference to Levels

Postby TomDoan » Wed Jan 02, 2013 7:47 pm

There are many different ways to do that. The simplest is probably:

set(first=forecast(1)+x{1}) accx 2012:3 2016:4 = accx{1}+forecast(1)
TomDoan
 
Posts: 2717
Joined: Wed Nov 01, 2006 5:36 pm

Re: VAR Forecast from Difference to Levels

Postby Agty » Thu Apr 11, 2013 11:29 am

Hello everybody,
I have exactly the same problem as the one rmvoller posted on december 28, 2012. I've tried thousands of times the solution gave by Tom Doan, unsuscessfully with any kind of message errors. My quaterly four variables of interest are VCREDITSEns, TxImmo, IndPrixAncien and RDB. I have made forecasts of those variables in first differences (with the following code) and I am unable to move from Differences to Levels. Can someone tell me how to adapt TomDoan code to achieve this? I thank in advance.
*
smpl de f
system(model=dvar)
variables dVCREDITSEns dTxImmo dIndPrixAncien dRDB
lags 1 to 2
det constant
end(system)
*
estimate
errors(model=dvar,steps=8)
FORECAST(MODEL=dvar,FROM=2013:01,TO=2018:04,result=forecast,stderrs=s,PRINT)
Agty
 
Posts: 1
Joined: Thu Apr 11, 2013 5:06 am

Re: VAR Forecast from Difference to Levels

Postby TomDoan » Thu Apr 11, 2013 1:32 pm

Something like this:

Code: Select all
cal(q) 2000:1
all 2012:4
set VCREDITSEns = %ran(1.0)
set TxImmo = %ran(1.0)
set IndPrixAncien = %ran(1.0)
set RDB = %ran(1.0)
*
dofor i = VCREDITSEns TxImmo IndPrixAncien RDB
   set %s("d"+%l(i)) = i{0}-i{1}
end dofor s
*
system(model=dvar)
variables dVCREDITSEns dTxImmo dIndPrixAncien dRDB
lags 1 to 2
det constant
end(system)
estimate
errors(model=dvar,steps=8)
FORECAST(MODEL=dvar,FROM=2013:01,TO=2018:04,result=dforecast,stderrs=s,PRINT)
*
dec vect[series] forecast(4)
set(first=dforecast(1)+vcreditsens{1})   forecast(1) 2013:1 2018:4 = dforecast(1)+forecast(1){1}
set(first=dforecast(2)+tximmo{1})        forecast(2) 2013:1 2018:4 = dforecast(2)+forecast(2){1}
set(first=dforecast(3)+indprixancien{1}) forecast(3) 2013:1 2018:4 = dforecast(3)+forecast(3){1}
set(first=dforecast(4)+rdb{1})           forecast(4) 2013:1 2018:4 = dforecast(4)+forecast(4){1}
TomDoan
 
Posts: 2717
Joined: Wed Nov 01, 2006 5:36 pm


Return to VARs (Vector Autoregression Models)

Who is online

Users browsing this forum: No registered users and 1 guest