# Monthly Electricity Consumption Forecasting Method Based on X12 and STL Decomposition Model in an Integrated Energy System

Authors: Tianhe Sun; Tieyan Zhang; Yun Teng; Zhe Chen; Jiakun Fang
Journal: Mathematical Problems in Engineering
 (2019)

---

## Abstract

With the rapid development and wide application of distributed generation technology and new energy trading methods, the integrated energy system has developed rapidly in Europe in recent years and has become the focus of new strategic competition and cooperation among countries. As a key technology and decision-making approach for operation, optimization, and control of integrated energy systems, power consumption prediction faces new challenges. The user-side power demand and load characteristics change due to the influence of distributed energy. At the same time, in the open retail market of electricity sales, the forecast of electricity consumption faces the power demand of small-scale users, which is more easily disturbed by random factors than by a traditional load forecast. Therefore, this study proposes a model based on X12 and Seasonal and Trend decomposition using Loess (STL) decomposition of monthly electricity consumption forecasting methods. The first use of the STL model according to the properties of electricity each month is its power consumption time series decomposition individuation. It influences the factorization of monthly electricity consumption into season, trend, and random components. Then, the change in the characteristics of the three components over time is considered. Finally, the appropriate model is selected to predict the components in the reconfiguration of the monthly electricity consumption forecast. A forecasting program is developed based on R language and MATLAB, and a case study is conducted on the power consumption data of a university campus containing distributed energy. Results show that the proposed method is reasonable and effective.


---

## Body

## 1. Introduction

### 1.1. Literature Review

An integrated energy system generally refers to the optimization of the allocation of various energy resources in accordance with the energy structure and energy endowment of a region. It often combines advanced technologies, such as waste heat utilization, heat pump, and energy storage, thereby fully using high- and low-grade energy to provide technical solutions for cold, hot, and electric products for users in the region. As an important approach to accelerate the transformation to sustainable energy worldwide, the integrated energy system has attracted much attention in recent years. Accurate electricity consumption forecasting not only plays a decisive role in comprehensive planning, operation, management, and cascade utilization of energy system, but also acts as a key technology to promote the energy market. To date, load forecasting technology is mature [1–4], but it cannot be fully applied to power consumption forecasting in integrated energy systems because of the following reasons: (1) the demand and load characteristics of energy users change accordingly with the integration of distributed energy; (2) the reorganization of the open-competition electricity market causes the monthly electricity consumption forecast to become an issue faced by small-scale users, and the impact of randomness on the forecast results is greatly increased; and (3) in the mechanism of the electricity retail market, the performance appraisal system is measured monthly. Therefore, finding a new monthly electricity consumption forecasting method is important.Electricity consumption forecasting of integrated energy systems involves studying power data and analyzing their characteristics, determining the internal variation law of historical data and the relationship between historical data and their influencing factors, and then predicting power demand [5]. The monthly electricity consumption data is a time series, which is usually influenced by season, user behavior, and economic development. Therefore, such time series can be decomposed into components that represent various influencing factors. A time series forecasting method based on decomposition technology has been applied in many fields, including power demand information [6–9]. In reference [10], moving regression and smoothing spline are used as decomposition models to decompose the time series of power demand. Two neural networks (NNs) are trained to predict the decomposition results. Results show that the decomposition prediction is more accurate than direct prediction. Damrongkulkamjorn P. and Churueang P. [11] used a classical decomposition model to decompose the time series into the trend component and the seasonal component, and Seasonal AutoRegressive Integral Moving Average (SARIMA) and weighted method are used to predict each component. Yan et al. [12] used an X12 multiplier model to decompose monthly electricity consumption series and establish different models to predict each component. The X12 model not only overcomes the shortcomings of the classical decomposition model, that is, the trend values of several samples at the beginning and the end of the model cannot be estimated, but also has more advantages for the series whose prediction properties change with time. Wu et al. [13] used three methods, namely, AutoRegressive Integral Moving Average (ARIMA) model, X12-ARIMA model, and polynomial regression, to predict the software monthly error number. The superiority of the X12-ARIMA model was verified, and the limitations of the X12 model, such as its ability to deal with quarterly or monthly data only and its inability to control the rate of change of seasonal components, were identified. Guo et al. [14] considered the impact of economic disturbance on electricity consumption and used the X12-ARIMA model to combine economic factors and electricity consumption series to predict the final electricity consumption. This method can predict the final electricity consumption more accurately, but it requires the data of economic factors. A brief summary of the studied literature is presented in Table 1, including [15–18] that will be further explained in Section 1.2.Table 1
Literature review summary.
Ref.
Forecasted variable(s)
Forecasting method(s)
Decomposition method(s)
Decomposition component(s)
[6]
Monthly load
ARIMA
X12
Trend, seasonal, and irregular components.
[7]
Daily and weekly load
NN
Wavelet transform
Trend load series under different frequency bands and the detailed load series.
[8]
Monthly load
Hybrid method combining ARIMA, support vector machine (SVM), and Holt-Winters
Seasonal adjustments and H-P filter
Trend, seasonal, cyclic, and irregular components.
[9]
Fault line(s)
Intrinsic mode function (IMF)
Empirical mode decomposition (EMD)
Zero sequence current at different frequencies.
[10]
Monthly load
NN
Moving regression and smoothing spline decomposition models
Trend and fluctuation series.
[11]
Monthly load
SARIMA
Multiplicative decomposition
Trend and seasonal components.
[12]
Monthly load
ARIMA
X12
Trend, seasonal, and random components.
[13]
Monthly number of a software bug
Hybrid method combining ARIMA, X12, and polynomial regression
X12
Seasonal and cyclic components.
[14]
Monthly load
Hybrid method combining ARIMA and vector error correction (VEC)
X12
Trends of load and economy, seasonality, holiday, and irregular components.
[15]
Mean flying hours between failures for aircraft
Hybrid method combining grey box, back propagation NN (BPNN), and SVM.
STL
Long-term trend and seasonal components.
[16]
Future geospatial incidence levels
Kernel density estimation with dynamic kernel bandwidth
STL
Annual, seasonal, weekend effect, and random components.
[17]
Bids for amazon EC2 spot instances
Benchmarked time series forecasting methods such as naïve, ARIMA, and ETS
STL
Spike and seasonal components.
[18]
Daily and weekly load
Hybrid method combining Holt-Winters and SVR
STL
Base component and weather sensitive component.


### 1.2. Motivation

This paper proposes a monthly power consumption comprehensive forecasting method based on the Seasonal and Trend decomposition using Loess (STL) model, which is a time series decomposition model based on the local weighted regression scatter smoothing method. The model can process data for any type of seasonal variation factor, and users can control the seasonal component change rate and the smoothness of the trend component. In addition, it is more robust to outliers. The STL model has been applied in many fields [15–17]. Lu et al. [18] successfully applied the STL model to load prediction but did not consider the influence of seasonal inflection point on the change rate of seasonal components. In the present study, the proposed method made full use of the advantages of the STL model; set up different components of the rate of change in season; realized the seasonal component of periodic and aperiodic decomposition; decomposed the power sequence into trend, seasonal, and stochastic components; and utilized the X12 model to extract the trend component in economic data fitting. The Vector AutoRegression (VAR) model was used to predict the trend component, the neural network was used to predict the seasons, the average method was used to predict the random component, and the component projection reconstruction was used for monthly electricity consumption forecasting. This paper adopts R language and MATLAB to compile the algorithm and verifies and analyzes the effectiveness of the proposed method through the actual monthly electricity consumption data of a university park.


## 1.1. Literature Review

An integrated energy system generally refers to the optimization of the allocation of various energy resources in accordance with the energy structure and energy endowment of a region. It often combines advanced technologies, such as waste heat utilization, heat pump, and energy storage, thereby fully using high- and low-grade energy to provide technical solutions for cold, hot, and electric products for users in the region. As an important approach to accelerate the transformation to sustainable energy worldwide, the integrated energy system has attracted much attention in recent years. Accurate electricity consumption forecasting not only plays a decisive role in comprehensive planning, operation, management, and cascade utilization of energy system, but also acts as a key technology to promote the energy market. To date, load forecasting technology is mature [1–4], but it cannot be fully applied to power consumption forecasting in integrated energy systems because of the following reasons: (1) the demand and load characteristics of energy users change accordingly with the integration of distributed energy; (2) the reorganization of the open-competition electricity market causes the monthly electricity consumption forecast to become an issue faced by small-scale users, and the impact of randomness on the forecast results is greatly increased; and (3) in the mechanism of the electricity retail market, the performance appraisal system is measured monthly. Therefore, finding a new monthly electricity consumption forecasting method is important.Electricity consumption forecasting of integrated energy systems involves studying power data and analyzing their characteristics, determining the internal variation law of historical data and the relationship between historical data and their influencing factors, and then predicting power demand [5]. The monthly electricity consumption data is a time series, which is usually influenced by season, user behavior, and economic development. Therefore, such time series can be decomposed into components that represent various influencing factors. A time series forecasting method based on decomposition technology has been applied in many fields, including power demand information [6–9]. In reference [10], moving regression and smoothing spline are used as decomposition models to decompose the time series of power demand. Two neural networks (NNs) are trained to predict the decomposition results. Results show that the decomposition prediction is more accurate than direct prediction. Damrongkulkamjorn P. and Churueang P. [11] used a classical decomposition model to decompose the time series into the trend component and the seasonal component, and Seasonal AutoRegressive Integral Moving Average (SARIMA) and weighted method are used to predict each component. Yan et al. [12] used an X12 multiplier model to decompose monthly electricity consumption series and establish different models to predict each component. The X12 model not only overcomes the shortcomings of the classical decomposition model, that is, the trend values of several samples at the beginning and the end of the model cannot be estimated, but also has more advantages for the series whose prediction properties change with time. Wu et al. [13] used three methods, namely, AutoRegressive Integral Moving Average (ARIMA) model, X12-ARIMA model, and polynomial regression, to predict the software monthly error number. The superiority of the X12-ARIMA model was verified, and the limitations of the X12 model, such as its ability to deal with quarterly or monthly data only and its inability to control the rate of change of seasonal components, were identified. Guo et al. [14] considered the impact of economic disturbance on electricity consumption and used the X12-ARIMA model to combine economic factors and electricity consumption series to predict the final electricity consumption. This method can predict the final electricity consumption more accurately, but it requires the data of economic factors. A brief summary of the studied literature is presented in Table 1, including [15–18] that will be further explained in Section 1.2.Table 1
Literature review summary.
Ref.
Forecasted variable(s)
Forecasting method(s)
Decomposition method(s)
Decomposition component(s)
[6]
Monthly load
ARIMA
X12
Trend, seasonal, and irregular components.
[7]
Daily and weekly load
NN
Wavelet transform
Trend load series under different frequency bands and the detailed load series.
[8]
Monthly load
Hybrid method combining ARIMA, support vector machine (SVM), and Holt-Winters
Seasonal adjustments and H-P filter
Trend, seasonal, cyclic, and irregular components.
[9]
Fault line(s)
Intrinsic mode function (IMF)
Empirical mode decomposition (EMD)
Zero sequence current at different frequencies.
[10]
Monthly load
NN
Moving regression and smoothing spline decomposition models
Trend and fluctuation series.
[11]
Monthly load
SARIMA
Multiplicative decomposition
Trend and seasonal components.
[12]
Monthly load
ARIMA
X12
Trend, seasonal, and random components.
[13]
Monthly number of a software bug
Hybrid method combining ARIMA, X12, and polynomial regression
X12
Seasonal and cyclic components.
[14]
Monthly load
Hybrid method combining ARIMA and vector error correction (VEC)
X12
Trends of load and economy, seasonality, holiday, and irregular components.
[15]
Mean flying hours between failures for aircraft
Hybrid method combining grey box, back propagation NN (BPNN), and SVM.
STL
Long-term trend and seasonal components.
[16]
Future geospatial incidence levels
Kernel density estimation with dynamic kernel bandwidth
STL
Annual, seasonal, weekend effect, and random components.
[17]
Bids for amazon EC2 spot instances
Benchmarked time series forecasting methods such as naïve, ARIMA, and ETS
STL
Spike and seasonal components.
[18]
Daily and weekly load
Hybrid method combining Holt-Winters and SVR
STL
Base component and weather sensitive component.


