Example of conditional forecasting in a VAR. From User's Guide, Section 7.7.2.


open data oecdsample.rat
calendar(q) 1981
data(format=rats) 1981:1 2006:4 can3mthpcp canexpgdpchs $
   canexpgdpds canm1s canusxsr usaexpgdpch
*
set logcangdp  = log(canexpgdpchs)
set logcandefl = log(canexpgdpds)
set logcanm1   = log(canm1s)
set logusagdp  = log(usaexpgdpch)
set logexrate  = log(canusxsr)
*
system(model=canmodel)
variables logcangdp logcandefl logcanm1 logexrate can3mthpcp logusagdp
lags 1 to 4
det constant
end(system)
estimate
*
compute fstart=2007:1,fend=2009:4
*
@condition(model=canmodel,steps=12,results=condfore) 2
# logusagdp 2007:4 logusagdp(2006:4)+.05
# logusagdp 2008:4 logusagdp(2006:4)+.10
forecast(model=canmodel,results=forecasts,from=fstart,to=fend)
*
do i=1,6
   compute [label] l=%modellabel(canmodel,i)
   graph(header="Forecasts of "+l,window=l,$
      key=below,klabels=||"Unconditional","Conditional"||) 2
   # forecasts(i)
   # condfore(i)
end do i
*
* This saves 1000 simulated values of Canadian Real GDP from the
* distribution constrained to 5% real growth of US Real GDP. It uses a
* series of vectors of dimension 1000; one for each time period during
* the forecast range.
*
compute ndraws=1000
dec series[vect] can
gset can fstart fend = %zeros(ndraws,1)
do draw=1,ndraws
   @condition(simulate,model=canmodel,steps=12,results=simfore) 2
   # logusagdp 2007:4 logusagdp(2006:4)+.05
   # logusagdp 2008:4 logusagdp(2006:4)+.10
   do t=fstart,fend
      compute can(t)(draw)=simfore(1)(t)
   end do t
end do draw
*
* Compute the 84th and 16th percentiles of the distribution
*
set upper fstart fend = %fractiles(can(t),||.84||)(1)
set lower fstart fend = %fractiles(can(t),||.16||)(1)
graph(header="Canadian Real GDP with High Growth of US GDP",key=below,$
  klabels=||"Unconditional","Conditional","84%ile","16%ile"||) 4
# forecasts(1)
# condfore(1)
# upper / 3
# lower / 3
*
* Transform the GDP numbers into average (annualized) growth rates from fstart-1.
*
set fgrowth fstart fend = 400.0*(forecasts(1)-logcangdp(fstart-1))/(t-fstart+1)
set cgrowth fstart fend = 400.0*(condfore(1)-logcangdp(fstart-1))/(t-fstart+1)
set ugrowth fstart fend = 400.0*(upper-logcangdp(fstart-1))/(t-fstart+1)
set lgrowth fstart fend = 400.0*(lower-logcangdp(fstart-1))/(t-fstart+1)
graph(header="Canadian Real GDP Average Growth with High Growth of US GDP",key=below,$
  klabels=||"Unconditional","Conditional","84%ile","16%ile"||) 4
# fgrowth
# cgrowth
# ugrowth / 3
# lgrowth / 3


Graphs

This generates graphs of the constrained and unconstrained forecasts for each of the six variables in the model. This shows one of those, along with a graph of average growth rates with simulation bounds.