File Exchange

image thumbnail

Long Term Energy Forecasting with Econometrics in MATLAB

version 1.5.0.1 (7.23 MB) by

Dynamic energy demand forecasting using Econometrics (ARIMA/VAR/GARCH)

18 Downloads

Updated

View License

View this example as a Recorded Webinar at:
http://mathworks.com/videos/long-term-energy-forecasting-with-econometrics-in-matlab-99301.html
Since 2008 energy demand in Australia has started to decline. The result, traditional regression based models that were being used to forecast long term energy load were now highly inaccurate in their predictions. Energy demand has since continued to fall, however will it increase again? If so, how can this be predicted? A dynamic model to forecast long term energy demand is needed.
In this example, we’ll demonstrate how using econometrics techniques, you can create a dynamic, self-tuning model for predicting long term energy load. We will look at building ARIMA/GARCH and Vector Autoregressive (VARX) forecasting models based of historical energy and economic data sets.

Comments and Ratings (16)

polar

polar (view profile)

I'm following the script of the code "example1_foreceast_arima" and it seems reasonable and clear.
However I don't understand 2 things:
1)Why using a 6 sum of sines? I mean, my question is due to the fact I'm a newbye in sinusoidal models for temperature: I know that for understanding the "b1","b2" etc. coefficients I should use the formula: 2pi/DatesPeriod =b. But I see that dates have been normalized so I confess I'm not able to understand which are these 6 periods(daily,monthly,weekly etc.).

2)ARIMA model: I agree in saying it's hard to follow the thumb rule for determining MA and AR by looking at ACF and PACF graphs output. My dubt is about the choice for the Garch(1,1). In the script it has been determined by looking at the ACF/PACF of Diff(F)^2 but I thought we should use the error^2 for determining the GARCH.

polar

polar (view profile)

Hi David (and really thanks for your patience!).

Of course, I can run ALL others scripts, my problems are just related to "data_prep_example.m".

When you say to run as admin you mean opening Matlab as admin or run the script in a different way? Because I've already read something about this problem but I honestly don't know how to fix it

Hi Polar,

I've downloaded the code an amm running the code without error, so I'm not sure what is causing your issues.

Beside the data_prep_example.m script, are you able to run one of the other examples? Such as:

example0_foreceast_sde.m

What version of MATLAB are you using?

polar

polar (view profile)

yes David you're right about the fact that import_load_price is a script and not a ".mat" file. However In the code I downloaded (and as far as I remember I didn't changed) is writtem "load import_load_price". Anyway I deleted the word "load" and it moved on...until these next error messages

Warning: Usage of DATEVEC with empty date strings is not supported.
Results may change in future versions.
> In datevec (line 89)
In dataprep1_convert_monthly (line 9)
In data_prep (line 16)
In data_prep_example (line 19)
Index exceeds matrix dimensions.

Error in dataprep1_convert_monthly (line 67)
dvec = [datenum(dvecstr(1,:),'mm,yyyy'):1:datenum(dvecstr(end,:),'mm,yyyy')]';

Error in data_prep (line 16)
T = dataprep1_convert_monthly(ds,dE); % Energy Demand

Error in data_prep_example (line 19)
TEcon = data_prep(ds,dE);

Hi Polar,

I've looked at the code and there is not import_load_price mat file but a import_load_price.m (script file). I've also looked at the dataprep1 file and there the command isn't:

load import_load_price

but just

import_load_price

polar

polar (view profile)

David, about your advice about the folder "dataprep": I indeed copied and pasted to my path some of its files such as :
1) function "data_prep"
2) function "dataprep1_convert_monthly"
3) mat file "import_load_price"
Then, I re-run the "data_prep_example" and these are the error messages:

Error using load
Unable to read file 'import_load_price'. No such file or directory.

Error in dataprep1_convert_monthly (line 6)
load import_load_price

Error in data_prep (line 16)
T = dataprep1_convert_monthly(ds,dE); % Energy Demand

Error in data_prep_example (line 19)
TEcon = data_prep(ds,dE);

So....I really don't know what to do.

Ahmed Sheikh

Thank you.I'll check again and see how it goes and get back to you later.I appreciate your prompt response.

Hi Ahmed, I'm using the table datatype which came out in 13b. So you'll need to use a newer version of MATLAB to run

Ahmed Sheikh

Warning: Variable 'T' originally saved as a table cannot be instantiated as an object and will be read in as a uint32.
> In example0_foreceast_sde at 12
Attempt to reference field of non-structure array.

Error in example0_foreceast_sde (line 14)
dates = [num2str(T.Months),repmat('/',length(T.Months),1),num2str(T.Years)];

how to resolve this issue? i am trying to get month and year but seems like there is something wrong with Matlab version.I am using Matlab 2013a.

Hi, Did you add the dataorep folder to the MATLAB path? The file is in there.

polar

polar (view profile)

Hi David this is list of error messages (sigh):

Error using load
Unable to read file 'import_load_price'. No such file or directory.

Error in dataprep1_convert_monthly (line 6)
load import_load_price

Error in data_prep (line 16)
T = dataprep1_convert_monthly(ds,dE); % Energy Demand

Error in data_prep_example (line 19)
TEcon = data_prep(ds,dE);

What error messages do you receive?

polar

polar (view profile)

I tried on a friend's version (matlab 2015b) and now I made the code working.
Or better I still have a problem when trying to run "data_prep_example". In fact it recalls other two routines:1)"data_prep" and 2) "dataprep1_convert_monthly". It seems that the very original problem is related to the permission of the "fopen" command in the routine "import_load_price". I don't know what to do

What version of MATLAB are you using? To check type : >> ver

polar

polar (view profile)

Can anyone tell me how to run codes?
I mean, not only the order of files but what to do to avoid the error messages.
So far I tried with this ".m" files:
1)data_prep_example
2)example0_foreceast_sde

Thanks

Updates

1.5.0.1

Updated license

1.5

updating required products

1.5

changed required products

1.4

Updated the Webinar Link in the description, and fix typos

1.2

Added MathWorks copyright to every MATLAB file.

MATLAB Release
MATLAB 8.4 (R2014b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video