## 1.2. Motivation

This paper proposes a monthly power consumption comprehensive forecasting method based on the Seasonal and Trend decomposition using Loess (STL) model, which is a time series decomposition model based on the local weighted regression scatter smoothing method. The model can process data for any type of seasonal variation factor, and users can control the seasonal component change rate and the smoothness of the trend component. In addition, it is more robust to outliers. The STL model has been applied in many fields [15–17]. Lu et al. [18] successfully applied the STL model to load prediction but did not consider the influence of seasonal inflection point on the change rate of seasonal components. In the present study, the proposed method made full use of the advantages of the STL model; set up different components of the rate of change in season; realized the seasonal component of periodic and aperiodic decomposition; decomposed the power sequence into trend, seasonal, and stochastic components; and utilized the X12 model to extract the trend component in economic data fitting. The Vector AutoRegression (VAR) model was used to predict the trend component, the neural network was used to predict the seasons, the average method was used to predict the random component, and the component projection reconstruction was used for monthly electricity consumption forecasting. This paper adopts R language and MATLAB to compile the algorithm and verifies and analyzes the effectiveness of the proposed method through the actual monthly electricity consumption data of a university park.


## 2. Problem Description

In the monthly electricity sales forecast, predicting the electricity sales of the following month based on the historical electricity sales data is necessary, taking into account the climate, seasons, holidays, user types, economy, and other factors. In the prediction process, monthly electricity consumption can be decomposed into components that represent various influencing factors, and the effects of different influencing factors on each component can be considered to select an appropriate model to predict the monthly electricity consumption. The problem description of the monthly electricity sales forecast is shown in Figure1.Figure 1
Monthly electricity sales forecast problem description diagram.


### 2.1. Analysis of the Relationship between Electricity Consumption and Months

Monthly electricity consumption with the development of time is variable. The change in the nature of human activity, such as seasonal change (e.g., in schools, electricity use is reduced during winter and summer vacations), causes power consumption to increase or decrease [19]. A month contains not only social behavior information, such as holidays, but also natural information represented by seasons. This section takes the monthly electricity consumption of a university park in North China in 2017 as an example to analyze the influence of months on electricity consumption from two aspects: the relationship between electricity consumption and holidays, and the relationship between electricity consumption and seasons. The monthly power consumption curve of a university park in the north is shown in Figure 2.Figure 2
Monthly electricity consumption curve of a university park in Shenyang from 2010 to 2017.


#### 2.1.1. Relationship between Electricity Consumption and Holidays

Figure2 shows that power consumption started to decline in January and generally reached a low point in February and March, given that the park included the university. The winter holiday was in January and March, and the Spring Festival was in February and March. From March to April, electricity consumption began to reach a slight peak because of various student activities in the back-to-school season. Electricity consumption was relatively stable from May to July. Electricity consumption decreased in July due to the summer holiday and rebounded in September during the back-to-school season. Holiday factors that affect monthly electricity consumption cannot be easily reflected in short holidays. Therefore, the relationship between winter and summer vacations and the Spring Festival and monthly electricity consumption can indirectly reflect the relationship between holidays and electricity consumption.


#### 2.1.2. Relationship between Electricity Consumption and Seasons

In addition to the winter and summer holidays and the Spring Festival, the turning point of the electricity consumption curve is related to the abrupt change of seasons. Winter and spring occur in January, spring and summer in March, summer and autumn in July, and autumn and winter in October. Figure2 shows that the alternating seasons use the power curve to produce an inflection point.


### 2.2. Analysis of the Relationship between Electricity Consumption and Economic Development

Electric power is required for a developing economy, and regional economic development is closely related to electric power demand [20]. The relationship between electricity consumption and economic development in a university park in North China is analyzed based on the actual situation of a city in North China.


#### 2.2.1. Data Sources

The quarterly gross domestic product (GDP) data of a northern city from January 2010 to December 2017 and the monthly electricity consumption data of a university park in North China from January 2010 to December 2017 are used in the analysis because GDP is an important indicator to measure the regional economic conditions. However, monthly GDP data cannot be obtained at present due to limited data availability [21]. Therefore, in this section, the quarterly GDP with the data sample size closest to the monthly is selected to represent the economic factor and analyze its qualitative relationship with monthly electricity consumption.


#### 2.2.2. Data Processing and Analysis

A university park in a northern city provided the power consumption data from January 2010 to December 2017. The National Bureau of Statistics provided the quarterly GDP data of a certain northern city from January 2010 to December 2017. The quarterly GDP growth rate and power consumption quarter-on-quarter growth changes over time clusters are plotted in the bar chart, as shown in Figure3. This section presents the standardized data processing to unify the dimension and for easy comparison.Figure 3
Trend of quarterly GDP and monthly electricity consumption.Figure3 shows that the peak of quarterly GDP growth rate is always ahead of the peak of the monthly electricity consumption growth rate because of the time-lag effect of economic factors on electricity consumption. However, the fluctuation of GDP can be reflected in the fluctuation of electricity consumption after a period of time. Therefore, the relationship between quarterly GDP and monthly electricity consumption can indirectly reflect the relationship between economic development and electricity consumption. The analysis reveals that monthly electricity consumption is closely related to the impact of economic development. Assuming that economic changes develop in a volatile manner over a certain period of time, electricity consumption can be approximately considered a volatile change.


## 2.1. Analysis of the Relationship between Electricity Consumption and Months

Monthly electricity consumption with the development of time is variable. The change in the nature of human activity, such as seasonal change (e.g., in schools, electricity use is reduced during winter and summer vacations), causes power consumption to increase or decrease [19]. A month contains not only social behavior information, such as holidays, but also natural information represented by seasons. This section takes the monthly electricity consumption of a university park in North China in 2017 as an example to analyze the influence of months on electricity consumption from two aspects: the relationship between electricity consumption and holidays, and the relationship between electricity consumption and seasons. The monthly power consumption curve of a university park in the north is shown in Figure 2.Figure 2
Monthly electricity consumption curve of a university park in Shenyang from 2010 to 2017.


### 2.1.1. Relationship between Electricity Consumption and Holidays

Figure2 shows that power consumption started to decline in January and generally reached a low point in February and March, given that the park included the university. The winter holiday was in January and March, and the Spring Festival was in February and March. From March to April, electricity consumption began to reach a slight peak because of various student activities in the back-to-school season. Electricity consumption was relatively stable from May to July. Electricity consumption decreased in July due to the summer holiday and rebounded in September during the back-to-school season. Holiday factors that affect monthly electricity consumption cannot be easily reflected in short holidays. Therefore, the relationship between winter and summer vacations and the Spring Festival and monthly electricity consumption can indirectly reflect the relationship between holidays and electricity consumption.


### 2.1.2. Relationship between Electricity Consumption and Seasons

In addition to the winter and summer holidays and the Spring Festival, the turning point of the electricity consumption curve is related to the abrupt change of seasons. Winter and spring occur in January, spring and summer in March, summer and autumn in July, and autumn and winter in October. Figure2 shows that the alternating seasons use the power curve to produce an inflection point.


## 2.1.1. Relationship between Electricity Consumption and Holidays

Figure2 shows that power consumption started to decline in January and generally reached a low point in February and March, given that the park included the university. The winter holiday was in January and March, and the Spring Festival was in February and March. From March to April, electricity consumption began to reach a slight peak because of various student activities in the back-to-school season. Electricity consumption was relatively stable from May to July. Electricity consumption decreased in July due to the summer holiday and rebounded in September during the back-to-school season. Holiday factors that affect monthly electricity consumption cannot be easily reflected in short holidays. Therefore, the relationship between winter and summer vacations and the Spring Festival and monthly electricity consumption can indirectly reflect the relationship between holidays and electricity consumption.


## 2.1.2. Relationship between Electricity Consumption and Seasons

In addition to the winter and summer holidays and the Spring Festival, the turning point of the electricity consumption curve is related to the abrupt change of seasons. Winter and spring occur in January, spring and summer in March, summer and autumn in July, and autumn and winter in October. Figure2 shows that the alternating seasons use the power curve to produce an inflection point.


## 2.2. Analysis of the Relationship between Electricity Consumption and Economic Development

Electric power is required for a developing economy, and regional economic development is closely related to electric power demand [20]. The relationship between electricity consumption and economic development in a university park in North China is analyzed based on the actual situation of a city in North China.


### 2.2.1. Data Sources

The quarterly gross domestic product (GDP) data of a northern city from January 2010 to December 2017 and the monthly electricity consumption data of a university park in North China from January 2010 to December 2017 are used in the analysis because GDP is an important indicator to measure the regional economic conditions. However, monthly GDP data cannot be obtained at present due to limited data availability [21]. Therefore, in this section, the quarterly GDP with the data sample size closest to the monthly is selected to represent the economic factor and analyze its qualitative relationship with monthly electricity consumption.


### 2.2.2. Data Processing and Analysis

A university park in a northern city provided the power consumption data from January 2010 to December 2017. The National Bureau of Statistics provided the quarterly GDP data of a certain northern city from January 2010 to December 2017. The quarterly GDP growth rate and power consumption quarter-on-quarter growth changes over time clusters are plotted in the bar chart, as shown in Figure3. This section presents the standardized data processing to unify the dimension and for easy comparison.Figure 3
Trend of quarterly GDP and monthly electricity consumption.Figure3 shows that the peak of quarterly GDP growth rate is always ahead of the peak of the monthly electricity consumption growth rate because of the time-lag effect of economic factors on electricity consumption. However, the fluctuation of GDP can be reflected in the fluctuation of electricity consumption after a period of time. Therefore, the relationship between quarterly GDP and monthly electricity consumption can indirectly reflect the relationship between economic development and electricity consumption. The analysis reveals that monthly electricity consumption is closely related to the impact of economic development. Assuming that economic changes develop in a volatile manner over a certain period of time, electricity consumption can be approximately considered a volatile change.


## 2.2.1. Data Sources

The quarterly gross domestic product (GDP) data of a northern city from January 2010 to December 2017 and the monthly electricity consumption data of a university park in North China from January 2010 to December 2017 are used in the analysis because GDP is an important indicator to measure the regional economic conditions. However, monthly GDP data cannot be obtained at present due to limited data availability [21]. Therefore, in this section, the quarterly GDP with the data sample size closest to the monthly is selected to represent the economic factor and analyze its qualitative relationship with monthly electricity consumption.


## 2.2.2. Data Processing and Analysis

A university park in a northern city provided the power consumption data from January 2010 to December 2017. The National Bureau of Statistics provided the quarterly GDP data of a certain northern city from January 2010 to December 2017. The quarterly GDP growth rate and power consumption quarter-on-quarter growth changes over time clusters are plotted in the bar chart, as shown in Figure3. This section presents the standardized data processing to unify the dimension and for easy comparison.Figure 3
Trend of quarterly GDP and monthly electricity consumption.Figure3 shows that the peak of quarterly GDP growth rate is always ahead of the peak of the monthly electricity consumption growth rate because of the time-lag effect of economic factors on electricity consumption. However, the fluctuation of GDP can be reflected in the fluctuation of electricity consumption after a period of time. Therefore, the relationship between quarterly GDP and monthly electricity consumption can indirectly reflect the relationship between economic development and electricity consumption. The analysis reveals that monthly electricity consumption is closely related to the impact of economic development. Assuming that economic changes develop in a volatile manner over a certain period of time, electricity consumption can be approximately considered a volatile change.


