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.
David Willingham (2021). Long Term Energy Forecasting with Econometrics in MATLAB (https://www.mathworks.com/matlabcentral/fileexchange/49279-long-term-energy-forecasting-with-econometrics-in-matlab), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.
Nicely Written Code,
This is my forecasting code which allows you to predict your time series data with LSTM, CNN, and MLP Networks.
please visit my Mathworks account and download it from the link below:
https://www.mathworks.com/matlabcentral/fileexchange/69506-time-series-prediction
vgxset has been removed, not sure how to replace it with varm
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.
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?
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
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.
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
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.
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?
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
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