Page 1 of 1

storing old forecast and comparing with realization

Posted: Thu Apr 14, 2022 11:07 am
by Gilbril
Dear Tom, I created a quite large forecasting program with about 200 series forecasted each time. I want to insert a routine which compares the new realization of a series with the old forecast.
Ideally the routine would look like:

if date last observation now > date last observation stored{

comp foreast_error = obervation new- last forecast
}
else { }
end if

But how do I store and recall the last valid date and the forecast made befor the new data arrived?
Ideally it would be a matrix with the series name in first column , date of last observation in second column and forecast in third column. But these are three different data types which can't be stored in one matrix.
Should I export each time the routine is used a vintage of the series and than later recall the vintage and compare it with the actual series?

This would slow down the program. I prefer to skip all series where the data is not updated. I have no clue and I welcome any advise and examples how to implement it!

Re: storing old forecast and comparing with realization

Posted: Sun Apr 17, 2022 3:41 pm
by TomDoan
Sorry. Old forecast from (say) last month's (last week's) run? Or is this a single run where the series aren't necessarily defined through the same time period?

Re: storing old forecast and comparing with realization

Posted: Tue May 03, 2022 11:00 am
by Gilbril
It is the first case: old forecast from last weeks run. When a forecast for a specific date (april 2022) can be replaced by the true observation for this date I would like to calculate and store the forecast error.

By now I store these values into series, where I put the forecast for the first series into the series "forecast" in the first entry. The last forecast for the second series I store as well in series forecast but the second entry.

But I have the following problem, wehn I want to calculate the forecast error I receive the error message that data type real(series) can't be combined with data type real.

Re: storing old forecast and comparing with realization

Posted: Tue May 03, 2022 12:51 pm
by TomDoan
So you have a data source which is updated, but not uniformly across series. How are you saving the previous forecasts?

Re: storing old forecast and comparing with realization

Posted: Thu May 05, 2022 10:40 am
by Gilbril
For the first forecast series I would like to store them ideally in column one row 1, for the second forecast series in column 1 row1 of a r,atrix in real format As I dont know how to export and import matrices from excel. I store the values for now in series. But there I have the problem, that values from series are in format series(real) . I can't combine them with variables in only real format.

Re: storing old forecast and comparing with realization

Posted: Thu May 05, 2022 1:02 pm
by TomDoan
Gilbril wrote:For the first forecast series I would like to store them ideally in column one row 1, for the second forecast series in column 1 row1 of a r,atrix in real format As I dont know how to export and import matrices from excel. I store the values for now in series. But there I have the problem, that values from series are in format series(real) . I can't combine them with variables in only real format.
READ and WRITE have FORMAT=XLS and FORMAT=XLSX options.

Re: storing old forecast and comparing with realization

Posted: Thu Jun 09, 2022 10:51 am
by Gilbril
Thanks Tom write was the command I searched for. However I fail to save the matrix New automatically in a special folder

The command

write(format=xlsx, unit=copy) P:\New.xlsx

does not work, and when applying the command

[write(format=xlsx, unit=copy) New

I am always asked about the name of the file and the folder to store it

Re: storing old forecast and comparing with realization

Posted: Thu Jun 09, 2022 1:14 pm
by TomDoan
You want

open copy P:\New.xlsx
write(format=xlsx,unit=copy) New