## 3. Monthly Electricity Consumption Forecasting Method Based on X12 and STL Decomposition Model

The variation characteristics of time series of each component are different due to different influencing factors [22]. Among them, the trend component is mainly affected by economic factors to reflect a longer period of development direction. Seasonal component is a periodic fluctuation with a fixed length and amplitude under the influence of seasonal variation. Random components are formed by various accidental factors [23]. The individual components were predicted by using a decomposition technique, and then the predicted values of each component were reduced to the predicted values of monthly electricity consumption. Therefore, different decomposition strategies should be adopted for power consumption sequences in different months, and then the characteristics of each component should be predicted. The comprehensive prediction strategy of monthly electricity consumption based on the X12 and STL decomposition model is shown in Figure 4.Figure 4
Strategy diagram of comprehensive monthly electricity consumption forecast method based on the X12 and STL decomposition models.The proposed monthly electricity consumption prediction method based on the X12 and STL decomposition models combines a variety of mathematical models. The trend components in economic data were extracted by the X12 decomposition model, and the trend components of economic factors and electricity consumption were fitted by the VAR model. The seasonal component can be extracted from the historical data of electricity consumption because the time contains the information of seasons and holidays, and the BP neural network model is established for prediction. If the random component changes irregularly and its value fluctuates at approximately 1, then the average value method is used for direct calculation. This paper takes a university campus in North China as an example to verify the validity of the monthly electricity consumption prediction method based on the X12 and STL decomposition models.


### 3.1. Monthly Electricity Consumption and Economic Factor Decomposition

#### 3.1.1. Decomposition of Monthly Electricity Consumption Based on the STL Model

The STL model is a time series decomposition method that uses robust local-weighted regression as a smoothing method. When estimating the value of a response variable, a subset of data is selected from the vicinity of the predicted variable, and then linear or quadratic regression is performed on the subset by using the weighted least squares method to reduce the weight of the value far from the estimated point. Finally, the value of the response variable can be estimated by the local regression model. This point-by-point method is generally used to fit the whole curve to decompose the time series accurately [24].The decomposition model is mainly divided into the time series additive model and the time series multiplication model. The additive model assumes that the influence of each component is independent of each other, and each component is expressed in absolute terms. The multiplication model assumes that the influence of each component on the development of phenomena is interrelated based on the absolute amount of the trend component, and the other components are expressed in proportion. The decomposition model adopts the multiplication model because of the interactive influence of each factor on electricity consumption. The monthly electricity consumption series is expressed by the product of three components, which represent the trend, seasonal, and random factors. The original time series can be decomposed as follows:(1)Y=Ytrend×Yseasonal×Yrandom=Yt×Ys×Yr,where Y is the time series of electricity consumption, Yt is the trend component, Ys is the seasonal component, and Yr is the random component.When decomposing, the seasonal component of the month at the seasonal inflection point fluctuates greatly with time, and the seasonal component of the same month should be changed every year. Thus, the nonperiodic decomposition of seasonal component is adopted, whereas the seasonal component of the month at the nonseasonal inflection point fluctuates slightly with time, and the seasonal component of the same month every year is almost constant. The seasonal component is used for periodic decomposition.


#### 3.1.2. Decomposition of Economic Factors Based on the X12 Model

The economic factors and electricity consumption are affected by seasonal changes and random factors, but the influence of economic factors on electricity consumption is mainly reflected in the trend components [25]. To avoid the influence of redundant components, this study adopts the X12 model to perform seasonal adjustment on the GDP data, stripping out the seasonal component and random component and leaving the trend component of GDP to predict the trend component of electricity consumption. The X12 model is a seasonal decomposition model proposed by the Census Bureau of the US Department of Commerce. This paper selects the multiplicative decomposition model to express the GDP sequence as the product of trend factors, seasonal factors, and random factors because the influences of various factors on GDP are interactive.(2)E=Etrend×Eseasonal×Erandom=Et×Es×Er,where E is the time series of the monthly GDP, Et is the trend component, Es is the seasonal component, and Er is the random component.


### 3.2. Three-Component Prediction Models of Monthly Electricity Consumption

The trend component is a development direction formed by the influence of economic growth over a long period of time; it shows a stable trend. Seasonal component is a periodic fluctuation that is affected by seasonal alternation. Random components are small perturbations that exhibit no obvious change in characteristics under the influence of accidental factors. Three models are selected to predict the trend, seasonal, and random components.


#### 3.2.1. VAR Prediction Model of Trend Component

The VAR model is one of the most commonly used econometric models for the analysis and prediction of economic indicators. GDP data were taken as the influencing factors of monthly electricity consumption and included in the VAR model to predict the trend component of electricity consumption. The model is built based on the statistical properties of data and takes each endogenous variable in the system as a function of the lagged value of all endogenous variables to construct the model [26] as follows:(3)yt=A1yt−1+⋯+Apyt−p+BXt+εt,where yt is an endogenous variable vector of k-dimension, Xt is a vector of the d-dimensional exogenous variable, p is the hysteresis order, ApandB are the coefficient matrices that must be estimated, and εt is a k-dimensional disturbance vector. Assuming that the covariance matrix of εt is a positive definite matrix with k-dimensions, the formula is as follows:(4)y1ty2t⋮ykt=A1y1t−1y2t−1⋮ykt−1+A2y1t−2y2t−2⋮ykt−2+⋯+Bx1tx2t⋮xdt+ε1tε2t⋮εkt.That is, the VAR (p) model with k time series variables is composed of k equations, and the endogenous variable lags behind the VAR (n) model of order n. The above equation is simply transformed into(5)y˜t=A1y˜t−1+⋯+Apy˜t−p+ε˜t,where y˜t is the residual of yt’s regression with respect to exogenous variable Xt, namely,(6)ALy˜t=ε˜t,where AL=Ik−A1L−A2L2−⋯−ApLp is the k-order parameter square matrix of lagging operator L and impact vector ε˜t is a white noise vector, which has no structural meaning [27].When considering the unrestricted VAR model without exogenous variables, the expression is as follows:(7)yt=A1yt−1+⋯+Apyt−p+εt.If the determinantdetAL satisfies the stability condition, then it can be expressed as the vector dynamic average form of the infinite order:(8)yt=CLεt,where CL=AL−1 and CL=C0+C1L+C2L2+⋯,C0=Ik.The estimation of the VAR model can be performed through the least square method, and the estimator of the matrix can be obtained as follows:(9)∑^=1T∑ε^tε^t′,where ε^t=yt−A^1yt−1−A^2yt−2−⋯−A^pyt−p. When the parameter of VAR is estimated, given that ALCL=Ik, the parameter estimation of the corresponding vector dynamic average model can be obtained. The estimator of the VAR model can be obtained by the ordinary least squares (OLS) method because no contemporaneity correlation problem exists [28].


#### 3.2.2. Prediction Models of Seasonal Components

When forecasting seasonal components, we should consider the month on season alternation points and season stabilization points.(1)
For months on season stabilization points, the seasonal components are decomposed periodically. The seasonal component of the predicted month is the same as that of the same period in history, that is,(10)Ysi,j=Ysi−1,j,whereYsi,j represents the seasonal component of the monthly electricity consumption in the jth month of the ith year.(2)
For months on season alternation points, the seasonal components are decomposed nonperiodically, and the seasonal components change greatly during the historical period. The BP neural network is adopted to predict the seasonal component, and the process includes forward propagation process deduction and error reverse propagation process deduction. The BP neural network prediction model is(11)Ysi=fYsi−1,Ysi−2,…,Ysi−n,Ysi=ϑ+∑t=1mctf∑k=1nwktYsi−k+δt,where Ysi is the predicted value of the seasonal component of the ith month; Ysi−kk=1,2,…,n is the observed value of the first n cycles; ϑ and δtt=1,2,…,m are the output bias weight and the hidden layer bias weight, respectively; ctt=1,2,…,m is the connection weight from the hidden layer to the output layer; f is the activation function of the hidden layer; and wkt is the connection weight between the input layer neurons and the hidden layer neurons [29]. The detailed steps of the BP neural network are given in Algorithm 1.Algorithm 1:BP neural network procedure.
Input: Training set D=xk,ykk=1m; learning rate η
Output: Multilayer Feedforward Neural Network Connecting Weights or Thresholds
(1)
function BPD,η
(2)
Randomly initialize all connection weights and thresholds in the network within the range of (0, 1)
(3)
repeat
(4)
for all xk,yk∈D do
(5)
Calculate the current sample outputy^k=fβj−θj
(6)
Calculate the gradient of the output neurongj=−∂Ek/∂y^k⋅∂y^k/∂βj=−y^jk−yjkf′βj−θj=y^jk1−y^jky^jk−yjk
(7)
Calculate the gradient of the hidden layer neuroneh=−∂Ek/∂bh⋅∂bh/αh=−∑j=1l∂Ek/∂βj⋅∂βj/bhf′αh−γh=∑j=1lWhjgjf′αh−γh=bh1−bh∑j=1lWhjgj
(8)
Update the weightsΔWhj=ηgjbh ΔVih=ηehxi
(9)
Update the thresholdΔθj=−ηgj Δγh=−ηeh
(10)
end for
(11)
until the stop conditions are achieved
(12)
end function


#### 3.2.3. Average Prediction Model of Random Components

No evident change trend is observed in the random components, and the value is less than 1. The average method is used to predict the random components of the sequence. The random components of the predicted month are considered the historical average of the random components of the same month. The average prediction model is(12)Yri,j=1nYri−1,j+Yri−2,j+⋯+Yri−n,j,where Yri,j is the random component of the monthly electricity consumption in the jth month of the ith year.


### 3.3. Reconstructing the Predicted Value of Monthly Electricity Consumption

After the predicted value of each component is obtained, the final predicted value of the monthly electricity consumption is obtained by using exponential multiplication, that is,(13)Yfi,j=eYti,j⋅eYsi,j⋅eYri,j,where Yfi,j is the prediction value of electricity consumption in the jth month of the ith year; Yti,j is the prediction value of the trend component in the jth month of the ith year; Ysi,j is the prediction value of the seasonal component in the jth month of the ith year; and Yri,j is the prediction value of the random component in the jth month of the ith year.The detailed steps of the monthly electricity consumption forecasting method based on the X12 and STL decomposition models are presented in Algorithm2.Algorithm 2:Procedure of the monthly electricity consumption forecasting method based on X12 and STL decomposition models.
Input: Monthly GDP time series E; monthly electricity consumption time series Y
Output: Predicted value of monthly electricity consumption
(1)
function X12
(2)
Decompose GDP sequenceE
E=Etrend×Eseasonal×Erandom=Et×Es×Er
(3)
function stl (ltsObject, s.window, robust = TRUE)
(4)
while ltsObject on season stabilization points
(5)
s.window ⟵ period
(6)
while ltsObject on season alternation points
(7)
s.window ⟵ 2n + 1, n > 3
(8)
end while
(9)
Decompose monthly electricity consumption sequenceY Y=Ytrend×Yseasonal×Yrandom=Yt+Ys+Yr
(10)
end function
(11)
Predict the trend components
(12)
function VAR
(13)
Estimate the model with the least squares method∑^=1/T∑ε^tε^t′;ε^t=yt−A^1yt−1−A^2yt−2−⋯−A^pyt−p
(14)
Calculate the current sample outputyt=A1yt−1+⋯+Apyt−p+εt
(15)
end function
(16)
Predict the seasonal components
(17)
function BPD,η
(18)
Randomly initialize all connection weights and thresholds in the network within the range of (0, 1)
(19)
repeat
(20)
for all xk,yk∈D do
(21)
Calculate the current sample outputy^k=fβj−θj
(22)
end for
(23)
until the stop conditions are achieved
(24)
end function
(25)
Predict the random components
(26)
Yri,j=1/nYri−1,j+Yri−2,j+⋯+Yri−n,j
(27)
Reconstruct the predicted value of monthly electricity consumption
(28)
Yfi,j=eYti,j⋅eYsi,j⋅eYri,j


