Page 1 of 1

how to store a single value from a series into a matrix?

Posted: Mon Jun 05, 2017 6:49 pm
by Yohan
Hello altogether,

here is a excerpt of my code (from a state space model), which is inside a loop:

smpl 9/22/2014+!forecasthorizon+!h-1 9/22/2014+!forecasthorizon+!h-1
' sets the forecast horizon

{%modelname}{!forecasthorizon}.forecast(m=n,n=!forecasthorizon) @state * @signal {%modelname}{!forecasthorizon}_lcdsprognose_d @signalse {%modelname}{!forecasthorizon}_lcdsprognosese_d
' generates the forecasts

scalar dummyeins = @elem({%modelname}{!forecasthorizon}_lcdsprognose_d,"9/22/2014+!forecasthorizon+!h-1")
scalar dummyzwei = @elem({%modelname}{!forecasthorizon}_lcdsprognosese_d,"9/22/2014+!forecasthorizon+!h-1")

matrix prognose(!h,1) = dummyeins
matrix prognosese(!h,1) = dummyzwei

series {%modelname}{!forecasthorizon}_lcdsprognose
series {%modelname}{!forecasthorizon}_lcdsprognosese

mtos(prognose,{%modelname}{!forecasthorizon}_lcdsprognose)
mtos(prognosese,{%modelname}{!forecasthorizon}_lcdsprognosese


This code should generate a forecast window from a recursive estimation scheme. The forecasting values for the signals and signal se's should be stored in the matrices prognose and prognosese, where !h goes forward one step in the forecast window.

My problem:
i get (not surprisingly!) the message, that "9/22/2014+!forecasthorizon+!h-1" in the program rows "scalar dummyeins" and "scalar dummyzwei" is a illegal date. How can i extract the desired element of the signal series and subsequently transform it into a scalar?


Thank you very much!
Kind regards, Yohan

Re: how to store a single value from a series into a matrix?

Posted: Mon Jun 05, 2017 8:23 pm
by EViews Gareth

Code: Select all

%date = @datestr(@dateval(9/22/2014)+!forecasthorizon+!h-1, "YYYY/MM/DD") scalar dummyeins = @elem({%modelname}{!forecasthorizon}_lcdsprognose_d,%date)