Dear eviews programming experts,
i have the following problem. I'm a beginner in eviews and have to program for my master thesis in econometrics. So far, i have modelled a vectorautoregression with three variables. Now, i want to calculate one-step-ahead and six-step-ahead forecasts for this model in order to get the forecast errors. For this purpose, the forecasts should be based on a recursive forecasting scheme.
I have tried to write a corresponding program. I'm relatively sure, that this program contains errors. First, i have seen, that only the last one-step-ahead-forecast was saved, for example in the stahl_bereinigt_0 series. How can I manage, that the forecasts over the entire loop are saved in table or a series? How can i store the forecasts? And second, is the conversion from the system to the model right, because i simply defined a system, estimated the system, and then built the model. Third, are there other problems with my program? I thank you very much in advance. Below the code:
wfcreate Masterarbeit m "1991-01" "2012-02"
' creates workfile
!first=@dateval("1991-01")
!last=@dateval("2012-02")
!varnr = 3
matrix(254,!varnr) datamat
' generates matrix for data
datamat.read(a2,s=sheet2) "E:\Empirische Wirtschaftsforschung\Masterarbeit\Datensatz Masterarbeit.xls"
' read the data from the excel dataset into a data matrix
series stahl_bereinigt
series pkw_bereinigt
series logmaschinenbau
' generates series for the different variables
group variables stahl_bereinigt pkw_bereinigt logmaschinenbau
' generates a group including the individual series
mtos(datamat,variables)
' convert the data matrix to the group defined above
genr DS2 = @seas(2)-1/12
genr DS3 = @seas(3)-1/12
genr DS4 = @seas(4)-1/12
genr DS5 = @seas(5)-1/12
genr DS6 = @seas(6)-1/12
genr DS7 = @seas(7)-1/12
genr DS8 = @seas(8)-1/12
genr DS9 = @seas(9)-1/12
genr DS10 = @seas(10)-1/12
genr DS11 = @seas(11)-1/12
genr DS12 = @seas(12)-1/12
' generates centered seasonal dummies
genr DLS_masch_1 = @recode(@date>@dateval("1992-11"),1,0)
genr DLS_pkw = @recode(@date>@dateval("1992-12"),1,0)
genr DLS_stahl = @recode(@date>@dateval("2008-10"),1,0)
genr DLS_masch_2 = @recode(@date>@dateval("2008-12"),1,0)
genr DLS_masch_3 = @recode(@date>@dateval("2009-03"),1,0)
' generates dummies for the level shifts
system VAR_system
VAR_system.append stahl_bereinigt = C(1)+C(2)*@trend(1991M01)+C(3)*stahl_bereinigt(-1)+C(4)*stahl_bereinigt(-2)+C(5)*stahl_bereinigt(-3)+C(6)*pkw_bereinigt(-3)+C(7)*pkw_bereinigt(-5)+C(8)*pkw_bereinigt(-6)+C(9)*pkw_bereinigt(-7)+C(10)*logmaschinenbau(-2)+C(11)*logmaschinenbau(-3)+C(12)*logmaschinenbau(-5)+C(13)*logmaschinenbau(-6)+C(14)*DS2+C(15)*DS7+C(16)*DS8+C(17)*DS9+C(18)*DS11+C(19)*DS12+C(20)*DLS_stahl
VAR_system.append pkw_bereinigt = C(21)+C(22)*@trend(1991M01)+C(23)*stahl_bereinigt(-1)+C(24)*stahl_bereinigt(-2)+C(25)*stahl_bereinigt(-6)+C(26)*stahl_bereinigt(-7)+C(27)*pkw_bereinigt(-2)+C(28)*pkw_bereinigt(-3)+C(29)*pkw_bereinigt(-5)+C(30)*pkw_bereinigt(-7)+C(31)*logmaschinenbau(-4)+C(32)*logmaschinenbau(-5)+C(33)*logmaschinenbau(-6)+C(34)*logmaschinenbau(-7)+C(35)*DS2+C(36)*DS3+C(37)*DS4+C(38)*DS8+C(39)*DS9+C(40)*DS10+C(41)*DS11+C(42)*DS12+C(43)*DLS_pkw
VAR_system.append logmaschinenbau = C(44)+C(45)*@trend(1991M01)+C(46)*stahl_bereinigt(-1)+C(47)*stahl_bereinigt(-5)+C(48)*stahl_bereinigt(-7)+C(49)*pkw_bereinigt(-1)+C(50)*pkw_bereinigt(-5)+C(51)*pkw_bereinigt(-6)+C(52)*pkw_bereinigt(-7)+C(53)*logmaschinenbau(-1)+C(54)*logmaschinenbau(-2)+C(55)*logmaschinenbau(-3)+C(56)*DS2+C(57)*DS3+C(58)*DS4+C(59)*DS5+C(60)*DS6+C(61)*DS7+C(62)*DS8+C(63)*DS9+C(64)*DS10+C(65)*DS11+C(66)*DS12+C(67)*DLS_masch_1+C(68)*DLS_masch_2+C(69)*DLS_masch_3
' defines the systems of equations of the VAR model
!obstotal = @obssmpl
' counting the number of observations in the sample
!window = 30
' sets the forecast window
!hori = 1
' sets the forecast horizon
!foreper = !window-!hori+1
' determines the length of the forecast period and hence the series of forecasts
matrix(!foreper,!varnr) foremat
' generates matrix for the model forecasts
for !j=1 to !foreper step 1
' starts a loop for the calculation of the model forecasts
smpl "1991-01" "2012-02"-!window+!j-1
VAR_system.sur
' estimates the VAR model
VAR_system.makemodel(VAR_model)
'transforms the estimated VAR system into a model
smpl "2012-02"-!window+!j "2012-02"-!window+!j+!hori-1
' sets the forecast period
VAR_model.solve
' calculates forecasts by solving the specified VAR model
next
Recursive Forecasting Scheme
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
Re: Recursive Forecasting Scheme
Yohan,
I encountered this problem in a single equation setting. What needs to be done is to store the forecast in a temporary series first and then retrieve the forecast in the period of interest. Parts of the code that I essentially followed is in this thread.
Now, I'm also encountering the same problem in a multiple equation case. It's a matter of finding a way to store the model solution in a temporary series so that the same process can be done. So, after the VAR_model.solve line, an additional line that copies the 6-step ahead solutions to a number of holding series. Unfortunately, I haven't figured out how to do this! I'd appreciate it if you could share the code if you figure it out. Thanks!
errorterm
I encountered this problem in a single equation setting. What needs to be done is to store the forecast in a temporary series first and then retrieve the forecast in the period of interest. Parts of the code that I essentially followed is in this thread.
Now, I'm also encountering the same problem in a multiple equation case. It's a matter of finding a way to store the model solution in a temporary series so that the same process can be done. So, after the VAR_model.solve line, an additional line that copies the 6-step ahead solutions to a number of holding series. Unfortunately, I haven't figured out how to do this! I'd appreciate it if you could share the code if you figure it out. Thanks!
errorterm
Re: Recursive Forecasting Scheme
Hello errorterm,
thanks for your reply, which was the starting point for my idea. Perhaps, i haven't found the easiest way to store the forecasts, but my program is suitable for one-step-ahead as well as more-step-ahead-forecasts. I would thank you, if you can further check whether this program is absolutely correct and test it with your own data. I have calculated several forecasts from the eviews button mode and the resulting forecasts are the same as those of my program.
The code, but remember, that i haven't commented out my changes yet. I will do this later.
wfcreate Masterarbeit m 1991m1 2012m2
' creates workfile
!varnr = 3
' counts the number of variables in the model
matrix(254,!varnr) datamat
' generates matrix for data
datamat.read(a2,s=sheet2) "E:\Empirische Wirtschaftsforschung\Masterarbeit\Datensatz Masterarbeit.xls"
' read the data from the excel dataset into a data matrix
series stahl_bereinigt
series pkw_bereinigt
series logmaschinenbau
' generates series for the different variables
group variables stahl_bereinigt pkw_bereinigt logmaschinenbau
' generates a group including the individual series
mtos(datamat,variables)
' converts the data matrix to the group defined above
genr DS_2 = @seas(2)-1/12
genr DS_3 = @seas(3)-1/12
genr DS_4 = @seas(4)-1/12
genr DS_5 = @seas(5)-1/12
genr DS_6 = @seas(6)-1/12
genr DS_7 = @seas(7)-1/12
genr DS_8 = @seas(8)-1/12
genr DS_9 = @seas(9)-1/12
genr DS_10 = @seas(10)-1/12
genr DS_11 = @seas(11)-1/12
genr DS_12 = @seas(12)-1/12
' generates centered seasonal dummies
genr DLS_MAB_1 = @recode(@date>=@dateval("1992m12"),1,0)
genr DLS_PKW = @recode(@date>=@dateval("1993m1"),1,0)
genr DLS_STA = @recode(@date>=@dateval("2008m11"),1,0)
genr DLS_MAB_2 = @recode(@date>=@dateval("2009m1"),1,0)
genr DLS_MAB_3 = @recode(@date>=@dateval("2009m4"),1,0)
' generates dummies for the level shifts
' defines the systems of equations of the VAR model
!obstotal = @obssmpl
' counting the number of observations in the sample
!window = 50
' sets the forecast window
!hori = 1
' sets the forecast horizon
!foreper = !window-!hori+1
' determines the length of the forecast period and hence the series of forecasts
matrix(!foreper,!obstotal) dummymat_sta
matrix(!foreper,!obstotal) dummymat_pkw
matrix(!foreper,!obstotal) dummymat_mab
' generates matrix for the model forecasts
matrix(!foreper,!varnr) foremat
scalar DAT_MAB_3
scalar DAT_MAB_2
scalar DAT_STA
scalar endsample
scalar endrange
DAT_MAB_3 = @dtoo("2009m4")
DAT_MAB_2 = @dtoo("2009m1")
DAT_STA = @dtoo("2008m11")
endrange = @dtoo("2012m2")
for !j=1 to !foreper step 1
' starts a loop for the calculation of the model forecasts
smpl 1991m1 2012m2-!window+!j-1
' sets the estimation period for the model
endsample = endrange-!window+!j-1
group variables stahl_bereinigt pkw_bereinigt logmaschinenbau
if endsample>=DAT_MAB_3 then
system VAR_system
VAR_system.append stahl_bereinigt = C(1)+C(2)*@trend(1991M01)+C(3)*stahl_bereinigt(-1)+C(4)*stahl_bereinigt(-2)+C(5)*stahl_bereinigt(-3)+C(6)*pkw_bereinigt(-3)+C(7)*pkw_bereinigt(-5)+C(8)*pkw_bereinigt(-6)+C(9)*pkw_bereinigt(-7)+C(10)*logmaschinenbau(-2)+C(11)*logmaschinenbau(-3)+C(12)*logmaschinenbau(-5)+C(13)*logmaschinenbau(-6)+C(14)*DS_2+C(15)*DS_7+C(16)*DS_8+C(17)*DS_9+C(18)*DS_11+C(19)*DS_12+C(20)*DLS_STA
VAR_system.append pkw_bereinigt = C(21)+C(22)*@trend(1991M01)+C(23)*stahl_bereinigt(-1)+C(24)*stahl_bereinigt(-2)+C(25)*stahl_bereinigt(-6)+C(26)*stahl_bereinigt(-7)+C(27)*pkw_bereinigt(-2)+C(28)*pkw_bereinigt(-3)+C(29)*pkw_bereinigt(-5)+C(30)*pkw_bereinigt(-7)+C(31)*logmaschinenbau(-4)+C(32)*logmaschinenbau(-5)+C(33)*logmaschinenbau(-6)+C(34)*logmaschinenbau(-7)+C(35)*DS_2+C(36)*DS_3+C(37)*DS_4+C(38)*DS_8+C(39)*DS_9+C(40)*DS_10+C(41)*DS_11+C(42)*DS_12+C(43)*DLS_PKW
VAR_system.append logmaschinenbau = C(44)+C(45)*@trend(1991M01)+C(46)*stahl_bereinigt(-1)+C(47)*stahl_bereinigt(-5)+C(48)*stahl_bereinigt(-7)+C(49)*pkw_bereinigt(-1)+C(50)*pkw_bereinigt(-5)+C(51)*pkw_bereinigt(-6)+C(52)*pkw_bereinigt(-7)+C(53)*logmaschinenbau(-1)+C(54)*logmaschinenbau(-2)+C(55)*logmaschinenbau(-3)+C(56)*DS_2+C(57)*DS_3+C(58)*DS_4+C(59)*DS_5+C(60)*DS_6+C(61)*DS_7+C(62)*DS_8+C(63)*DS_9+C(64)*DS_10+C(65)*DS_11+C(66)*DS_12+C(67)*DLS_MAB_1+C(68)*DLS_MAB_2+C(69)*DLS_MAB_3
else
if endsample>=DAT_MAB_2 and endsample<DAT_MAB_3 then
system VAR_system
VAR_system.append stahl_bereinigt = C(1)+C(2)*@trend(1991M01)+C(3)*stahl_bereinigt(-1)+C(4)*stahl_bereinigt(-2)+C(5)*stahl_bereinigt(-3)+C(6)*pkw_bereinigt(-3)+C(7)*pkw_bereinigt(-5)+C(8)*pkw_bereinigt(-6)+C(9)*pkw_bereinigt(-7)+C(10)*logmaschinenbau(-2)+C(11)*logmaschinenbau(-3)+C(12)*logmaschinenbau(-5)+C(13)*logmaschinenbau(-6)+C(14)*DS_2+C(15)*DS_7+C(16)*DS_8+C(17)*DS_9+C(18)*DS_11+C(19)*DS_12+C(20)*DLS_STA
VAR_system.append pkw_bereinigt = C(21)+C(22)*@trend(1991M01)+C(23)*stahl_bereinigt(-1)+C(24)*stahl_bereinigt(-2)+C(25)*stahl_bereinigt(-6)+C(26)*stahl_bereinigt(-7)+C(27)*pkw_bereinigt(-2)+C(28)*pkw_bereinigt(-3)+C(29)*pkw_bereinigt(-5)+C(30)*pkw_bereinigt(-7)+C(31)*logmaschinenbau(-4)+C(32)*logmaschinenbau(-5)+C(33)*logmaschinenbau(-6)+C(34)*logmaschinenbau(-7)+C(35)*DS_2+C(36)*DS_3+C(37)*DS_4+C(38)*DS_8+C(39)*DS_9+C(40)*DS_10+C(41)*DS_11+C(42)*DS_12+C(43)*DLS_PKW
VAR_system.append logmaschinenbau = C(44)+C(45)*@trend(1991M01)+C(46)*stahl_bereinigt(-1)+C(47)*stahl_bereinigt(-5)+C(48)*stahl_bereinigt(-7)+C(49)*pkw_bereinigt(-1)+C(50)*pkw_bereinigt(-5)+C(51)*pkw_bereinigt(-6)+C(52)*pkw_bereinigt(-7)+C(53)*logmaschinenbau(-1)+C(54)*logmaschinenbau(-2)+C(55)*logmaschinenbau(-3)+C(56)*DS_2+C(57)*DS_3+C(58)*DS_4+C(59)*DS_5+C(60)*DS_6+C(61)*DS_7+C(62)*DS_8+C(63)*DS_9+C(64)*DS_10+C(65)*DS_11+C(66)*DS_12+C(67)*DLS_MAB_1+C(68)*DLS_MAB_2
else
if endsample>=DAT_STA and endsample<DAT_MAB_2 then
system VAR_system
VAR_system.append stahl_bereinigt = C(1)+C(2)*@trend(1991M01)+C(3)*stahl_bereinigt(-1)+C(4)*stahl_bereinigt(-2)+C(5)*stahl_bereinigt(-3)+C(6)*pkw_bereinigt(-3)+C(7)*pkw_bereinigt(-5)+C(8)*pkw_bereinigt(-6)+C(9)*pkw_bereinigt(-7)+C(10)*logmaschinenbau(-2)+C(11)*logmaschinenbau(-3)+C(12)*logmaschinenbau(-5)+C(13)*logmaschinenbau(-6)+C(14)*DS_2+C(15)*DS_7+C(16)*DS_8+C(17)*DS_9+C(18)*DS_11+C(19)*DS_12+C(20)*DLS_STA
VAR_system.append pkw_bereinigt = C(21)+C(22)*@trend(1991M01)+C(23)*stahl_bereinigt(-1)+C(24)*stahl_bereinigt(-2)+C(25)*stahl_bereinigt(-6)+C(26)*stahl_bereinigt(-7)+C(27)*pkw_bereinigt(-2)+C(28)*pkw_bereinigt(-3)+C(29)*pkw_bereinigt(-5)+C(30)*pkw_bereinigt(-7)+C(31)*logmaschinenbau(-4)+C(32)*logmaschinenbau(-5)+C(33)*logmaschinenbau(-6)+C(34)*logmaschinenbau(-7)+C(35)*DS_2+C(36)*DS_3+C(37)*DS_4+C(38)*DS_8+C(39)*DS_9+C(40)*DS_10+C(41)*DS_11+C(42)*DS_12+C(43)*DLS_PKW
VAR_system.append logmaschinenbau = C(44)+C(45)*@trend(1991M01)+C(46)*stahl_bereinigt(-1)+C(47)*stahl_bereinigt(-5)+C(48)*stahl_bereinigt(-7)+C(49)*pkw_bereinigt(-1)+C(50)*pkw_bereinigt(-5)+C(51)*pkw_bereinigt(-6)+C(52)*pkw_bereinigt(-7)+C(53)*logmaschinenbau(-1)+C(54)*logmaschinenbau(-2)+C(55)*logmaschinenbau(-3)+C(56)*DS_2+C(57)*DS_3+C(58)*DS_4+C(59)*DS_5+C(60)*DS_6+C(61)*DS_7+C(62)*DS_8+C(63)*DS_9+C(64)*DS_10+C(65)*DS_11+C(66)*DS_12+C(67)*DLS_MAB_1
else
if endsample<DAT_STA then
system VAR_system
VAR_system.append stahl_bereinigt = C(1)+C(2)*@trend(1991M01)+C(3)*stahl_bereinigt(-1)+C(4)*stahl_bereinigt(-2)+C(5)*stahl_bereinigt(-3)+C(6)*pkw_bereinigt(-3)+C(7)*pkw_bereinigt(-5)+C(8)*pkw_bereinigt(-6)+C(9)*pkw_bereinigt(-7)+C(10)*logmaschinenbau(-2)+C(11)*logmaschinenbau(-3)+C(12)*logmaschinenbau(-5)+C(13)*logmaschinenbau(-6)+C(14)*DS_2+C(15)*DS_7+C(16)*DS_8+C(17)*DS_9+C(18)*DS_11+C(19)*DS_12
VAR_system.append pkw_bereinigt = C(21)+C(22)*@trend(1991M01)+C(23)*stahl_bereinigt(-1)+C(24)*stahl_bereinigt(-2)+C(25)*stahl_bereinigt(-6)+C(26)*stahl_bereinigt(-7)+C(27)*pkw_bereinigt(-2)+C(28)*pkw_bereinigt(-3)+C(29)*pkw_bereinigt(-5)+C(30)*pkw_bereinigt(-7)+C(31)*logmaschinenbau(-4)+C(32)*logmaschinenbau(-5)+C(33)*logmaschinenbau(-6)+C(34)*logmaschinenbau(-7)+C(35)*DS_2+C(36)*DS_3+C(37)*DS_4+C(38)*DS_8+C(39)*DS_9+C(40)*DS_10+C(41)*DS_11+C(42)*DS_12+C(43)*DLS_PKW
VAR_system.append logmaschinenbau = C(44)+C(45)*@trend(1991M01)+C(46)*stahl_bereinigt(-1)+C(47)*stahl_bereinigt(-5)+C(48)*stahl_bereinigt(-7)+C(49)*pkw_bereinigt(-1)+C(50)*pkw_bereinigt(-5)+C(51)*pkw_bereinigt(-6)+C(52)*pkw_bereinigt(-7)+C(53)*logmaschinenbau(-1)+C(54)*logmaschinenbau(-2)+C(55)*logmaschinenbau(-3)+C(56)*DS_2+C(57)*DS_3+C(58)*DS_4+C(59)*DS_5+C(60)*DS_6+C(61)*DS_7+C(62)*DS_8+C(63)*DS_9+C(64)*DS_10+C(65)*DS_11+C(66)*DS_12+C(67)*DLS_MAB_1
endif
endif
endif
endif
' defines the system of model equations
VAR_system.sur(deriv=aa)
' estimates the VAR system with analytical derivatives
VAR_system.makemodel(VAR_model)
' transforms the estimated VAR system into a model
smpl 2012m2-!window+!j 2012m2-!foreper+!j
' sets the forecast period
VAR_model.solve
' calculates forecasts by solving the specified VAR model
smpl 1991m1 2012m2-!window+!j+!hori-1
series dummy_sta = stahl_bereinigt_0
series dummy_pkw = pkw_bereinigt_0
series dummy_mab = logmaschinenbau_0
for !i=1 to !obstotal step 1
dummymat_sta(!j,!i)=dummy_sta(!i)
dummymat_pkw(!j,!i)=dummy_pkw(!i)
dummymat_mab(!j,!i)=dummy_mab(!i)
next
foremat(!j,1) = dummymat_sta(!j,!obstotal-!foreper+!j)
foremat(!j,2) = dummymat_pkw(!j,!obstotal-!foreper+!j)
foremat(!j,3) = dummymat_mab(!j,!obstotal-!foreper+!j)
next
smpl 2012m2-!foreper+1 2012m2
series foresta
series forepkw
series foremab
group foreser foresta forepkw foremab
mtos(foremat,foreser)
thanks for your reply, which was the starting point for my idea. Perhaps, i haven't found the easiest way to store the forecasts, but my program is suitable for one-step-ahead as well as more-step-ahead-forecasts. I would thank you, if you can further check whether this program is absolutely correct and test it with your own data. I have calculated several forecasts from the eviews button mode and the resulting forecasts are the same as those of my program.
The code, but remember, that i haven't commented out my changes yet. I will do this later.
wfcreate Masterarbeit m 1991m1 2012m2
' creates workfile
!varnr = 3
' counts the number of variables in the model
matrix(254,!varnr) datamat
' generates matrix for data
datamat.read(a2,s=sheet2) "E:\Empirische Wirtschaftsforschung\Masterarbeit\Datensatz Masterarbeit.xls"
' read the data from the excel dataset into a data matrix
series stahl_bereinigt
series pkw_bereinigt
series logmaschinenbau
' generates series for the different variables
group variables stahl_bereinigt pkw_bereinigt logmaschinenbau
' generates a group including the individual series
mtos(datamat,variables)
' converts the data matrix to the group defined above
genr DS_2 = @seas(2)-1/12
genr DS_3 = @seas(3)-1/12
genr DS_4 = @seas(4)-1/12
genr DS_5 = @seas(5)-1/12
genr DS_6 = @seas(6)-1/12
genr DS_7 = @seas(7)-1/12
genr DS_8 = @seas(8)-1/12
genr DS_9 = @seas(9)-1/12
genr DS_10 = @seas(10)-1/12
genr DS_11 = @seas(11)-1/12
genr DS_12 = @seas(12)-1/12
' generates centered seasonal dummies
genr DLS_MAB_1 = @recode(@date>=@dateval("1992m12"),1,0)
genr DLS_PKW = @recode(@date>=@dateval("1993m1"),1,0)
genr DLS_STA = @recode(@date>=@dateval("2008m11"),1,0)
genr DLS_MAB_2 = @recode(@date>=@dateval("2009m1"),1,0)
genr DLS_MAB_3 = @recode(@date>=@dateval("2009m4"),1,0)
' generates dummies for the level shifts
' defines the systems of equations of the VAR model
!obstotal = @obssmpl
' counting the number of observations in the sample
!window = 50
' sets the forecast window
!hori = 1
' sets the forecast horizon
!foreper = !window-!hori+1
' determines the length of the forecast period and hence the series of forecasts
matrix(!foreper,!obstotal) dummymat_sta
matrix(!foreper,!obstotal) dummymat_pkw
matrix(!foreper,!obstotal) dummymat_mab
' generates matrix for the model forecasts
matrix(!foreper,!varnr) foremat
scalar DAT_MAB_3
scalar DAT_MAB_2
scalar DAT_STA
scalar endsample
scalar endrange
DAT_MAB_3 = @dtoo("2009m4")
DAT_MAB_2 = @dtoo("2009m1")
DAT_STA = @dtoo("2008m11")
endrange = @dtoo("2012m2")
for !j=1 to !foreper step 1
' starts a loop for the calculation of the model forecasts
smpl 1991m1 2012m2-!window+!j-1
' sets the estimation period for the model
endsample = endrange-!window+!j-1
group variables stahl_bereinigt pkw_bereinigt logmaschinenbau
if endsample>=DAT_MAB_3 then
system VAR_system
VAR_system.append stahl_bereinigt = C(1)+C(2)*@trend(1991M01)+C(3)*stahl_bereinigt(-1)+C(4)*stahl_bereinigt(-2)+C(5)*stahl_bereinigt(-3)+C(6)*pkw_bereinigt(-3)+C(7)*pkw_bereinigt(-5)+C(8)*pkw_bereinigt(-6)+C(9)*pkw_bereinigt(-7)+C(10)*logmaschinenbau(-2)+C(11)*logmaschinenbau(-3)+C(12)*logmaschinenbau(-5)+C(13)*logmaschinenbau(-6)+C(14)*DS_2+C(15)*DS_7+C(16)*DS_8+C(17)*DS_9+C(18)*DS_11+C(19)*DS_12+C(20)*DLS_STA
VAR_system.append pkw_bereinigt = C(21)+C(22)*@trend(1991M01)+C(23)*stahl_bereinigt(-1)+C(24)*stahl_bereinigt(-2)+C(25)*stahl_bereinigt(-6)+C(26)*stahl_bereinigt(-7)+C(27)*pkw_bereinigt(-2)+C(28)*pkw_bereinigt(-3)+C(29)*pkw_bereinigt(-5)+C(30)*pkw_bereinigt(-7)+C(31)*logmaschinenbau(-4)+C(32)*logmaschinenbau(-5)+C(33)*logmaschinenbau(-6)+C(34)*logmaschinenbau(-7)+C(35)*DS_2+C(36)*DS_3+C(37)*DS_4+C(38)*DS_8+C(39)*DS_9+C(40)*DS_10+C(41)*DS_11+C(42)*DS_12+C(43)*DLS_PKW
VAR_system.append logmaschinenbau = C(44)+C(45)*@trend(1991M01)+C(46)*stahl_bereinigt(-1)+C(47)*stahl_bereinigt(-5)+C(48)*stahl_bereinigt(-7)+C(49)*pkw_bereinigt(-1)+C(50)*pkw_bereinigt(-5)+C(51)*pkw_bereinigt(-6)+C(52)*pkw_bereinigt(-7)+C(53)*logmaschinenbau(-1)+C(54)*logmaschinenbau(-2)+C(55)*logmaschinenbau(-3)+C(56)*DS_2+C(57)*DS_3+C(58)*DS_4+C(59)*DS_5+C(60)*DS_6+C(61)*DS_7+C(62)*DS_8+C(63)*DS_9+C(64)*DS_10+C(65)*DS_11+C(66)*DS_12+C(67)*DLS_MAB_1+C(68)*DLS_MAB_2+C(69)*DLS_MAB_3
else
if endsample>=DAT_MAB_2 and endsample<DAT_MAB_3 then
system VAR_system
VAR_system.append stahl_bereinigt = C(1)+C(2)*@trend(1991M01)+C(3)*stahl_bereinigt(-1)+C(4)*stahl_bereinigt(-2)+C(5)*stahl_bereinigt(-3)+C(6)*pkw_bereinigt(-3)+C(7)*pkw_bereinigt(-5)+C(8)*pkw_bereinigt(-6)+C(9)*pkw_bereinigt(-7)+C(10)*logmaschinenbau(-2)+C(11)*logmaschinenbau(-3)+C(12)*logmaschinenbau(-5)+C(13)*logmaschinenbau(-6)+C(14)*DS_2+C(15)*DS_7+C(16)*DS_8+C(17)*DS_9+C(18)*DS_11+C(19)*DS_12+C(20)*DLS_STA
VAR_system.append pkw_bereinigt = C(21)+C(22)*@trend(1991M01)+C(23)*stahl_bereinigt(-1)+C(24)*stahl_bereinigt(-2)+C(25)*stahl_bereinigt(-6)+C(26)*stahl_bereinigt(-7)+C(27)*pkw_bereinigt(-2)+C(28)*pkw_bereinigt(-3)+C(29)*pkw_bereinigt(-5)+C(30)*pkw_bereinigt(-7)+C(31)*logmaschinenbau(-4)+C(32)*logmaschinenbau(-5)+C(33)*logmaschinenbau(-6)+C(34)*logmaschinenbau(-7)+C(35)*DS_2+C(36)*DS_3+C(37)*DS_4+C(38)*DS_8+C(39)*DS_9+C(40)*DS_10+C(41)*DS_11+C(42)*DS_12+C(43)*DLS_PKW
VAR_system.append logmaschinenbau = C(44)+C(45)*@trend(1991M01)+C(46)*stahl_bereinigt(-1)+C(47)*stahl_bereinigt(-5)+C(48)*stahl_bereinigt(-7)+C(49)*pkw_bereinigt(-1)+C(50)*pkw_bereinigt(-5)+C(51)*pkw_bereinigt(-6)+C(52)*pkw_bereinigt(-7)+C(53)*logmaschinenbau(-1)+C(54)*logmaschinenbau(-2)+C(55)*logmaschinenbau(-3)+C(56)*DS_2+C(57)*DS_3+C(58)*DS_4+C(59)*DS_5+C(60)*DS_6+C(61)*DS_7+C(62)*DS_8+C(63)*DS_9+C(64)*DS_10+C(65)*DS_11+C(66)*DS_12+C(67)*DLS_MAB_1+C(68)*DLS_MAB_2
else
if endsample>=DAT_STA and endsample<DAT_MAB_2 then
system VAR_system
VAR_system.append stahl_bereinigt = C(1)+C(2)*@trend(1991M01)+C(3)*stahl_bereinigt(-1)+C(4)*stahl_bereinigt(-2)+C(5)*stahl_bereinigt(-3)+C(6)*pkw_bereinigt(-3)+C(7)*pkw_bereinigt(-5)+C(8)*pkw_bereinigt(-6)+C(9)*pkw_bereinigt(-7)+C(10)*logmaschinenbau(-2)+C(11)*logmaschinenbau(-3)+C(12)*logmaschinenbau(-5)+C(13)*logmaschinenbau(-6)+C(14)*DS_2+C(15)*DS_7+C(16)*DS_8+C(17)*DS_9+C(18)*DS_11+C(19)*DS_12+C(20)*DLS_STA
VAR_system.append pkw_bereinigt = C(21)+C(22)*@trend(1991M01)+C(23)*stahl_bereinigt(-1)+C(24)*stahl_bereinigt(-2)+C(25)*stahl_bereinigt(-6)+C(26)*stahl_bereinigt(-7)+C(27)*pkw_bereinigt(-2)+C(28)*pkw_bereinigt(-3)+C(29)*pkw_bereinigt(-5)+C(30)*pkw_bereinigt(-7)+C(31)*logmaschinenbau(-4)+C(32)*logmaschinenbau(-5)+C(33)*logmaschinenbau(-6)+C(34)*logmaschinenbau(-7)+C(35)*DS_2+C(36)*DS_3+C(37)*DS_4+C(38)*DS_8+C(39)*DS_9+C(40)*DS_10+C(41)*DS_11+C(42)*DS_12+C(43)*DLS_PKW
VAR_system.append logmaschinenbau = C(44)+C(45)*@trend(1991M01)+C(46)*stahl_bereinigt(-1)+C(47)*stahl_bereinigt(-5)+C(48)*stahl_bereinigt(-7)+C(49)*pkw_bereinigt(-1)+C(50)*pkw_bereinigt(-5)+C(51)*pkw_bereinigt(-6)+C(52)*pkw_bereinigt(-7)+C(53)*logmaschinenbau(-1)+C(54)*logmaschinenbau(-2)+C(55)*logmaschinenbau(-3)+C(56)*DS_2+C(57)*DS_3+C(58)*DS_4+C(59)*DS_5+C(60)*DS_6+C(61)*DS_7+C(62)*DS_8+C(63)*DS_9+C(64)*DS_10+C(65)*DS_11+C(66)*DS_12+C(67)*DLS_MAB_1
else
if endsample<DAT_STA then
system VAR_system
VAR_system.append stahl_bereinigt = C(1)+C(2)*@trend(1991M01)+C(3)*stahl_bereinigt(-1)+C(4)*stahl_bereinigt(-2)+C(5)*stahl_bereinigt(-3)+C(6)*pkw_bereinigt(-3)+C(7)*pkw_bereinigt(-5)+C(8)*pkw_bereinigt(-6)+C(9)*pkw_bereinigt(-7)+C(10)*logmaschinenbau(-2)+C(11)*logmaschinenbau(-3)+C(12)*logmaschinenbau(-5)+C(13)*logmaschinenbau(-6)+C(14)*DS_2+C(15)*DS_7+C(16)*DS_8+C(17)*DS_9+C(18)*DS_11+C(19)*DS_12
VAR_system.append pkw_bereinigt = C(21)+C(22)*@trend(1991M01)+C(23)*stahl_bereinigt(-1)+C(24)*stahl_bereinigt(-2)+C(25)*stahl_bereinigt(-6)+C(26)*stahl_bereinigt(-7)+C(27)*pkw_bereinigt(-2)+C(28)*pkw_bereinigt(-3)+C(29)*pkw_bereinigt(-5)+C(30)*pkw_bereinigt(-7)+C(31)*logmaschinenbau(-4)+C(32)*logmaschinenbau(-5)+C(33)*logmaschinenbau(-6)+C(34)*logmaschinenbau(-7)+C(35)*DS_2+C(36)*DS_3+C(37)*DS_4+C(38)*DS_8+C(39)*DS_9+C(40)*DS_10+C(41)*DS_11+C(42)*DS_12+C(43)*DLS_PKW
VAR_system.append logmaschinenbau = C(44)+C(45)*@trend(1991M01)+C(46)*stahl_bereinigt(-1)+C(47)*stahl_bereinigt(-5)+C(48)*stahl_bereinigt(-7)+C(49)*pkw_bereinigt(-1)+C(50)*pkw_bereinigt(-5)+C(51)*pkw_bereinigt(-6)+C(52)*pkw_bereinigt(-7)+C(53)*logmaschinenbau(-1)+C(54)*logmaschinenbau(-2)+C(55)*logmaschinenbau(-3)+C(56)*DS_2+C(57)*DS_3+C(58)*DS_4+C(59)*DS_5+C(60)*DS_6+C(61)*DS_7+C(62)*DS_8+C(63)*DS_9+C(64)*DS_10+C(65)*DS_11+C(66)*DS_12+C(67)*DLS_MAB_1
endif
endif
endif
endif
' defines the system of model equations
VAR_system.sur(deriv=aa)
' estimates the VAR system with analytical derivatives
VAR_system.makemodel(VAR_model)
' transforms the estimated VAR system into a model
smpl 2012m2-!window+!j 2012m2-!foreper+!j
' sets the forecast period
VAR_model.solve
' calculates forecasts by solving the specified VAR model
smpl 1991m1 2012m2-!window+!j+!hori-1
series dummy_sta = stahl_bereinigt_0
series dummy_pkw = pkw_bereinigt_0
series dummy_mab = logmaschinenbau_0
for !i=1 to !obstotal step 1
dummymat_sta(!j,!i)=dummy_sta(!i)
dummymat_pkw(!j,!i)=dummy_pkw(!i)
dummymat_mab(!j,!i)=dummy_mab(!i)
next
foremat(!j,1) = dummymat_sta(!j,!obstotal-!foreper+!j)
foremat(!j,2) = dummymat_pkw(!j,!obstotal-!foreper+!j)
foremat(!j,3) = dummymat_mab(!j,!obstotal-!foreper+!j)
next
smpl 2012m2-!foreper+1 2012m2
series foresta
series forepkw
series foremab
group foreser foresta forepkw foremab
mtos(foremat,foreser)
Who is online
Users browsing this forum: No registered users and 1 guest
