Forecast model that do not overwrite known values
Posted: Sat Dec 01, 2012 3:40 am
Hello,
I have 3 series with different ending dates (e.g. series1 in 2012:9, series2 in 2012:10, series3 in 2012:9). I am trying to run a forecasting model starting from the last period with values for all variables ( in the example 2012:9+1), but as series2 has already a value for 2012:10 I would like that the model keeps this value when solving. Is this possible in EViews?
For the moment I have programmed it so that I create a VAR, estimate the equations for the estimation sample and copy the estimated equations as the model equations including a @recode function. As I must do this for several VARs and several countries and/or the estimation sample might change, I would like to know if there is the an option for solving the model in order to not overwrite known values. Please see example program below.
'end_softdata = 2012:9;
' --- create empty group VARSOFT
GROUP VARSOFT
'order a list of series
' --- load ordered variables in the group
for %i SERIES1 SERIES2 SERIES3
VARSOFT.add {%i}
next
' --- create sample
for !i=1 to VARSOFT.@count 'counter for the variables in the group
%inamesoft = VARSOFT.@seriesname(!i)
%inisoft=@otod(@ifirst({%inamesoft}))
%finsoft=@otod(@ilast({%inamesoft}))
'smpl %finsoft+1 @last
next
'historical series
SERIES SERIES1_hist=SERIES1
SERIES SERIES2_hist=SERIES2
SERIES SERIES3_hist=SERIES3
'VAR
VAR VAR01
VAR01.LS SERIES1 SERIES2 SERIES3
MODEL VAR1 'SOFT MODEL
'VAR1.APPEND :VAR01
VAR1.APPEND series1 = @RECODE(series1_hist =NA,1.050615972 * series1(-1) + 0.1430958864 * series1(-2) - 0.2137090178 * series1(-3) - 0.08287320537 * series1(-4) - 0.004062949359 * series1(-5) + 0.1020872733 * series1(-6) + 0.11878156 * series2(-1) + 0.08387318105 * series2(-2) + 0.01445065705 * series2(-3) + 0.02491362013 * series2(-4) + 0.0035876477 * series2(-5) + 0.0446521193 * series2(-6) - 0.06307174018 * series3(-1) - 0.001300322111 * series3(-2) + 0.06391715485 * series3(-3) + 0.02151004069 * series3(-4) - 0.01229482953 * series3(-5) - 0.04151507081 * series3(-6) + 0.1883246979 , series1_hist)
VAR1.APPEND series2 = @RECODE(series2_hist=NA, 0.6839319378 * series1(-1) - 0.7791013633 * series1(-2) + 0.5605207964 * series1(-3) - 0.2696065569 * series1(-4) + 0.02464365171 * series1(-5) - 0.221710847 * series1(-6) - 0.108094511 * series2(-1) + 0.1257823213 * series2(-2) + 0.1543402288 * series2(-3) + 0.05477073286 * series2(-4) - 0.09883368602 * series2(-5) + 0.08157946449 * series2(-6) - 0.3678742195 * series3(-1) + 0.2271316556 * series3(-2) + 0.04471368308 * series3(-3) + 0.02946643161 * series3(-4) + 0.03527449231 * series3(-5) - 0.07147229889 * series3(-6) - 0.3537779653, series2_hist)
VAR1.APPEND series3 = @RECODE(series3_hist=NA, - 0.01184232597 * series1(-1) + 0.3088297763 * series1(-2) + 0.3612829292 * series1(-3) - 0.7240363101 * series1(-4) + 0.06717878137 * series1(-5) - 0.0008071256258 * series1(-6) + 0.4014346608 * series2(-1) + 0.4975351059 * series2(-2) + 0.4313042708 * series2(-3) + 0.07497739983 * series2(-4) - 0.05494459956 * series2(-5) + 0.1849620585 * series2(-6) + 0.2208402377 * series3(-1) + 0.3046651301 * series3(-2) + 0.2233036593 * series3(-3) + 0.1097012174 * series3(-4) + 0.02038600752 * series3(-5) + 0.05889779715 * series3(-6) - 0.5134558538, series3_hist)
SMPL %finsoft+1 %finsoft+12
VAR1.SOLVE(s=d)
Thanks,
Gloria
I have 3 series with different ending dates (e.g. series1 in 2012:9, series2 in 2012:10, series3 in 2012:9). I am trying to run a forecasting model starting from the last period with values for all variables ( in the example 2012:9+1), but as series2 has already a value for 2012:10 I would like that the model keeps this value when solving. Is this possible in EViews?
For the moment I have programmed it so that I create a VAR, estimate the equations for the estimation sample and copy the estimated equations as the model equations including a @recode function. As I must do this for several VARs and several countries and/or the estimation sample might change, I would like to know if there is the an option for solving the model in order to not overwrite known values. Please see example program below.
'end_softdata = 2012:9;
' --- create empty group VARSOFT
GROUP VARSOFT
'order a list of series
' --- load ordered variables in the group
for %i SERIES1 SERIES2 SERIES3
VARSOFT.add {%i}
next
' --- create sample
for !i=1 to VARSOFT.@count 'counter for the variables in the group
%inamesoft = VARSOFT.@seriesname(!i)
%inisoft=@otod(@ifirst({%inamesoft}))
%finsoft=@otod(@ilast({%inamesoft}))
'smpl %finsoft+1 @last
next
'historical series
SERIES SERIES1_hist=SERIES1
SERIES SERIES2_hist=SERIES2
SERIES SERIES3_hist=SERIES3
'VAR
VAR VAR01
VAR01.LS SERIES1 SERIES2 SERIES3
MODEL VAR1 'SOFT MODEL
'VAR1.APPEND :VAR01
VAR1.APPEND series1 = @RECODE(series1_hist =NA,1.050615972 * series1(-1) + 0.1430958864 * series1(-2) - 0.2137090178 * series1(-3) - 0.08287320537 * series1(-4) - 0.004062949359 * series1(-5) + 0.1020872733 * series1(-6) + 0.11878156 * series2(-1) + 0.08387318105 * series2(-2) + 0.01445065705 * series2(-3) + 0.02491362013 * series2(-4) + 0.0035876477 * series2(-5) + 0.0446521193 * series2(-6) - 0.06307174018 * series3(-1) - 0.001300322111 * series3(-2) + 0.06391715485 * series3(-3) + 0.02151004069 * series3(-4) - 0.01229482953 * series3(-5) - 0.04151507081 * series3(-6) + 0.1883246979 , series1_hist)
VAR1.APPEND series2 = @RECODE(series2_hist=NA, 0.6839319378 * series1(-1) - 0.7791013633 * series1(-2) + 0.5605207964 * series1(-3) - 0.2696065569 * series1(-4) + 0.02464365171 * series1(-5) - 0.221710847 * series1(-6) - 0.108094511 * series2(-1) + 0.1257823213 * series2(-2) + 0.1543402288 * series2(-3) + 0.05477073286 * series2(-4) - 0.09883368602 * series2(-5) + 0.08157946449 * series2(-6) - 0.3678742195 * series3(-1) + 0.2271316556 * series3(-2) + 0.04471368308 * series3(-3) + 0.02946643161 * series3(-4) + 0.03527449231 * series3(-5) - 0.07147229889 * series3(-6) - 0.3537779653, series2_hist)
VAR1.APPEND series3 = @RECODE(series3_hist=NA, - 0.01184232597 * series1(-1) + 0.3088297763 * series1(-2) + 0.3612829292 * series1(-3) - 0.7240363101 * series1(-4) + 0.06717878137 * series1(-5) - 0.0008071256258 * series1(-6) + 0.4014346608 * series2(-1) + 0.4975351059 * series2(-2) + 0.4313042708 * series2(-3) + 0.07497739983 * series2(-4) - 0.05494459956 * series2(-5) + 0.1849620585 * series2(-6) + 0.2208402377 * series3(-1) + 0.3046651301 * series3(-2) + 0.2233036593 * series3(-3) + 0.1097012174 * series3(-4) + 0.02038600752 * series3(-5) + 0.05889779715 * series3(-6) - 0.5134558538, series3_hist)
SMPL %finsoft+1 %finsoft+12
VAR1.SOLVE(s=d)
Thanks,
Gloria