## 3.1. Monthly Electricity Consumption and Economic Factor Decomposition

### 3.1.1. Decomposition of Monthly Electricity Consumption Based on the STL Model

The STL model is a time series decomposition method that uses robust local-weighted regression as a smoothing method. When estimating the value of a response variable, a subset of data is selected from the vicinity of the predicted variable, and then linear or quadratic regression is performed on the subset by using the weighted least squares method to reduce the weight of the value far from the estimated point. Finally, the value of the response variable can be estimated by the local regression model. This point-by-point method is generally used to fit the whole curve to decompose the time series accurately [24].The decomposition model is mainly divided into the time series additive model and the time series multiplication model. The additive model assumes that the influence of each component is independent of each other, and each component is expressed in absolute terms. The multiplication model assumes that the influence of each component on the development of phenomena is interrelated based on the absolute amount of the trend component, and the other components are expressed in proportion. The decomposition model adopts the multiplication model because of the interactive influence of each factor on electricity consumption. The monthly electricity consumption series is expressed by the product of three components, which represent the trend, seasonal, and random factors. The original time series can be decomposed as follows:(1)Y=Ytrend×Yseasonal×Yrandom=Yt×Ys×Yr,where Y is the time series of electricity consumption, Yt is the trend component, Ys is the seasonal component, and Yr is the random component.When decomposing, the seasonal component of the month at the seasonal inflection point fluctuates greatly with time, and the seasonal component of the same month should be changed every year. Thus, the nonperiodic decomposition of seasonal component is adopted, whereas the seasonal component of the month at the nonseasonal inflection point fluctuates slightly with time, and the seasonal component of the same month every year is almost constant. The seasonal component is used for periodic decomposition.


### 3.1.2. Decomposition of Economic Factors Based on the X12 Model

The economic factors and electricity consumption are affected by seasonal changes and random factors, but the influence of economic factors on electricity consumption is mainly reflected in the trend components [25]. To avoid the influence of redundant components, this study adopts the X12 model to perform seasonal adjustment on the GDP data, stripping out the seasonal component and random component and leaving the trend component of GDP to predict the trend component of electricity consumption. The X12 model is a seasonal decomposition model proposed by the Census Bureau of the US Department of Commerce. This paper selects the multiplicative decomposition model to express the GDP sequence as the product of trend factors, seasonal factors, and random factors because the influences of various factors on GDP are interactive.(2)E=Etrend×Eseasonal×Erandom=Et×Es×Er,where E is the time series of the monthly GDP, Et is the trend component, Es is the seasonal component, and Er is the random component.


## 3.1.1. Decomposition of Monthly Electricity Consumption Based on the STL Model

The STL model is a time series decomposition method that uses robust local-weighted regression as a smoothing method. When estimating the value of a response variable, a subset of data is selected from the vicinity of the predicted variable, and then linear or quadratic regression is performed on the subset by using the weighted least squares method to reduce the weight of the value far from the estimated point. Finally, the value of the response variable can be estimated by the local regression model. This point-by-point method is generally used to fit the whole curve to decompose the time series accurately [24].The decomposition model is mainly divided into the time series additive model and the time series multiplication model. The additive model assumes that the influence of each component is independent of each other, and each component is expressed in absolute terms. The multiplication model assumes that the influence of each component on the development of phenomena is interrelated based on the absolute amount of the trend component, and the other components are expressed in proportion. The decomposition model adopts the multiplication model because of the interactive influence of each factor on electricity consumption. The monthly electricity consumption series is expressed by the product of three components, which represent the trend, seasonal, and random factors. The original time series can be decomposed as follows:(1)Y=Ytrend×Yseasonal×Yrandom=Yt×Ys×Yr,where Y is the time series of electricity consumption, Yt is the trend component, Ys is the seasonal component, and Yr is the random component.When decomposing, the seasonal component of the month at the seasonal inflection point fluctuates greatly with time, and the seasonal component of the same month should be changed every year. Thus, the nonperiodic decomposition of seasonal component is adopted, whereas the seasonal component of the month at the nonseasonal inflection point fluctuates slightly with time, and the seasonal component of the same month every year is almost constant. The seasonal component is used for periodic decomposition.


## 3.1.2. Decomposition of Economic Factors Based on the X12 Model

The economic factors and electricity consumption are affected by seasonal changes and random factors, but the influence of economic factors on electricity consumption is mainly reflected in the trend components [25]. To avoid the influence of redundant components, this study adopts the X12 model to perform seasonal adjustment on the GDP data, stripping out the seasonal component and random component and leaving the trend component of GDP to predict the trend component of electricity consumption. The X12 model is a seasonal decomposition model proposed by the Census Bureau of the US Department of Commerce. This paper selects the multiplicative decomposition model to express the GDP sequence as the product of trend factors, seasonal factors, and random factors because the influences of various factors on GDP are interactive.(2)E=Etrend×Eseasonal×Erandom=Et×Es×Er,where E is the time series of the monthly GDP, Et is the trend component, Es is the seasonal component, and Er is the random component.


## 3.2. Three-Component Prediction Models of Monthly Electricity Consumption

The trend component is a development direction formed by the influence of economic growth over a long period of time; it shows a stable trend. Seasonal component is a periodic fluctuation that is affected by seasonal alternation. Random components are small perturbations that exhibit no obvious change in characteristics under the influence of accidental factors. Three models are selected to predict the trend, seasonal, and random components.


### 3.2.1. VAR Prediction Model of Trend Component

The VAR model is one of the most commonly used econometric models for the analysis and prediction of economic indicators. GDP data were taken as the influencing factors of monthly electricity consumption and included in the VAR model to predict the trend component of electricity consumption. The model is built based on the statistical properties of data and takes each endogenous variable in the system as a function of the lagged value of all endogenous variables to construct the model [26] as follows:(3)yt=A1yt−1+⋯+Apyt−p+BXt+εt,where yt is an endogenous variable vector of k-dimension, Xt is a vector of the d-dimensional exogenous variable, p is the hysteresis order, ApandB are the coefficient matrices that must be estimated, and εt is a k-dimensional disturbance vector. Assuming that the covariance matrix of εt is a positive definite matrix with k-dimensions, the formula is as follows:(4)y1ty2t⋮ykt=A1y1t−1y2t−1⋮ykt−1+A2y1t−2y2t−2⋮ykt−2+⋯+Bx1tx2t⋮xdt+ε1tε2t⋮εkt.That is, the VAR (p) model with k time series variables is composed of k equations, and the endogenous variable lags behind the VAR (n) model of order n. The above equation is simply transformed into(5)y˜t=A1y˜t−1+⋯+Apy˜t−p+ε˜t,where y˜t is the residual of yt’s regression with respect to exogenous variable Xt, namely,(6)ALy˜t=ε˜t,where AL=Ik−A1L−A2L2−⋯−ApLp is the k-order parameter square matrix of lagging operator L and impact vector ε˜t is a white noise vector, which has no structural meaning [27].When considering the unrestricted VAR model without exogenous variables, the expression is as follows:(7)yt=A1yt−1+⋯+Apyt−p+εt.If the determinantdetAL satisfies the stability condition, then it can be expressed as the vector dynamic average form of the infinite order:(8)yt=CLεt,where CL=AL−1 and CL=C0+C1L+C2L2+⋯,C0=Ik.The estimation of the VAR model can be performed through the least square method, and the estimator of the matrix can be obtained as follows:(9)∑^=1T∑ε^tε^t′,where ε^t=yt−A^1yt−1−A^2yt−2−⋯−A^pyt−p. When the parameter of VAR is estimated, given that ALCL=Ik, the parameter estimation of the corresponding vector dynamic average model can be obtained. The estimator of the VAR model can be obtained by the ordinary least squares (OLS) method because no contemporaneity correlation problem exists [28].


### 3.2.2. Prediction Models of Seasonal Components

When forecasting seasonal components, we should consider the month on season alternation points and season stabilization points.(1)
For months on season stabilization points, the seasonal components are decomposed periodically. The seasonal component of the predicted month is the same as that of the same period in history, that is,(10)Ysi,j=Ysi−1,j,whereYsi,j represents the seasonal component of the monthly electricity consumption in the jth month of the ith year.(2)
For months on season alternation points, the seasonal components are decomposed nonperiodically, and the seasonal components change greatly during the historical period. The BP neural network is adopted to predict the seasonal component, and the process includes forward propagation process deduction and error reverse propagation process deduction. The BP neural network prediction model is(11)Ysi=fYsi−1,Ysi−2,…,Ysi−n,Ysi=ϑ+∑t=1mctf∑k=1nwktYsi−k+δt,where Ysi is the predicted value of the seasonal component of the ith month; Ysi−kk=1,2,…,n is the observed value of the first n cycles; ϑ and δtt=1,2,…,m are the output bias weight and the hidden layer bias weight, respectively; ctt=1,2,…,m is the connection weight from the hidden layer to the output layer; f is the activation function of the hidden layer; and wkt is the connection weight between the input layer neurons and the hidden layer neurons [29]. The detailed steps of the BP neural network are given in Algorithm 1.Algorithm 1:BP neural network procedure.
Input: Training set D=xk,ykk=1m; learning rate η
Output: Multilayer Feedforward Neural Network Connecting Weights or Thresholds
(1)
function BPD,η
(2)
Randomly initialize all connection weights and thresholds in the network within the range of (0, 1)
(3)
repeat
(4)
for all xk,yk∈D do
(5)
Calculate the current sample outputy^k=fβj−θj
(6)
Calculate the gradient of the output neurongj=−∂Ek/∂y^k⋅∂y^k/∂βj=−y^jk−yjkf′βj−θj=y^jk1−y^jky^jk−yjk
(7)
Calculate the gradient of the hidden layer neuroneh=−∂Ek/∂bh⋅∂bh/αh=−∑j=1l∂Ek/∂βj⋅∂βj/bhf′αh−γh=∑j=1lWhjgjf′αh−γh=bh1−bh∑j=1lWhjgj
(8)
Update the weightsΔWhj=ηgjbh ΔVih=ηehxi
(9)
Update the thresholdΔθj=−ηgj Δγh=−ηeh
(10)
end for
(11)
until the stop conditions are achieved
(12)
end function


### 3.2.3. Average Prediction Model of Random Components

No evident change trend is observed in the random components, and the value is less than 1. The average method is used to predict the random components of the sequence. The random components of the predicted month are considered the historical average of the random components of the same month. The average prediction model is(12)Yri,j=1nYri−1,j+Yri−2,j+⋯+Yri−n,j,where Yri,j is the random component of the monthly electricity consumption in the jth month of the ith year.


## 3.2.1. VAR Prediction Model of Trend Component

