converting hourly data to monthly data

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

minson
Posts: 10
Joined: Fri Feb 06, 2009 7:27 am

converting hourly data to monthly data

Postby minson » Wed Apr 08, 2009 10:16 am

Hi,

I've been doing day ahead and week ahead forecasting. Now I have to do more long term forecasting. Like 8 years ahead!!!
I have all the data i need, temperature etc, in a workfile. but it is hourly data. To do the long term forecast, i want to convert this all to montly data. Whats the best way of finding monthly averages of this temperature series say? Should i create a new workfile, or create a New Page on my existing workfile and apply a montly structure to it?

I have a series called DateTime. It contains the time and date (yyyy-mm-dd hh-mm). How do i write a program that would use the DateTime and the hourly Temperature series to create a new montly temperature series?

Your help is much appreciated
Minson

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13600
Joined: Tue Sep 16, 2008 5:38 pm

Re: converting hourly data to monthly data

Postby EViews Gareth » Wed Apr 08, 2009 10:24 am

The problem you have, as I'm sure you're aware, is that EViews doesn't natively support hourly data.

One way I can think of doing this would be to create a new series containing just the month/year (not sure how your current date series is formatted, but I'm sure you can think of a way of extracting the month/year from it into a new series). Then once you have that month/year series, you can use the @meansby function to create the monthly averages. Something like:

series monthtemp = @meansby(temp, monthyear)

where temp is your temperature series, and monthyear is the series containing the month/year info.

minson
Posts: 10
Joined: Fri Feb 06, 2009 7:27 am

Re: converting hourly data to monthly data

Postby minson » Wed Apr 08, 2009 11:29 am

Hi Gareth,

I have a series, DateTIme which has the format yyyy-mm-dd hh:mm. I am able to extract the month and year using the @datepart(DateTime, "MM") and @datepart(DateTime, "YYYY") functions. But Eviews just recognises these as integers? How can i create a "MonthYear" series using these numbers which can then be used in the @meansby function?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13600
Joined: Tue Sep 16, 2008 5:38 pm

Re: converting hourly data to monthly data

Postby EViews Gareth » Wed Apr 08, 2009 11:42 am

If you have months in a series (just running 1-12) and years in another series (running, say, 1990-2012), then you could just do:

series monthtemp = @meansby(temp,month,year)


i.e. you don't really need to combine them into one series, you can just pass both into the meansby function.

minson
Posts: 10
Joined: Fri Feb 06, 2009 7:27 am

Re: converting hourly data to monthly data

Postby minson » Thu Apr 09, 2009 11:18 am

thanks, that function works really well.
Regards
Minson


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests