storing old forecast and comparing with realization

For questions and discussion related to reading in and working with data.

storing old forecast and comparing with realization

Unread postby Gilbril » Thu Apr 14, 2022 11:07 am

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!
Gilbril
 
Posts: 78
Joined: Thu Aug 19, 2010 2:00 pm

Re: storing old forecast and comparing with realization

Unread postby TomDoan » Sun Apr 17, 2022 3:41 pm

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?
TomDoan
 
Posts: 7240
Joined: Wed Nov 01, 2006 5:36 pm

Re: storing old forecast and comparing with realization

Unread postby Gilbril » Tue May 03, 2022 11:00 am

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.
Gilbril
 
Posts: 78
Joined: Thu Aug 19, 2010 2:00 pm

Re: storing old forecast and comparing with realization

Unread postby TomDoan » Tue May 03, 2022 12:51 pm

So you have a data source which is updated, but not uniformly across series. How are you saving the previous forecasts?
TomDoan
 
Posts: 7240
Joined: Wed Nov 01, 2006 5:36 pm

Re: storing old forecast and comparing with realization

Unread postby Gilbril » Thu May 05, 2022 10:40 am

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.
Gilbril
 
Posts: 78
Joined: Thu Aug 19, 2010 2:00 pm

Re: storing old forecast and comparing with realization

Unread postby TomDoan » Thu May 05, 2022 1:02 pm

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.
TomDoan
 
Posts: 7240
Joined: Wed Nov 01, 2006 5:36 pm

Re: storing old forecast and comparing with realization

Unread postby Gilbril » Thu Jun 09, 2022 10:51 am

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
Gilbril
 
Posts: 78
Joined: Thu Aug 19, 2010 2:00 pm

Re: storing old forecast and comparing with realization

Unread postby TomDoan » Thu Jun 09, 2022 1:14 pm

You want

open copy P:\New.xlsx
write(format=xlsx,unit=copy) New
TomDoan
 
Posts: 7240
Joined: Wed Nov 01, 2006 5:36 pm


Return to Data: Reading, Writing, Transforming

Who is online

Users browsing this forum: No registered users and 2 guests

cron