The VAR model is one of the most commonly used econometric models for the analysis and prediction of economic indicators. GDP data were taken as the influencing factors of monthly electricity consumption and included in the VAR model to predict the trend component of electricity consumption. The model is built based on the statistical properties of data and takes each endogenous variable in the system as a function of the lagged value of all endogenous variables to construct the model [26] as follows:(3)yt=A1yt−1+⋯+Apyt−p+BXt+εt,where yt is an endogenous variable vector of k-dimension, Xt is a vector of the d-dimensional exogenous variable, p is the hysteresis order, ApandB are the coefficient matrices that must be estimated, and εt is a k-dimensional disturbance vector. Assuming that the covariance matrix of εt is a positive definite matrix with k-dimensions, the formula is as follows:(4)y1ty2t⋮ykt=A1y1t−1y2t−1⋮ykt−1+A2y1t−2y2t−2⋮ykt−2+⋯+Bx1tx2t⋮xdt+ε1tε2t⋮εkt.That is, the VAR (p) model with k time series variables is composed of k equations, and the endogenous variable lags behind the VAR (n) model of order n. The above equation is simply transformed into(5)y˜t=A1y˜t−1+⋯+Apy˜t−p+ε˜t,where y˜t is the residual of yt’s regression with respect to exogenous variable Xt, namely,(6)ALy˜t=ε˜t,where AL=Ik−A1L−A2L2−⋯−ApLp is the k-order parameter square matrix of lagging operator L and impact vector ε˜t is a white noise vector, which has no structural meaning [27].When considering the unrestricted VAR model without exogenous variables, the expression is as follows:(7)yt=A1yt−1+⋯+Apyt−p+εt.If the determinantdetAL satisfies the stability condition, then it can be expressed as the vector dynamic average form of the infinite order:(8)yt=CLεt,where CL=AL−1 and CL=C0+C1L+C2L2+⋯,C0=Ik.The estimation of the VAR model can be performed through the least square method, and the estimator of the matrix can be obtained as follows:(9)∑^=1T∑ε^tε^t′,where ε^t=yt−A^1yt−1−A^2yt−2−⋯−A^pyt−p. When the parameter of VAR is estimated, given that ALCL=Ik, the parameter estimation of the corresponding vector dynamic average model can be obtained. The estimator of the VAR model can be obtained by the ordinary least squares (OLS) method because no contemporaneity correlation problem exists [28].


## 3.2.2. Prediction Models of Seasonal Components

When forecasting seasonal components, we should consider the month on season alternation points and season stabilization points.(1)
For months on season stabilization points, the seasonal components are decomposed periodically. The seasonal component of the predicted month is the same as that of the same period in history, that is,(10)Ysi,j=Ysi−1,j,whereYsi,j represents the seasonal component of the monthly electricity consumption in the jth month of the ith year.(2)
For months on season alternation points, the seasonal components are decomposed nonperiodically, and the seasonal components change greatly during the historical period. The BP neural network is adopted to predict the seasonal component, and the process includes forward propagation process deduction and error reverse propagation process deduction. The BP neural network prediction model is(11)Ysi=fYsi−1,Ysi−2,…,Ysi−n,Ysi=ϑ+∑t=1mctf∑k=1nwktYsi−k+δt,where Ysi is the predicted value of the seasonal component of the ith month; Ysi−kk=1,2,…,n is the observed value of the first n cycles; ϑ and δtt=1,2,…,m are the output bias weight and the hidden layer bias weight, respectively; ctt=1,2,…,m is the connection weight from the hidden layer to the output layer; f is the activation function of the hidden layer; and wkt is the connection weight between the input layer neurons and the hidden layer neurons [29]. The detailed steps of the BP neural network are given in Algorithm 1.Algorithm 1:BP neural network procedure.
Input: Training set D=xk,ykk=1m; learning rate η
Output: Multilayer Feedforward Neural Network Connecting Weights or Thresholds
(1)
function BPD,η
(2)
Randomly initialize all connection weights and thresholds in the network within the range of (0, 1)
(3)
repeat
(4)
for all xk,yk∈D do
(5)
Calculate the current sample outputy^k=fβj−θj
(6)
Calculate the gradient of the output neurongj=−∂Ek/∂y^k⋅∂y^k/∂βj=−y^jk−yjkf′βj−θj=y^jk1−y^jky^jk−yjk
(7)
Calculate the gradient of the hidden layer neuroneh=−∂Ek/∂bh⋅∂bh/αh=−∑j=1l∂Ek/∂βj⋅∂βj/bhf′αh−γh=∑j=1lWhjgjf′αh−γh=bh1−bh∑j=1lWhjgj
(8)
Update the weightsΔWhj=ηgjbh ΔVih=ηehxi
(9)
Update the thresholdΔθj=−ηgj Δγh=−ηeh
(10)
end for
(11)
until the stop conditions are achieved
(12)
end function


## 3.2.3. Average Prediction Model of Random Components

No evident change trend is observed in the random components, and the value is less than 1. The average method is used to predict the random components of the sequence. The random components of the predicted month are considered the historical average of the random components of the same month. The average prediction model is(12)Yri,j=1nYri−1,j+Yri−2,j+⋯+Yri−n,j,where Yri,j is the random component of the monthly electricity consumption in the jth month of the ith year.


## 3.3. Reconstructing the Predicted Value of Monthly Electricity Consumption

After the predicted value of each component is obtained, the final predicted value of the monthly electricity consumption is obtained by using exponential multiplication, that is,(13)Yfi,j=eYti,j⋅eYsi,j⋅eYri,j,where Yfi,j is the prediction value of electricity consumption in the jth month of the ith year; Yti,j is the prediction value of the trend component in the jth month of the ith year; Ysi,j is the prediction value of the seasonal component in the jth month of the ith year; and Yri,j is the prediction value of the random component in the jth month of the ith year.The detailed steps of the monthly electricity consumption forecasting method based on the X12 and STL decomposition models are presented in Algorithm2.Algorithm 2:Procedure of the monthly electricity consumption forecasting method based on X12 and STL decomposition models.
Input: Monthly GDP time series E; monthly electricity consumption time series Y
Output: Predicted value of monthly electricity consumption
(1)
function X12
(2)
Decompose GDP sequenceE
E=Etrend×Eseasonal×Erandom=Et×Es×Er
(3)
function stl (ltsObject, s.window, robust = TRUE)
(4)
while ltsObject on season stabilization points
(5)
s.window ⟵ period
(6)
while ltsObject on season alternation points
(7)
s.window ⟵ 2n + 1, n > 3
(8)
end while
(9)
Decompose monthly electricity consumption sequenceY Y=Ytrend×Yseasonal×Yrandom=Yt+Ys+Yr
(10)
end function
(11)
Predict the trend components
(12)
function VAR
(13)
Estimate the model with the least squares method∑^=1/T∑ε^tε^t′;ε^t=yt−A^1yt−1−A^2yt−2−⋯−A^pyt−p
(14)
Calculate the current sample outputyt=A1yt−1+⋯+Apyt−p+εt
(15)
end function
(16)
Predict the seasonal components
(17)
function BPD,η
(18)
Randomly initialize all connection weights and thresholds in the network within the range of (0, 1)
(19)
repeat
(20)
for all xk,yk∈D do
(21)
Calculate the current sample outputy^k=fβj−θj
(22)
end for
(23)
until the stop conditions are achieved
(24)
end function
(25)
Predict the random components
(26)
Yri,j=1/nYri−1,j+Yri−2,j+⋯+Yri−n,j
(27)
Reconstruct the predicted value of monthly electricity consumption
(28)
Yfi,j=eYti,j⋅eYsi,j⋅eYri,j


## 4. Sample Analysis

A comprehensive forecasting program for monthly electricity consumption based on the STL model is compiled by using R. The data are obtained from the measured monthly electricity consumption in a university park over a period of eight years. A fixed sample size is used to model and forecast the monthly electricity consumption. The monthly electricity consumption data in the first seven years are used as the sample model, and the monthly electricity consumption data in the eight-year period are used as the true value evaluation model.


### 4.1. Decomposition of Monthly Electricity Consumption Based on STL Model

The STL model can control the seasonal component change rate and then change the seasonal component of the sequence. The seasonal component of electricity consumption in the inflection point month and common month can be separated. The season of the same month changes every year, whereas the seasonal fluctuation of electricity consumption in other months decreases because January and February are affected by the Spring Festival and winter vacation, July and August are affected by summer vacation, and March and November are affected by seasonal alternation. Therefore, the seasonal components of January to March, July to August, and November are decomposed non-periodically, and the seasonal components of April to June, September to October, and December are decomposed periodically. The monthly electricity consumption is decomposed by the STL function in R language. The multiplicative model is transformed into the logarithmic additive model by logarithmic transformation because the STL function can only deal with the additive model, that is,(14)Yd=logY=logYtrend×Yseasonal×Yrandom=logYtrend+logYseasonal+logYrandom=Yt+Ys+Yr,where Y is the time series of the original time series; Yd is the time series object obtained by logarithmic transformation of Y; Yt is the trend component; Ys is the season component; and Yr is the random component.Taking March and April as examples, the STL function is used to draw the change curve of the sequence objectYd, and the curve is decomposed into Yt, Ys, and Yr. The change trend of each component is shown in Figure 5. The figure shows that the seasonal component Ys of the seasonal inflection month changes gradually with time, but the seasonal component Ys of the noninflection month changes periodically; Yt has a steady growth trend, and Yr has no development rule.Figure 5
March (a) and April (b) trends of original electricity consumption sequence with its components.
(a)
(b)


### 4.2. Monthly Electricity Consumption Trend Component Prediction Based on EV

Econometric Views or EViews is commonly referred to as an econometric package. It is a time series software specially developed for large organizations to process time series data [30]. A fixed sample size was used for simulation analysis. When power consumption in different months was predicted, the sample changed. For convenient description, the data from January 2010 to December 2016 were used as input for explanation. The specific steps of the improved method of monthly electricity consumption prediction combined with EViews are as follows.


#### 4.2.1. Data Decomposition

The GDP of each quarter is divided into months, on average, to obtain the approximate monthly GDP data to ensure that the sample size of the economic factors is consistent with monthly electricity consumption. The monthly GDP data of a city in the north are obtained and decomposed using the X12 model. Proc/Seasonal Adjustment/X12 is used to obtain the trend component data of GDP. The natural logarithm of trend components can be initially obtained, and then the VAR model can be established after data processing to ensure the stability of data. The trend component of GDP is shown in Figure6.Figure 6
GDP trend component curve.


#### 4.2.2. Determining the Lag Order

The lag order is represented byp (1≪p≪n, in which n is the sample size). The upper limit of the lag order is set to 12 because the time lag of monetary policy is generally 6–12 months. The trend components of GDP and electricity consumption are opened in the VAR package, the lag/length/criteria are clicked, and the confidence interval of the lag order pops up, as shown in Table 2.Table 2
Confidence interval for the lag order of the VAR model.
Lag
Log L
LR
FPE
AIC
SC
HQ
0
−919.8341
NA
45308.415
25.60650
25.66974
25.63168
1
−519.9274
766.4878
7581.285
14.60910
14.79882
14.68462
2
−392.8206
236.5599
248.1805
11.18946
11.50567
11.31534
3
−322.0301
127.8163
38.84761
9.334168
9.776853
9.510403
4
−304.8392
30.08404
26.96743
8.967755
9.536922
9.194342
5
−295.4543
15.90214
23.27183
8.818175
9.513823
9.095115
6
−293.7491
2.794622
24.88266
8.881920
9.704049
9.209212
7
−277.5902
25.58493
17.82851
8.544173
9.492784
8.921818
8
−273.6755
5.980746
17.97444
8.546543
9.621635
8.974540
9
−273.2689
0.598628
20.00905
8.646359
9.847933
9.124709
10
−266.7881
9.181128
18.85117
8.577448
9.905503
9.106151
11
−257.7192
12.34380
16.56391
8.436645
9.891182
9.015701
12
−255.9084
2.364098
17.84887
8.497456
10.07847
9.126864Table2 shows that when p=11, the evaluation index is the best; thus, the lag order is 11.


#### 4.2.3. Exogenous Test of Variables

The VAR model is effective in predicting the interrelated time series variable system. If the variables are not related to each other, then the VAR model [31, 32] is unsuitable. Exogenous tests are conducted on two variables to determine whether GDP changes play a major role in electricity consumption. View/lag structure/Granger causality is clicked, and the exogenous test results pop up, as shown in Table 3. The table shows that if the Prob value is less than 0.05, then no exogeneity is observed, indicating that GDP significantly affects electricity consumption, that is, it has predictive power, and establishing the VAR model is meaningful.Table 3
Exogenous test results.
Excluded
Chi-sq
df
Prob.
GDP_HP
30.56972
11
0.013
All
30.56972
11
0.013
POWER_HP
23.12329
11
0.0170
All
23.12329
11
0.0170
Dependent variable: LNGDP. Dependent variable: GDP_HP.


#### 4.2.4. Establishing the VAR Model

The model parameters are estimated. Then, the VAR setting box of GDP and electricity consumption data is opened, the OK button is clicked, and the estimation result window pops up, as shown in Table4.Table 4
VAR parameter estimation results.
LNGDP
POWER_T
GDP_HP(−1)
0.892644
−0.318902
(0.11730)
(0.30656)
[7.61004]
[−1.04026]
GDP_HP(−2)
−0.025358
0.608604
(0.12315)
(0.32184)
[−0.20592]
[1.89100]
POWER_HP(−1)
−0.020718
−0.160956
(0.04430)
(0.11577)
[−0.46773]
[−1.39035]
POWER_HP(−2)
0.005056
0.036296
(0.04195)
(0.10965)
[0.12052]
[0.33102]
C
−0.001664
−0.006855
(0.00618)
(0.01615)
[0.26925]
[0.42438]The first part of the output shows the ordinary least squares (OLS) regression statistics for each equation. The second part of the output shows the regression statistics of the VAR model [33]. “Forecast” on the estimation result interface is clicked, static prediction is selected, and “OK” is clicked to obtain the predicted value of the monthly electricity consumption trend component.


#### 4.2.5. Impulse Response

The impulse response is performed to understand the interaction between variables and the degree of influence [34]. Impulse is clicked and set as electricity consumption and GDP, and the response is set as electricity consumption. The impulse response of electricity consumption is shown in Figure 7.Figure 7
Impulse response diagram of power consumption.In the figure, the horizontal axis represents the number of lag periods of impact; the vertical axis represents the growth rate reflecting the trend component of GDP and electricity consumption; the solid line represents the impulse response function, the response degree, and duration of this variable at present and in the future after the impact of one standard deviation of the random error term of other variables; and the dotted line represents the deviation zone of plus or minus two standard deviations [35]. The figure shows that the response of electricity consumption is caused by the change of GDP. At the beginning, the change in GDP greatly affects electricity consumption. However, the impact of impulse gradually declines from the third stage.


### 4.3. Monthly Electricity Consumption Using Seasonal Component and Random Component Prediction Based on MATLAB

#### 4.3.1. Seasonal Component Prediction

(1)
For months on season stabilization points: historical contemporaneous values were directly taken as the predicted values of seasonal components in the current period.
(2)
For months on season alternation points: the BP neural network is written in MATLAB editor program code to predict the profits in the first 12 months as samples. Thus, the set of 12 input neurons and output neurons is 1. The current monthly electricity consumption is forecasted. Then, the “run” button is clicked, and the simulation results on the normalized prediction data, namely, the electricity consumption forecast of the current month using seasonal cycle components, are obtained. The training process and parameters of the BP neural network are shown in Figure8.Figure 8
Training process of the BP neural network.


#### 4.3.2. Random Component Prediction

The predicted value of the random component in the current period is expressed by the average historical value of the random component of the fixed sample size, according to Model 12.


### 4.4. Monthly Electricity Consumption Forecasting and Result Analysis

Four models are programmed and analyzed using the combined R language and MATLAB.


#### 4.4.1. Model 1

The ARIMA model is established based on the previous change law of electricity consumption in accordance with the time series characteristics of electricity consumption, without considering the influence of many factors, and the monthly electricity consumption are predicted using conventional linear regression.


#### 4.4.2. Model 2

The SARIMA model is established to predict the monthly electricity consumption by eliminating the seasonal effects on the series through the seasonal difference method in accordance with the time series characteristics of electricity consumption, considering only the seasonal factors affecting the monthly electricity consumption.


#### 4.4.3. Model 3

The monthly electricity consumption series is expressed by the product of three components, which represent the trend, seasonal, and random factors, in accordance with the time series characteristics of electricity consumption, and three components are modeled and predicted by considering the influence of different factors.


#### 4.4.4. Proposed Method

The change rate of seasonal components is set, and the time series is customized and decomposed by the STL model in accordance with the time series characteristics of electricity consumption in different months. Three components are predicted considering the influence of different factors.The actual monthly electricity consumption data and forecast results of a university park in 2017 are shown in Table5 and Figure 9.Table 5
Prediction results of monthly electricity consumption in 2017.
Month
True value (kW·h)
Predicted value (kW·h)
Model 1
Model 2
Model 3
The proposed method
1
1442390
1015637
1373173
1367599
1486094
2
845119
949851
1005304
819824
812497
3
685767
769105
649486
602850
701265
4
1229505
896167
1305590
1180485
1267620
5
1060960
1014361
1084692
1118136
1004093
6
1066720
1000885
1121492
1151494
1005170
7
1020280
1015933
1075962
1071765
969470
8
763400
869250
868404
781979
745155
9
653626
737681
706551
656776
678921
10
830280
823047
893032
870825
868556
11
1059400
904942
1306999
1183896
1130486
12
1110200
1000357
1272306
1162874
1133625Figure 9
Prediction graphical results of monthly electricity consumption in 2017.Mean absolute error (MAE), root mean square error (RMSE), relative error, and mean absolute percentage error (MAPE) values were selected to evaluate the performance of the model. The error evaluation of the results of the four prediction methods is shown in Table6, and the minimum error value is marked in bold and italic in Table 6.Table 6
Assessment of monthly electricity consumption forecasting results for 2017.
Month
Model 1
Model 2
Model 3
The proposed method
Relative error (%)
Relative error (%)
Relative error (%)
Relative error (%)
1
−29.59
−4.80
−5.19
3.03
2
12.39
18.95
−2.99
−3.86
3
12.15
−5.29
−12.09
2.26
4
−27.11
6.19
−3.99
3.10
5
−4.39
2.24
5.39
−5.36
6
−6.17
5.13
7.95
−5.77
7
−0.43
5.46
5.05
−4.98
8
13.87
13.75
2.43
−2.39
9
12.86
8.10
0.48
3.87
10
−0.87
7.56
4.88
4.61
11
−14.58
23.37
11.75
6.71
12
−9.89
14.60
4.74
2.11
MAPE
12.03
9.62
5.58
4.00
MAE
127198.42
92195.00
55408.53
39624.48
RMSE
176048.17
111642.10
63829.84
43118.85MAE can reflect the actual situation of the predicted error. The formula of MAE for theith month is as follows:(15)δMAE=1N∑i=1Nδf,i−δt,i.RMSE is more sensitive to outliers. The calculation formula of RMSE for theith month is as follows:(16)δRMSE=1N∑i=1Nδf,i−δt.i2.The relative error can reflect the reliability of the predicted value. MAPE can not only measure the deviation between the predicted value and the actual value but can also consider the ratio between the error and the actual value. The relative error and MAPE of theith month are as follows:(17)δi=δf,i−δt,iδt,i×100%,δMAPE=1N∑i=1Nδi,where δMAE refers to the MAE of the ith month, δRMSE refers to the root mean square error of the ith month, δi refers to the relative error of the ith month, δMAPE refers to the average absolute percentage error of the ith month, and δf,i and δt,i are the predicted electricity consumption and actual electricity consumption of the ith month, respectively.The following conclusions can be drawn based on the evaluation of the prediction results of the four methods:(1)
The relative errors of electricity consumption in 2017 reveal that the errors of the proposed method in most months are less than those of methods 1, 2, and 3. The MAPE, MAE, and RMSE values suggest that the errors of the proposed method are less than those of methods 1, 2, and 3. The forecast results show that the coincidence between the predicted value of the proposed method and the actual value is higher. These results show that the accuracy of the four methods is better than that of methods 1, 2, and 3.(2)
The seasonal component change rate is adjusted by the STL model. The monthly prediction error indicates that the prediction error of the proposed method is less than that of method 3 in January, March, July–August, and November, of which the seasonal components are nonperiodically decomposed. Therefore, the decomposition method of changing the seasonal component change rates for different months of electricity consumption is effective.(3)
Although the proposed method is superior to methods 1, 2, and 3 in general, the prediction error in March and November is still large because the data of seasonal inflection point month have a mutation, and the ARIMA model often has a large error when dealing with abrupt data.(4)
In the process of using the STL model to decompose monthly electricity consumption, although human factors have been avoided as much as possible, some manual intervention and randomness cannot be avoided, as mainly reflected in the parameter setting of the algorithm. The mechanism of the STL model should be further studied.


## 4.1. Decomposition of Monthly Electricity Consumption Based on STL Model

The STL model can control the seasonal component change rate and then change the seasonal component of the sequence. The seasonal component of electricity consumption in the inflection point month and common month can be separated. The season of the same month changes every year, whereas the seasonal fluctuation of electricity consumption in other months decreases because January and February are affected by the Spring Festival and winter vacation, July and August are affected by summer vacation, and March and November are affected by seasonal alternation. Therefore, the seasonal components of January to March, July to August, and November are decomposed non-periodically, and the seasonal components of April to June, September to October, and December are decomposed periodically. The monthly electricity consumption is decomposed by the STL function in R language. The multiplicative model is transformed into the logarithmic additive model by logarithmic transformation because the STL function can only deal with the additive model, that is,(14)Yd=logY=logYtrend×Yseasonal×Yrandom=logYtrend+logYseasonal+logYrandom=Yt+Ys+Yr,where Y is the time series of the original time series; Yd is the time series object obtained by logarithmic transformation of Y; Yt is the trend component; Ys is the season component; and Yr is the random component.Taking March and April as examples, the STL function is used to draw the change curve of the sequence objectYd, and the curve is decomposed into Yt, Ys, and Yr. The change trend of each component is shown in Figure 5. The figure shows that the seasonal component Ys of the seasonal inflection month changes gradually with time, but the seasonal component Ys of the noninflection month changes periodically; Yt has a steady growth trend, and Yr has no development rule.Figure 5
March (a) and April (b) trends of original electricity consumption sequence with its components.
(a)
(b)


## 4.2. Monthly Electricity Consumption Trend Component Prediction Based on EV

Econometric Views or EViews is commonly referred to as an econometric package. It is a time series software specially developed for large organizations to process time series data [30]. A fixed sample size was used for simulation analysis. When power consumption in different months was predicted, the sample changed. For convenient description, the data from January 2010 to December 2016 were used as input for explanation. The specific steps of the improved method of monthly electricity consumption prediction combined with EViews are as follows.


### 4.2.1. Data Decomposition

The GDP of each quarter is divided into months, on average, to obtain the approximate monthly GDP data to ensure that the sample size of the economic factors is consistent with monthly electricity consumption. The monthly GDP data of a city in the north are obtained and decomposed using the X12 model. Proc/Seasonal Adjustment/X12 is used to obtain the trend component data of GDP. The natural logarithm of trend components can be initially obtained, and then the VAR model can be established after data processing to ensure the stability of data. The trend component of GDP is shown in Figure6.Figure 6
GDP trend component curve.


### 4.2.2. Determining the Lag Order

The lag order is represented byp (1≪p≪n, in which n is the sample size). The upper limit of the lag order is set to 12 because the time lag of monetary policy is generally 6–12 months. The trend components of GDP and electricity consumption are opened in the VAR package, the lag/length/criteria are clicked, and the confidence interval of the lag order pops up, as shown in Table 2.Table 2
Confidence interval for the lag order of the VAR model.
Lag
Log L
LR
FPE
AIC
SC
HQ
0
−919.8341
NA
45308.415
25.60650
25.66974
25.63168
1
−519.9274
766.4878
7581.285
14.60910
14.79882
14.68462
2
−392.8206
236.5599
248.1805
11.18946
11.50567
11.31534
3
−322.0301
127.8163
38.84761
9.334168
9.776853
9.510403
4
−304.8392
30.08404
26.96743
8.967755
9.536922
9.194342
5
−295.4543
15.90214
23.27183
8.818175
9.513823
9.095115
6
−293.7491
2.794622
24.88266
8.881920
9.704049
9.209212
7
−277.5902
25.58493
17.82851
8.544173
9.492784
8.921818
8
−273.6755
5.980746
17.97444
8.546543
9.621635
8.974540
9
−273.2689
0.598628
20.00905
8.646359
9.847933
9.124709
10
−266.7881
9.181128
18.85117
8.577448
9.905503
9.106151
11
−257.7192
12.34380
16.56391
8.436645
9.891182
9.015701
12
−255.9084
2.364098
17.84887
8.497456
10.07847
9.126864Table2 shows that when p=11, the evaluation index is the best; thus, the lag order is 11.


### 4.2.3. Exogenous Test of Variables

The VAR model is effective in predicting the interrelated time series variable system. If the variables are not related to each other, then the VAR model [31, 32] is unsuitable. Exogenous tests are conducted on two variables to determine whether GDP changes play a major role in electricity consumption. View/lag structure/Granger causality is clicked, and the exogenous test results pop up, as shown in Table 3. The table shows that if the Prob value is less than 0.05, then no exogeneity is observed, indicating that GDP significantly affects electricity consumption, that is, it has predictive power, and establishing the VAR model is meaningful.Table 3
Exogenous test results.
Excluded
Chi-sq
df
Prob.
GDP_HP
30.56972
11
0.013
All
30.56972
11
0.013
POWER_HP
23.12329
11
0.0170
All
23.12329
11
0.0170
Dependent variable: LNGDP. Dependent variable: GDP_HP.


### 4.2.4. Establishing the VAR Model

The model parameters are estimated. Then, the VAR setting box of GDP and electricity consumption data is opened, the OK button is clicked, and the estimation result window pops up, as shown in Table4.Table 4
VAR parameter estimation results.
LNGDP
POWER_T
GDP_HP(−1)
0.892644
−0.318902
(0.11730)
(0.30656)
[7.61004]
[−1.04026]
GDP_HP(−2)
−0.025358
0.608604
(0.12315)
(0.32184)
[−0.20592]
[1.89100]
POWER_HP(−1)
−0.020718
−0.160956
(0.04430)
(0.11577)
[−0.46773]
[−1.39035]
POWER_HP(−2)
0.005056
0.036296
(0.04195)
(0.10965)
[0.12052]
[0.33102]
C
−0.001664
−0.006855
(0.00618)
(0.01615)
[0.26925]
[0.42438]The first part of the output shows the ordinary least squares (OLS) regression statistics for each equation. The second part of the output shows the regression statistics of the VAR model [33]. “Forecast” on the estimation result interface is clicked, static prediction is selected, and “OK” is clicked to obtain the predicted value of the monthly electricity consumption trend component.


### 4.2.5. Impulse Response

The impulse response is performed to understand the interaction between variables and the degree of influence [34]. Impulse is clicked and set as electricity consumption and GDP, and the response is set as electricity consumption. The impulse response of electricity consumption is shown in Figure 7.Figure 7
Impulse response diagram of power consumption.In the figure, the horizontal axis represents the number of lag periods of impact; the vertical axis represents the growth rate reflecting the trend component of GDP and electricity consumption; the solid line represents the impulse response function, the response degree, and duration of this variable at present and in the future after the impact of one standard deviation of the random error term of other variables; and the dotted line represents the deviation zone of plus or minus two standard deviations [35]. The figure shows that the response of electricity consumption is caused by the change of GDP. At the beginning, the change in GDP greatly affects electricity consumption. However, the impact of impulse gradually declines from the third stage.


## 4.2.1. Data Decomposition

The GDP of each quarter is divided into months, on average, to obtain the approximate monthly GDP data to ensure that the sample size of the economic factors is consistent with monthly electricity consumption. The monthly GDP data of a city in the north are obtained and decomposed using the X12 model. Proc/Seasonal Adjustment/X12 is used to obtain the trend component data of GDP. The natural logarithm of trend components can be initially obtained, and then the VAR model can be established after data processing to ensure the stability of data. The trend component of GDP is shown in Figure6.Figure 6
GDP trend component curve.


## 4.2.2. Determining the Lag Order

The lag order is represented byp (1≪p≪n, in which n is the sample size). The upper limit of the lag order is set to 12 because the time lag of monetary policy is generally 6–12 months. The trend components of GDP and electricity consumption are opened in the VAR package, the lag/length/criteria are clicked, and the confidence interval of the lag order pops up, as shown in Table 2.Table 2
Confidence interval for the lag order of the VAR model.
Lag
Log L
LR
FPE
AIC
SC
HQ
0
−919.8341
NA
45308.415
25.60650
25.66974
25.63168
1
−519.9274
766.4878
7581.285
14.60910
14.79882
14.68462
2
−392.8206
236.5599
248.1805
11.18946
11.50567
11.31534
3
−322.0301
127.8163
38.84761
9.334168
9.776853
9.510403
4
−304.8392
30.08404
26.96743
8.967755
9.536922
9.194342
5
−295.4543
15.90214
23.27183
8.818175
9.513823
9.095115
6
−293.7491
2.794622
24.88266
8.881920
9.704049
9.209212
7
−277.5902
25.58493
17.82851
8.544173
9.492784
8.921818
8
−273.6755
5.980746
17.97444
8.546543
9.621635
8.974540
9
−273.2689
0.598628
20.00905
8.646359
9.847933
9.124709
10
−266.7881
9.181128
18.85117
8.577448
9.905503
9.106151
11
−257.7192
12.34380
16.56391
8.436645
9.891182
9.015701
12
−255.9084
2.364098
17.84887
8.497456
10.07847
9.126864Table2 shows that when p=11, the evaluation index is the best; thus, the lag order is 11.


## 4.2.3. Exogenous Test of Variables

The VAR model is effective in predicting the interrelated time series variable system. If the variables are not related to each other, then the VAR model [31, 32] is unsuitable. Exogenous tests are conducted on two variables to determine whether GDP changes play a major role in electricity consumption. View/lag structure/Granger causality is clicked, and the exogenous test results pop up, as shown in Table 3. The table shows that if the Prob value is less than 0.05, then no exogeneity is observed, indicating that GDP significantly affects electricity consumption, that is, it has predictive power, and establishing the VAR model is meaningful.Table 3
Exogenous test results.
Excluded
Chi-sq
df
Prob.
GDP_HP
30.56972
11
0.013
All
30.56972
11
0.013
POWER_HP
23.12329
11
0.0170
All
23.12329
11
0.0170
Dependent variable: LNGDP. Dependent variable: GDP_HP.


## 4.2.4. Establishing the VAR Model

The model parameters are estimated. Then, the VAR setting box of GDP and electricity consumption data is opened, the OK button is clicked, and the estimation result window pops up, as shown in Table4.Table 4
VAR parameter estimation results.
LNGDP
POWER_T
GDP_HP(−1)
0.892644
−0.318902
(0.11730)
(0.30656)
[7.61004]
[−1.04026]
GDP_HP(−2)
−0.025358
0.608604
(0.12315)
(0.32184)
[−0.20592]
[1.89100]
POWER_HP(−1)
−0.020718
−0.160956
(0.04430)
(0.11577)
[−0.46773]
[−1.39035]
POWER_HP(−2)
0.005056
0.036296
(0.04195)
(0.10965)
[0.12052]
[0.33102]
C
−0.001664
−0.006855
(0.00618)
(0.01615)
[0.26925]
[0.42438]The first part of the output shows the ordinary least squares (OLS) regression statistics for each equation. The second part of the output shows the regression statistics of the VAR model [33]. “Forecast” on the estimation result interface is clicked, static prediction is selected, and “OK” is clicked to obtain the predicted value of the monthly electricity consumption trend component.


## 4.2.5. Impulse Response

The impulse response is performed to understand the interaction between variables and the degree of influence [34]. Impulse is clicked and set as electricity consumption and GDP, and the response is set as electricity consumption. The impulse response of electricity consumption is shown in Figure 7.Figure 7
Impulse response diagram of power consumption.In the figure, the horizontal axis represents the number of lag periods of impact; the vertical axis represents the growth rate reflecting the trend component of GDP and electricity consumption; the solid line represents the impulse response function, the response degree, and duration of this variable at present and in the future after the impact of one standard deviation of the random error term of other variables; and the dotted line represents the deviation zone of plus or minus two standard deviations [35]. The figure shows that the response of electricity consumption is caused by the change of GDP. At the beginning, the change in GDP greatly affects electricity consumption. However, the impact of impulse gradually declines from the third stage.


## 4.3. Monthly Electricity Consumption Using Seasonal Component and Random Component Prediction Based on MATLAB

### 4.3.1. Seasonal Component Prediction

(1)
For months on season stabilization points: historical contemporaneous values were directly taken as the predicted values of seasonal components in the current period.
(2)
For months on season alternation points: the BP neural network is written in MATLAB editor program code to predict the profits in the first 12 months as samples. Thus, the set of 12 input neurons and output neurons is 1. The current monthly electricity consumption is forecasted. Then, the “run” button is clicked, and the simulation results on the normalized prediction data, namely, the electricity consumption forecast of the current month using seasonal cycle components, are obtained. The training process and parameters of the BP neural network are shown in Figure8.Figure 8
Training process of the BP neural network.


### 4.3.2. Random Component Prediction

The predicted value of the random component in the current period is expressed by the average historical value of the random component of the fixed sample size, according to Model 12.


## 4.3.1. Seasonal Component Prediction

(1)
For months on season stabilization points: historical contemporaneous values were directly taken as the predicted values of seasonal components in the current period.
(2)
For months on season alternation points: the BP neural network is written in MATLAB editor program code to predict the profits in the first 12 months as samples. Thus, the set of 12 input neurons and output neurons is 1. The current monthly electricity consumption is forecasted. Then, the “run” button is clicked, and the simulation results on the normalized prediction data, namely, the electricity consumption forecast of the current month using seasonal cycle components, are obtained. The training process and parameters of the BP neural network are shown in Figure8.Figure 8
Training process of the BP neural network.


## 4.3.2. Random Component Prediction

The predicted value of the random component in the current period is expressed by the average historical value of the random component of the fixed sample size, according to Model 12.


## 4.4. Monthly Electricity Consumption Forecasting and Result Analysis

Four models are programmed and analyzed using the combined R language and MATLAB.


### 4.4.1. Model 1

The ARIMA model is established based on the previous change law of electricity consumption in accordance with the time series characteristics of electricity consumption, without considering the influence of many factors, and the monthly electricity consumption are predicted using conventional linear regression.


### 4.4.2. Model 2

The SARIMA model is established to predict the monthly electricity consumption by eliminating the seasonal effects on the series through the seasonal difference method in accordance with the time series characteristics of electricity consumption, considering only the seasonal factors affecting the monthly electricity consumption.


### 4.4.3. Model 3

The monthly electricity consumption series is expressed by the product of three components, which represent the trend, seasonal, and random factors, in accordance with the time series characteristics of electricity consumption, and three components are modeled and predicted by considering the influence of different factors.


### 4.4.4. Proposed Method

The change rate of seasonal components is set, and the time series is customized and decomposed by the STL model in accordance with the time series characteristics of electricity consumption in different months. Three components are predicted considering the influence of different factors.The actual monthly electricity consumption data and forecast results of a university park in 2017 are shown in Table5 and Figure 9.Table 5
Prediction results of monthly electricity consumption in 2017.
Month
True value (kW·h)
Predicted value (kW·h)
Model 1
Model 2
Model 3
The proposed method
1
1442390
1015637
1373173
1367599
1486094
2
845119
949851
1005304
819824
812497
3
685767
769105
649486
602850
701265
4
1229505
896167
1305590
1180485
1267620
5
1060960
1014361
1084692
1118136
1004093
6
1066720
1000885
1121492
1151494
1005170
7
1020280
1015933
1075962
1071765
969470
8
763400
869250
868404
781979
745155
9
653626
737681
706551
656776
678921
10
830280
823047
893032
870825
868556
11
1059400
904942
1306999
1183896
1130486
12
1110200
1000357
1272306
1162874
1133625Figure 9
Prediction graphical results of monthly electricity consumption in 2017.Mean absolute error (MAE), root mean square error (RMSE), relative error, and mean absolute percentage error (MAPE) values were selected to evaluate the performance of the model. The error evaluation of the results of the four prediction methods is shown in Table6, and the minimum error value is marked in bold and italic in Table 6.Table 6
Assessment of monthly electricity consumption forecasting results for 2017.
Month
Model 1
Model 2
Model 3
The proposed method
Relative error (%)
Relative error (%)
Relative error (%)
Relative error (%)
1
−29.59
−4.80
−5.19
3.03
2
12.39
18.95
−2.99
−3.86
3
12.15
−5.29
−12.09
2.26
4
−27.11
6.19
−3.99
3.10
5
−4.39
2.24
5.39
−5.36
6
−6.17
5.13
7.95
−5.77
7
−0.43
5.46
5.05
−4.98
8
13.87
13.75
2.43
−2.39
9
12.86
8.10
0.48
3.87
10
−0.87
7.56
4.88
4.61
11
−14.58
23.37
11.75
6.71
12
−9.89
14.60
4.74
2.11
MAPE
12.03
9.62
5.58
4.00
MAE
127198.42
92195.00
55408.53
39624.48
RMSE
176048.17
111642.10
63829.84
43118.85MAE can reflect the actual situation of the predicted error. The formula of MAE for theith month is as follows:(15)δMAE=1N∑i=1Nδf,i−δt,i.RMSE is more sensitive to outliers. The calculation formula of RMSE for theith month is as follows:(16)δRMSE=1N∑i=1Nδf,i−δt.i2.The relative error can reflect the reliability of the predicted value. MAPE can not only measure the deviation between the predicted value and the actual value but can also consider the ratio between the error and the actual value. The relative error and MAPE of theith month are as follows:(17)δi=δf,i−δt,iδt,i×100%,δMAPE=1N∑i=1Nδi,where δMAE refers to the MAE of the ith month, δRMSE refers to the root mean square error of the ith month, δi refers to the relative error of the ith month, δMAPE refers to the average absolute percentage error of the ith month, and δf,i and δt,i are the predicted electricity consumption and actual electricity consumption of the ith month, respectively.The following conclusions can be drawn based on the evaluation of the prediction results of the four methods:(1)
The relative errors of electricity consumption in 2017 reveal that the errors of the proposed method in most months are less than those of methods 1, 2, and 3. The MAPE, MAE, and RMSE values suggest that the errors of the proposed method are less than those of methods 1, 2, and 3. The forecast results show that the coincidence between the predicted value of the proposed method and the actual value is higher. These results show that the accuracy of the four methods is better than that of methods 1, 2, and 3.(2)
The seasonal component change rate is adjusted by the STL model. The monthly prediction error indicates that the prediction error of the proposed method is less than that of method 3 in January, March, July–August, and November, of which the seasonal components are nonperiodically decomposed. Therefore, the decomposition method of changing the seasonal component change rates for different months of electricity consumption is effective.(3)
Although the proposed method is superior to methods 1, 2, and 3 in general, the prediction error in March and November is still large because the data of seasonal inflection point month have a mutation, and the ARIMA model often has a large error when dealing with abrupt data.(4)
In the process of using the STL model to decompose monthly electricity consumption, although human factors have been avoided as much as possible, some manual intervention and randomness cannot be avoided, as mainly reflected in the parameter setting of the algorithm. The mechanism of the STL model should be further studied.


## 4.4.1. Model 1

The ARIMA model is established based on the previous change law of electricity consumption in accordance with the time series characteristics of electricity consumption, without considering the influence of many factors, and the monthly electricity consumption are predicted using conventional linear regression.


## 4.4.2. Model 2

The SARIMA model is established to predict the monthly electricity consumption by eliminating the seasonal effects on the series through the seasonal difference method in accordance with the time series characteristics of electricity consumption, considering only the seasonal factors affecting the monthly electricity consumption.


## 4.4.3. Model 3

The monthly electricity consumption series is expressed by the product of three components, which represent the trend, seasonal, and random factors, in accordance with the time series characteristics of electricity consumption, and three components are modeled and predicted by considering the influence of different factors.


## 4.4.4. Proposed Method

The change rate of seasonal components is set, and the time series is customized and decomposed by the STL model in accordance with the time series characteristics of electricity consumption in different months. Three components are predicted considering the influence of different factors.The actual monthly electricity consumption data and forecast results of a university park in 2017 are shown in Table5 and Figure 9.Table 5
Prediction results of monthly electricity consumption in 2017.
Month
True value (kW·h)
Predicted value (kW·h)
Model 1
Model 2
Model 3
The proposed method
1
1442390
1015637
1373173
1367599
1486094
2
845119
949851
1005304
819824
812497
3
685767
769105
649486
602850
701265
4
1229505
896167
1305590
1180485
1267620
5
1060960
1014361
1084692
1118136
1004093
6
1066720
1000885
1121492
1151494
1005170
7
1020280
1015933
1075962
1071765
969470
8
763400
869250
868404
781979
745155
9
653626
737681
706551
656776
678921
10
830280
823047
893032
870825
868556
11
1059400
904942
1306999
1183896
1130486
12
1110200
1000357
1272306
1162874
1133625Figure 9
Prediction graphical results of monthly electricity consumption in 2017.Mean absolute error (MAE), root mean square error (RMSE), relative error, and mean absolute percentage error (MAPE) values were selected to evaluate the performance of the model. The error evaluation of the results of the four prediction methods is shown in Table6, and the minimum error value is marked in bold and italic in Table 6.Table 6
Assessment of monthly electricity consumption forecasting results for 2017.
Month
Model 1
Model 2
Model 3
The proposed method
Relative error (%)
Relative error (%)
Relative error (%)
Relative error (%)
1
−29.59
−4.80
−5.19
3.03
2
12.39
18.95
−2.99
−3.86
3
12.15
−5.29
−12.09
2.26
4
−27.11
6.19
−3.99
3.10
5
−4.39
2.24
5.39
−5.36
6
−6.17
5.13
7.95
−5.77
7
−0.43
5.46
5.05
−4.98
8
13.87
13.75
2.43
−2.39
9
12.86
8.10
0.48
3.87
10
−0.87
7.56
4.88
4.61
11
−14.58
23.37
11.75
6.71
12
−9.89
14.60
4.74
2.11
MAPE
12.03
9.62
5.58
4.00
MAE
127198.42
92195.00
55408.53
39624.48
RMSE
176048.17
111642.10
63829.84
43118.85MAE can reflect the actual situation of the predicted error. The formula of MAE for theith month is as follows:(15)δMAE=1N∑i=1Nδf,i−δt,i.RMSE is more sensitive to outliers. The calculation formula of RMSE for theith month is as follows:(16)δRMSE=1N∑i=1Nδf,i−δt.i2.The relative error can reflect the reliability of the predicted value. MAPE can not only measure the deviation between the predicted value and the actual value but can also consider the ratio between the error and the actual value. The relative error and MAPE of theith month are as follows:(17)δi=δf,i−δt,iδt,i×100%,δMAPE=1N∑i=1Nδi,where δMAE refers to the MAE of the ith month, δRMSE refers to the root mean square error of the ith month, δi refers to the relative error of the ith month, δMAPE refers to the average absolute percentage error of the ith month, and δf,i and δt,i are the predicted electricity consumption and actual electricity consumption of the ith month, respectively.The following conclusions can be drawn based on the evaluation of the prediction results of the four methods:(1)
The relative errors of electricity consumption in 2017 reveal that the errors of the proposed method in most months are less than those of methods 1, 2, and 3. The MAPE, MAE, and RMSE values suggest that the errors of the proposed method are less than those of methods 1, 2, and 3. The forecast results show that the coincidence between the predicted value of the proposed method and the actual value is higher. These results show that the accuracy of the four methods is better than that of methods 1, 2, and 3.(2)
The seasonal component change rate is adjusted by the STL model. The monthly prediction error indicates that the prediction error of the proposed method is less than that of method 3 in January, March, July–August, and November, of which the seasonal components are nonperiodically decomposed. Therefore, the decomposition method of changing the seasonal component change rates for different months of electricity consumption is effective.(3)
Although the proposed method is superior to methods 1, 2, and 3 in general, the prediction error in March and November is still large because the data of seasonal inflection point month have a mutation, and the ARIMA model often has a large error when dealing with abrupt data.(4)
In the process of using the STL model to decompose monthly electricity consumption, although human factors have been avoided as much as possible, some manual intervention and randomness cannot be avoided, as mainly reflected in the parameter setting of the algorithm. The mechanism of the STL model should be further studied.


## 5. Discussion

The proposed forecasting method by combining STL and ARIMA models has achieved better performance in comparison with other classical forecasting methods, according to results of the studied sample. This improvement is also attributed to decomposition strategy that has been applied, i.e., decomposition of periodic and nonperiodic seasonal components using the STL model. However, some limitations of the proposed method do exist; meanwhile, there may be solutions that can further improve the performance of forecasting. For instance, taking into account more human-related factors may improve the results. Examples of these factors are energy users’ preference on comfortable temperature range related to air-conditioning devices and their charging habits related to electric vehicles. In other words, developing a more detailed classification of electricity load categories and corresponding human behavior models may be a possible way to improve our work, although this requires a well-developed metering infrastructure and a much larger amount of data samples.The effectiveness of using economic variables like the GDP to support monthly energy demand forecast has also been demonstrated by this study. Considering the fact that only few countries and/or regions publish their GDP on a monthly basis, utilizing other monthly economic factors, such as relative strength index or consumer price index may also be able to improve the performance. However, before an economic factor is applied, it would be necessary to study the correlation between it and the monthly energy demand to ensure the strong correlation in both direction and strength.


## 6. Conclusion

Following the rapid development of integrated energy systems, forecasting electricity consumption will become a key component for enabling proactive energy system planning, smart operation, accurate billing, new business related to electricity trading, etc.When forecasting monthly electricity consumption, most methods directly model and predict the time series of historical data. However, in the actual forecasting process, the time series of the monthly power sales often contains components with different characteristics. A new method for predicting monthly power sales is proposed based on the analysis of the factors that affect the time series. The proposed method combines the STL and ARIMA models into one framework solution. Its applicability and accuracy are verified by a case study using practical time series monthly energy consumption data and quarterly GDP values related to an integrated energy system. Because it provides better accuracy than other existing methods, the potential use of this method in forecasting the energy demand of integrated energy systems is high.



---

*Source: 9012543-2019-10-03.xml*