Forecasting next-day electricity demand and price using nonparametric functional methods

8
Forecasting next-day electricity demand and price using nonparametric functional methods Juan M. Vilar, Ricardo Cao, Germán Aneiros Departamento de Matemáticas, Facultad de Informática, Universidad de A Coruña, Campus de Elviña, s/n, 15071 A Coruña, Spain article info Article history: Received 7 September 2010 Received in revised form 29 December 2011 Accepted 12 January 2012 Available online 25 February 2012 Keywords: Demand and price Electricity markets Functional data Time series forecasting abstract One-day-ahead forecasting of electricity demand and price is an important issue in competitive electric power markets. Prediction task has been studied in previous works using, for instance, ARIMA models, dynamic regression and neural networks. This paper provides two new methods to address these two prediction setups. They are based on using nonparametric regression techniques with functional explan- atory data and a semi-functional partial linear model. Results of these methods for the electricity market of mainland Spain, in years 2008–2009, are reported. The new forecasting functional methods are com- pared with a naïve method and with ARIMA forecasts. Ó 2012 Elsevier Ltd. All rights reserved. 1. Introduction Nowadays, in many countries all over the world, the production and sale of electricity is traded under competitive rules in free markets. The agents involved in this market, namely, system oper- ators, regulatory agencies, producers and consumers, have a great interest in the study of electricity load and price. Since electricity cannot be stored, the demand must be satisfied instantaneously and producers need to anticipate to future demands to avoid over- production. Good forecasting of electricity demand is then very important for the agents in the market. In the past, demand was predicted in centralized markets [1] but competition has opened a new field of study. On the other hand, if producers and consum- ers have reliable predictions of electricity price, they can develop their bidding strategies and establish a pool bidding technique to achieve a maximum benefit. Consequently, prediction of electricity demand and price are significant problems in this sector. In de- mand and price prediction two types of forecasts are considered: short term forecasts, this is 1 day ahead hourly forecasts, and mid term forecasts, i.e. several days ahead predictions for daily data. In most of electricity markets the series of demand and prices present the following features. They have non-constant mean and variance. Superimposed levels of seasonality, in particular, dai- ly and weekly seasonality, are present in these series. Price and de- mand series exhibit short-term dynamics and special days (calendar effect on weekend and holidays). These series incorpo- rate nonlinear effects of meteorological variables, especially tem- perature. Outliers are also present. Usually, the price series is more volatile than the demand series. The price series also pre- sents more outliers, mainly in periods of high demand. The previ- ous features imply that finding an adequate fit for these series is a complex problem. This paper focuses on next day forecasting of electricity demand and price. Therefore, for each day of the week, 24 forecasts (of de- mand or price) need to be computed. Plenty of algorithms have been developed for short term demand prediction. Two different statistical strategies have been used to this aim. The first one con- sists in building a single model to derive the load profile, see [2,3]. The second approach provides 24 different models to compute 1 day ahead hourly predictions, using, for each hour, a different time series, see [4,5]. In some papers the temperature is incorpo- rated as an explanatory variable in the model [6]. Artificial neural networks have been also used in this context [7,8]. Usually short term time dependence is assumed to be generated by an ARMA process, see [9]. This idea is exploited by Cancelo et al. [9] to pres- ent a complex model used by Red Eléctrica de España (REE), the Spanish system operator. Price forecasting techniques in power systems are relatively recent procedures. Most papers are focused on computing 1-day-ahead forecasting. Dynamic regression and transfer functions [10] have been used in this context. ARIMA models for price forecasting in the Spanish market have been also studied, see [11–13]. Serinaldi [14] modeled the dynamically varying distri- bution of prices by means of generalized additive models for loca- tion, scale and shape, and Weron and Misiorek [15] compared the 0142-0615/$ - see front matter Ó 2012 Elsevier Ltd. All rights reserved. doi:10.1016/j.ijepes.2012.01.004 Corresponding author. E-mail addresses: [email protected] (J.M. Vilar), [email protected] (R. Cao), ganeiros@ udc.es (G. Aneiros). Electrical Power and Energy Systems 39 (2012) 48–55 Contents lists available at SciVerse ScienceDirect Electrical Power and Energy Systems journal homepage: www.elsevier.com/locate/ijepes

Transcript of Forecasting next-day electricity demand and price using nonparametric functional methods

Page 1: Forecasting next-day electricity demand and price using nonparametric functional methods

Electrical Power and Energy Systems 39 (2012) 48–55

Contents lists available at SciVerse ScienceDirect

Electrical Power and Energy Systems

journal homepage: www.elsevier .com/locate / i jepes

Forecasting next-day electricity demand and price using nonparametricfunctional methods

Juan M. Vilar, Ricardo Cao, Germán Aneiros ⇑Departamento de Matemáticas, Facultad de Informática, Universidad de A Coruña, Campus de Elviña, s/n, 15071 A Coruña, Spain

a r t i c l e i n f o

Article history:Received 7 September 2010Received in revised form 29 December 2011Accepted 12 January 2012Available online 25 February 2012

Keywords:Demand and priceElectricity marketsFunctional dataTime series forecasting

0142-0615/$ - see front matter � 2012 Elsevier Ltd. Adoi:10.1016/j.ijepes.2012.01.004

⇑ Corresponding author.E-mail addresses: [email protected] (J.M. Vilar), rcao

udc.es (G. Aneiros).

a b s t r a c t

One-day-ahead forecasting of electricity demand and price is an important issue in competitive electricpower markets. Prediction task has been studied in previous works using, for instance, ARIMA models,dynamic regression and neural networks. This paper provides two new methods to address these twoprediction setups. They are based on using nonparametric regression techniques with functional explan-atory data and a semi-functional partial linear model. Results of these methods for the electricity marketof mainland Spain, in years 2008–2009, are reported. The new forecasting functional methods are com-pared with a naïve method and with ARIMA forecasts.

� 2012 Elsevier Ltd. All rights reserved.

1. Introduction

Nowadays, in many countries all over the world, the productionand sale of electricity is traded under competitive rules in freemarkets. The agents involved in this market, namely, system oper-ators, regulatory agencies, producers and consumers, have a greatinterest in the study of electricity load and price. Since electricitycannot be stored, the demand must be satisfied instantaneouslyand producers need to anticipate to future demands to avoid over-production. Good forecasting of electricity demand is then veryimportant for the agents in the market. In the past, demand waspredicted in centralized markets [1] but competition has openeda new field of study. On the other hand, if producers and consum-ers have reliable predictions of electricity price, they can developtheir bidding strategies and establish a pool bidding technique toachieve a maximum benefit. Consequently, prediction of electricitydemand and price are significant problems in this sector. In de-mand and price prediction two types of forecasts are considered:short term forecasts, this is 1 day ahead hourly forecasts, andmid term forecasts, i.e. several days ahead predictions for dailydata.

In most of electricity markets the series of demand and pricespresent the following features. They have non-constant meanand variance. Superimposed levels of seasonality, in particular, dai-ly and weekly seasonality, are present in these series. Price and de-mand series exhibit short-term dynamics and special days

ll rights reserved.

@udc.es (R. Cao), ganeiros@

(calendar effect on weekend and holidays). These series incorpo-rate nonlinear effects of meteorological variables, especially tem-perature. Outliers are also present. Usually, the price series ismore volatile than the demand series. The price series also pre-sents more outliers, mainly in periods of high demand. The previ-ous features imply that finding an adequate fit for these series is acomplex problem.

This paper focuses on next day forecasting of electricity demandand price. Therefore, for each day of the week, 24 forecasts (of de-mand or price) need to be computed. Plenty of algorithms havebeen developed for short term demand prediction. Two differentstatistical strategies have been used to this aim. The first one con-sists in building a single model to derive the load profile, see [2,3].The second approach provides 24 different models to compute1 day ahead hourly predictions, using, for each hour, a differenttime series, see [4,5]. In some papers the temperature is incorpo-rated as an explanatory variable in the model [6]. Artificial neuralnetworks have been also used in this context [7,8]. Usually shortterm time dependence is assumed to be generated by an ARMAprocess, see [9]. This idea is exploited by Cancelo et al. [9] to pres-ent a complex model used by Red Eléctrica de España (REE), theSpanish system operator.

Price forecasting techniques in power systems are relativelyrecent procedures. Most papers are focused on computing1-day-ahead forecasting. Dynamic regression and transferfunctions [10] have been used in this context. ARIMA models forprice forecasting in the Spanish market have been also studied,see [11–13]. Serinaldi [14] modeled the dynamically varying distri-bution of prices by means of generalized additive models for loca-tion, scale and shape, and Weron and Misiorek [15] compared the

Page 2: Forecasting next-day electricity demand and price using nonparametric functional methods

J.M. Vilar et al. / Electrical Power and Energy Systems 39 (2012) 48–55 49

accuracy of 12 time series methods for short-term spot price fore-casting. Jump diffusion/mean reversion models [16] and fuzzyregression [17] have been also applied to model electricity prices.Artificial neural networks have been used to forecast electricityprices too. Some relevant works in this field include [18–22]. Con-ejo et al. [23] compared several methods, including ARIMA models,neural networks and wavelet approximation, for price forecasting.In a recent paper [24] the main methodologies used in electricityprice forecasting are reviewed. Prediction of electricity demandand price has been widely studied in the book by Weron [25].

This paper proposes functional nonparametric and semi-func-tional partial linear models to forecast electricity demand andprice. Nonparametric regression estimation under dependence isa useful tool for forecasting time series. Some relevant works inthis field include [26–28]. Other papers more specifically focusedon prediction using nonparametric techniques are [29–31]. Theliterature on methods for time series prediction in the contextof functional data is much more limited. The books [32,33] arecomprehensive references for linear and nonparametric func-tional data analysis, respectively. A functional wavelet-kernel ap-proach for time series prediction has been also proposed, see[34]. Aneiros-Pérez and Vieu [35] dealt with the problem of non-parametric time series prediction using a semi-functional partiallinear model. Nadaraya–Watson and local linear methods forfunctional data have been also used in the problem of time seriesprediction [36].

The approach in this paper uses functional data methods to takeinto account the daily seasonality of the electricity demand andprice series. Nonparametric regression estimation methods areused to forecast these series. The idea is to cut the observed timeseries into a sample of functional trajectories and to incorporatein the model just a single past functional observation (last day tra-jectory) rather than multiple past time series values. A functionalversion of the partial linear model has been considered in orderto incorporate vector covariates in the forecasting procedure. Asa consequence, this approach allows both to consider additionalexplanatory covariates and to use continuous past paths to predictfuture values. This method is applied in short-term forecasting ofelectricity demand and price in the market of mainland Spain. Thisis an area of almost 500,000 square kilometers, with more than 45million people.

The remaining of this paper is organized as follows. In Section 2,a mathematical description of the functional nonparametric modeland the semi-functional partial linear model is given. The accuracymeasures and the tuning parameters used in this paper are pre-sented in Section 3. Section 4 shows numerical results concerning1-day ahead forecasting of electricity demand in mainland Spain. Acomparative study of the proposed models and some classicalmethods is also included in this section. Section 5 presents a sim-ilar study concerning the problem of electricity price forecasting.Finally, Section 6 provides some relevant conclusions.

2. Functional models

Functional data analysis is a branch of statistics that analyzesdata providing information about curves, surfaces or any othermathematical object varying over a continuum. The continuum isoften time, but may also be spatial location, wavelength, etc. Thesecurves are defined by some functional form. In particular, func-tional data analyses often make use of the information in theslopes and curvatures of curves, as reflected in their derivatives.Plots of first and second derivatives as functions of time, or plotsof second derivative values as functions of first derivative values,may reveal important aspects of the processes generating the data.As a consequence, curve estimation methods designed to yield

good derivative estimates can play a critical role in functional dataanalysis.

Models for functional data and methods for their analysis mayresemble those for conventional multivariate data, including linearand nonlinear regression models, principal components analysis,and many others. But the possibility of using derivative informa-tion greatly extends the power of these methods, and also leadsto purely functional models such as those defined by differentialequations.

The books [37,38] are nice general references for functional dataanalysis using a linear view. Due to the nature of the data, nonpara-metric smoothing methods are also useful tools for functional dataanalysis. The book [33] is devoted to nonparametric methods in thefunctional data context. This is the approach followed in this paper.In the following subsections we will present the functional non-parametric model and the semi-functional partial linear modelused for demand and price forecasting.

2.1. Functional nonparametric model

The time series of interest (electricity demand or price) will beconsidered as discrete time realizations of a continuous time sto-chastic process, {v(t)}t2R, observed for t 2 [a, b). We first focus onpredicting v(b + r), for some r P 0. Let us assume that v(t) is a sea-sonal process, with seasonal length s and b = a + (n + 1)s. In otherwords, we assume that the interval [a, b) consists of n + 1 seasonalperiods of length s of the stochastic process {v(t)}t2R. In our appli-cation the seasonal length, s, will be 1 day and n + 1 will be thenumber of days in the data set.

For simplicity we will assume the following Markov propertyfor the process {v(t)}t2R:

vðbþ rÞjfvðtÞ;t2½a;bÞg ¼d vðbþ rÞjfvðtÞ;t2½b�s;bÞg: ð1Þ

Eq. (1) states that the probability distribution of a future valueof the process given the whole past only depends on the processvalues at the last observed seasonal interval.

We define the functional data fvignþ1i¼1 in terms of the continuous

time stochastic process:

viðtÞ ¼ vðaþ ði� 1Þsþ tÞ; with t 2 C ¼ ½0; sÞ:

We may look at the problem of predicting the future valuev(b + r) (for some r 2 C) by computing nonparametric estimations,m̂ðvÞ, of the autoregression function in the functional nonparamet-ric (FNP) model

viþ1ðrÞ ¼ mðviÞ þ eiþ1; i ¼ 1; . . . ;n: ð2Þ

Eq. (2) assumes that the values of the series at instant r in a sea-sonal interval is an unknown nonparametric function of the seriesat the whole previous seasonal interval plus some error term. Thus,m̂ðvnþ1Þ gives a functional forecast for v(b + r).

In our context this approach consists on estimating the autore-gression functional, m, using full-day demand or price values andapply this estimated functional to the last observed day.

Whereas the Euclidean norm is a standard distance measure infinite dimensional spaces, the notion of seminorm or semimetricarises in this infinite-dimensional functional setup. Let us denoteby H ¼ ff : C ! Rg the space where the functional data live andby d(�, �) a semimetric associated with H. Thus (H; d) is a semimet-ric space (see the book [33] for details).

A Nadaraya–Watson type estimator for m in (2) is defined as

m̂FNPh ðvÞ ¼

Xn

i¼1

whðv;viÞviþ1ðrÞ; ð3Þ

where the bandwidth h > 0 is a smoothing parameter,

Page 3: Forecasting next-day electricity demand and price using nonparametric functional methods

Time

Dem

and

(MW

h)

0 300 600 900 12001500

022

500

3000

0

Fig. 1. Historical data (left of the vertical dashed line) and data to be predicted(right of the vertical dashed line) corresponding to the electricity demand for anAutumn week (November 17–23).

5 10 15 20

-400

00

4000

Hour

MW

h

Fig. 2. Functional data (daily curves) for the differenciated electricity demand.

Table 1Relative daily and seasonal forecasting errors (%) for the electricity demand.

DE SE

Mon Tue Wed Thu Fri Sat Sun

SummerNAÏVE 4.01 2.96 1.86 1.74 1.92 3.75 3.35 2.71ARIMA 2.72 2.63 2.41 2.42 2.40 2.95 2.51 2.55FNP-D 2.97 3.70 2.67 3.43 2.44 5.69 1.88 3.04FNP-R 2.96 3.96 2.91 2.94 2.44 6.23 2.10 3.08SFPL-D 2.65 2.76 2.05 3.66 2.90 2.85 2.34 2.78SFPL-R 2.48 3.50 1.87 2.73 2.75 2.71 2.17 2.59

AutumnNAÏVE 4.64 3.30 2.64 1.89 2.39 4.78 4.09 3.21ARIMA 2.85 3.93 3.57 2.68 2.99 3.64 3.48 3.27FNP-D 4.64 4.72 2.98 2.73 2.99 9.35 4.46 4.15FNP-R 4.32 3.55 2.59 2.95 2.74 10.84 3.26 3.82SFPL-D 3.38 3.39 3.70 3.01 2.88 4.14 4.47 3.50SFPL-R 3.11 3.03 3.20 3.21 2.75 3.90 3.63 3.21

WinterNAÏVE 6.26 2.91 3.41 3.86 3.60 5.61 6.26 4.56ARIMA 3.60 3.56 4.42 4.75 4.22 5.95 3.98 4.27FNP-D 3.05 4.31 4.07 3.22 4.01 6.05 3.04 3.86FNP-R 3.03 3.15 2.58 3.16 4.00 5.83 3.05 3.44SFPL-D 3.50 4.38 3.07 3.33 3.73 4.25 2.85 3.55SFPL-R 3.39 3.38 2.89 3.76 3.32 4.15 3.20 3.41

SpringNAÏVE 4.75 4.03 2.56 2.86 1.93 4.71 6.22 3.77ARIMA 5.24 4.78 3.52 4.45 2.86 3.97 4.42 4.14FNP-D 9.53 4.73 4.19 4.34 3.30 9.73 5.15 5.51FNP-R 8.04 3.92 3.22 3.78 2.85 10.26 3.43 4.69SFPL-D 4.68 3.96 3.70 3.69 3.63 5.47 3.27 3.96SFPL-R 5.01 3.16 2.85 3.01 2.80 6.14 3.50 3.61

50 J.M. Vilar et al. / Electrical Power and Energy Systems 39 (2012) 48–55

whðv;viÞ ¼Kðdðv;viÞ=hÞPnj¼1Kðdðv;vjÞ=hÞ

;

and the kernel function K:[0, 1) ? [0, 1) is typically a probabilitydensity function chosen by the user.

The choice of the kernel function is of secondary importance.However, both the bandwidth and the semimetric are relevant as-pects for the good asymptotic and practical behavior of (3).

A key role of the semimetric is that related to the so called‘‘curse of dimensionality’’. From a practical point of view the ‘‘curseof dimensionality’’ can be explained as the sparseness of data in theobservation region as the dimension of the data space grows. Thisproblem is specially dramatic in the infinite-dimensional contextof functional data. Ferraty and Vieu [33] have proven that it is pos-sible to construct a semimetric in such a way that the rate of con-vergence of the nonparametric estimator in the functional settingis similar to that of the finite-dimensional one. It is important to re-mark that we use a semimetric rather than a metric. Indeed, the‘‘curse of dimensionality’’ would appear if a metric were used in-stead of a semimetric.

In functional data it is usual to consider semimetrics based onseminorms. Thus, [33] recommend, for smooth functional data,to take as seminorm the L2 norm of some qth derivative of thefunction. For the case of rough data curves, these authors suggestto construct a seminorm based on the first q functional principalcomponents of the data curves.

2.2. Semi-functional partial linear model

Very often there exist exogenous scalar variables that may beuseful to improve the forecast. In many of these situations, previ-

Summer Autumn Winter Spring

010

2030

40

Hou

rly e

rror

s (%

)

NAÏVEARIMASFPL-R

Fig. 3. Hourly errors for the electricity demand corresponding to naïve, ARIMA andthe recursive version of semi-functional partial linear models.

0 50 100 150

1500

022

500

3000

0

Time

Dem

and

(MW

h)

NAÏVEARIMASFPL-R

Fig. 4. Actual demand (thick black lines) and predicted values using the naïve,ARIMA and the recursive version of the semi-functional partial linear model for anAutumn week (November 17–23).

Page 4: Forecasting next-day electricity demand and price using nonparametric functional methods

0 50 100 150

1500

022

500

3000

0

1500

022

500

3000

015

000

2250

030

000

1500

022

500

3000

0

Time

Dem

and

(MW

h)

(a)

0 50 100 150Time

Dem

and

(MW

h)

(b)

Time

Dem

and

(MW

h)

(c)

0 50 100 1500 50 100 150Time

Dem

and

(MW

h)

(d)Fig. 5. Actual demand (black lines) and predicted values (gray lines) using the recursive version of the semi-functional partial linear model for the weeks: (a) August 18–24,(b) November 17–23, (c) February 16–22, and (d) May 18–24.

J.M. Vilar et al. / Electrical Power and Energy Systems 39 (2012) 48–55 51

ous experience also suggests that an additive linear effect of thesevariables on the values to forecast might occur. In such setups, itseems natural to generalize model (2) by incorporating a linearcomponent. This gives the semi-functional partial linear (SFPL)model:

viþ1ðrÞ ¼ xTiþ1bþmðviÞ þ eiþ1; i ¼ 1; . . . ; n; ð4Þ

where xi = (xi1, . . . , xip)T 2 Rp is a vector of exogenous scalar covari-ates and b = (b1, . . . , bp)T 2 Rp is a vector of unknown parameters tobe estimated.

Now, based on the SFPL model, we may look at the problem ofpredicting v(b + r) (for some r 2 C) by computing estimations b̂ andm̂ðvÞ of b and m(v) in (4), respectively. Thus, xT

nþ2b̂þ m̂ðvnþ1Þ givesthe forecast for v(b + r).

An estimator for b based on kernel and ordinary least squaresideas was proposed in [39] in the setting of independent data.More specifically, recall the weights wh(v, vi) defined in the previ-

ous subsection and denote eXh ¼ ðI�WhÞX and ~vh ¼ ðI�WhÞv,with Wh ¼ ðwhðvi;vjÞÞ16i;j6n;X ¼ ðxijÞ16i6n

16j6pand v = (v2(r), . . . ,

vn+1(r))T, the estimator for b is defined by

bbh ¼ ðeXTheXhÞ�1 eXT

h~vh: ð5Þ

It should be noted that bbh is the ordinary least squares estima-tor obtained when the vector of response variables, evh, is linearlylinked with the matrix of covariates eXh. It is worth mentioning thatkernel estimation is used to obtain both evh and eXh. Actually, bothterms are computed as some nonparametric residuals.

Finally, nonparametric estimation is used again to construct theestimator for m(v) in (4)

m̂SFPLh ðvÞ ¼

Xn

i¼1

whðv;viÞ viþ1ðrÞ � xTiþ1b̂h

� �: ð6Þ

Rates of convergence of the estimators (5) and (6) in a setting ofindependent data were obtained in [39]. Recently, [35] gave condi-tions under which those rates hold for time series. It is interestingto note that b̂h is a

ffiffiffinp

-consistent estimator of b. It is also worthmentioning that the rate of convergence of m̂SFPL

h ðvÞ is the sameas that of m̂FNP

h ðvÞ.Other estimators for m in (2) (and therefore for b and m(v) in

(4)) could be obtained by means of wavelet-kernel approaches[34] or local linear functional procedures [36].

3. Prediction accuracy and tuning parameters

Our goal is forecasting next-day electricity demand and electric-ity prices using several functional models and nonparametric tech-niques. We will obtain one prediction for each hour in the day. Topresent a complete study, we predict all the days in Summer2008, Autumn 2008, Winter 2009 and Spring 2009 (365 days).

The accuracy of each model and forecast considered is mea-sured using daily and seasonal errors. The daily errors (DEs) are de-fined by

DEj ¼1Ij

124

XIj

i¼1

X24

r¼1

ei;j;r; j ¼ 1; . . . ;7;

where ‘‘Ij’’ is the number of weeks containing the jth day, ei,j,r de-notes the hourly relative percentage error

ei;j;r ¼ 100� jVi;jðrÞ � bV i;jðrÞjVi;jðrÞ

;

Page 5: Forecasting next-day electricity demand and price using nonparametric functional methods

Time

Pric

e (

/MW

h)

0 300 600 900 1200

46

810

Fig. 6. Historical data (left of the vertical dashed line) and data to be predicted(right of the vertical dashed line) corresponding to the electricity prices for anAutumn week (November 17–23).

5 10 15 20

34

56

78

910

Hour

/MW

h

Fig. 7. Pruned curves from the electricity price data.

Table 3Relative daily and seasonal forecasting errors (%) for the electricity price (2009).

DE SE

Mon Tue Wed Thu Fri Sat Sun

WinterNAÏVE 12.87 8.73 10.28 8.58 10.59 15.96 12.91 11.37ARIMA 10.59 10.44 11.10 11.49 11.52 12.98 13.49 11.64FNP-D 14.61 10.56 9.05 11.84 11.14 12.39 15.59 12.16FNP-R 12.69 10.44 9.67 11.99 11.58 14.00 15.54 12.25FNP-D-P 12.97 11.30 9.17 11.80 11.26 13.62 16.30 12.33FNP-R-P 12.27 10.35 9.83 11.18 11.15 13.63 16.34 12.09SFPL-D 11.09 10.47 9.56 12.05 10.87 11.17 13.90 11.30SFPL-R 10.36 9.64 9.67 10.91 10.99 12.06 13.10 10.95SFPL-D-P 10.59 10.26 9.27 11.43 10.44 11.98 13.61 11.07SFPL-R-P 10.60 9.24 9.58 10.51 11.00 11.99 12.33 10.73

SpringNAÏVE 8.82 6.85 6.48 7.02 7.44 9.74 10.81 8.18ARIMA 7.74 7.09 7.96 6.83 8.04 8.22 9.97 7.98FNP-D 10.41 7.82 7.40 7.03 7.62 9.16 13.38 8.97FNP-R 12.14 7.40 7.08 6.99 7.72 9.35 13.06 9.10FNP-D-P 10.47 7.44 7.23 7.66 7.63 9.50 12.80 8.96FNP-R-P 12.20 7.21 7.04 6.28 6.90 9.36 13.03 8.86SFPL-D 8.49 6.76 7.14 6.84 8.01 8.09 9.42 7.82SFPL-R 7.82 6.37 6.57 6.66 7.75 7.24 8.60 7.29SFPL-D-P 8.31 6.78 6.67 6.58 7.93 8.01 8.87 7.59SFPL-R-P 7.32 6.50 6.18 6.33 7.85 7.15 9.23 7.22

52 J.M. Vilar et al. / Electrical Power and Energy Systems 39 (2012) 48–55

and Vi,j(r) and bV i;jðrÞ are the actual and the forecasted value (de-mand or price) at the rth hour in the jth day of the ith week to bepredicted. The seasonal error (SE) is then

SE ¼ 17

X7

j¼1

DEj:

Table 2Relative daily and seasonal forecasting errors (%) for the electricity price (2008).

DE SE

Mon Tue Wed Thu Fri Sat Sun

SummerNAÏVE 8.63 6.39 4.36 4.71 6.94 6.27 8.08 6.48ARIMA 7.10 7.59 5.50 5.91 7.08 6.85 7.44 6.78FNP-D 10.26 6.70 5.59 5.73 6.28 7.43 8.52 7.21FNP-R 10.31 6.69 5.47 5.73 6.47 7.30 8.71 7.24FNP-D-P 9.39 6.77 5.54 5.49 6.14 7.06 8.45 6.97FNP-R-P 9.48 6.43 5.51 5.80 6.26 7.47 8.73 7.10SFPL-D 8.14 6.17 5.06 5.45 6.30 6.62 6.57 6.33SFPL-R 8.07 5.96 5.19 5.35 6.12 6.83 7.37 6.41SFPL-D-P 8.10 6.30 5.19 5.23 6.38 6.28 6.56 6.29SFPL-R-P 7.94 5.99 5.19 5.39 6.10 6.51 7.20 6.33

AutumnNAÏVE 7.73 6.24 7.81 6.58 8.39 7.80 7.59 7.45ARIMA 8.11 7.30 8.53 8.23 7.72 7.75 8.09 7.96FNP-D 8.53 7.93 8.23 7.77 7.60 10.34 10.87 8.76FNP-R 8.05 7.46 7.82 6.63 7.36 11.24 11.41 8.58FNP-D-P 8.52 7.95 8.20 7.76 7.11 10.27 10.99 8.69FNP-R-P 8.26 7.92 7.87 7.54 7.39 11.08 11.54 8.81SFPL-D 7.88 7.12 7.39 7.57 7.41 7.96 7.13 7.49SFPL-R 7.88 7.37 7.19 7.06 6.83 7.80 7.91 7.44SFPL-D-P 7.76 6.54 7.69 7.50 7.59 8.14 7.11 7.47SFPL-R-P 7.57 7.24 7.20 7.29 7.15 7.58 7.59 7.37

In practice, several ‘‘parameters’’ need to be selected for thefunctional nonparametric estimate and the semi-functional partiallinear estimate. This is done in the following way:

1. The kernel K has low impact on the estimates. We use theEpanechnikov kernel defined by KðuÞ ¼ 3

4 ð1� u2ÞIð0;1Þ.2. For the bandwidth, h, we consider the k-nearest-neigh-

bors method. The number of neighbors, k, is selected bymeans of the local cross-validation method. See [40,41]for details.

3. The semimetric, d, chosen is based on a seminorm. Sinceour data (curves) are rough (see figures below), we con-sider a seminorm based on functional principal compo-nent analysis. Cross-validation ideas are used to selectthe tuning parameter, q, the number of principalcomponents.

4. Case study: electricity demand

We are interested in 1-day electricity demand forecasting (spe-cifically, j-hours ahead electricity demand forecasting, for j = 1, . . . ,24). We focus on all the days in each of the four seasons: Summer2008, Autumn 2008, Winter 2009 and Spring 2009. Historical dataused for forecasting include the hourly demand (MW) of the 49previous days to the day which demands are to be predicted. Notethat n = 48 in the functional models (2) and (4). These data

Summer Autumn Winter Spring

020

4060

8010

0

Hou

rly e

rrors

(%)

NAÏVEARIMASFPL-R-P

Fig. 8. Hourly electricity price errors corresponding to naïve, ARIMA and semi-functional partial linear models (with recursive estimator on the pruned curves).

Page 6: Forecasting next-day electricity demand and price using nonparametric functional methods

0 50 100 150

36

9

Time

Pric

e (

/MW

h)

NAÏVEARIMASFPL-R-P

Fig. 9. Actual prices (thick black lines) and predicted values for the naïve, ARIMAand the recursive version of the semi-functional partial linear model using thepruned data for an Autumn week (November 17–23).

J.M. Vilar et al. / Electrical Power and Energy Systems 39 (2012) 48–55 53

correspond to Spain, and are available at http://www.omel.es, theofficial website of Operador del Mercado Ibérico de Energía.

Fig. 1 displays both the historical demand and the demand to bepredicted, corresponding to November 17–23. Similar pictures forthe other weeks are omitted. The presence of trend in the data isclearly seen in Fig. 1. Thus, the data were differentiated.

We denote by vi : ½0;24Þ ! R the differentiated electricity de-mand along the day i (i = 1, . . . , n). Fig. 2 shows the historicalcurves used to forecast the demand along the first day in the Au-tumn week mentioned above. The roughness of the curves exhib-ited in Fig. 2 remains for the other weeks analyzed.

In this case study a three-dimensional covariate, xi = (xi1, xi2,xi3)T, was used for the SFPL model (4). The covariates in this vectorare xi1 = ISaturday, xi2 = ISunday and xi3 = IMonday, i.e. the indicators of aSaturday, a Sunday and a Monday. The reason for this choice is the

0 50 100 150

0 50 100 150

Time

Pric

e (

/MW

h)

(a)

Time

Pric

e (

/MW

h)

(c)

36

93

69

Fig. 10. Actual prices (black lines) and predicted values (gray lines) for the semi-functiweeks: (a) August 18–24, (b) November 17–23, (c) February 16–22, and (d) May 18–24

fact that Saturdays and Sundays are the days of the week withsmaller demand. Since the autoregressive degree of the model is1, these dummy covariates are useful to characterize four differentscenarios:

1. Saturdays: relatively small demand with respect to theprevious day.

2. Sundays: where the demand is relatively similar to that ofthe previous day and both tend to be lower than forweekdays.

3. Monday: which is a day with a high demand, when com-pared to the previous day.

4. Tuesday–Friday: where the high demand of this day issimilar to the demand of the previous one.

Of course, different types of covariates could also be incorpo-rated, as, for instance, temperature.

When the prediction horizon is larger than one, point forecastsare carried out in two different ways. The first one is the direct (D)method and consists in the approach mentioned in the previoussection. The second alternative is the recursive (R) method. It com-putes a one-ahead forecast and includes it in the sample to performagain a one-lag prediction, as many times as needed.

We will use the notation FNP-D and FNP-R for the forecastsbased on the FNP model (2) obtained from the direct and the recur-sive methods, respectivaly. SFPL-D and SFPL-R will denote the fore-casts based on the SFPL model (4) obtained from the direct and therecursive methods, respectively. Note that, depending on the dataused, the matrix eXT

heXh involved in the expression of b̂h (see (5))

could be numerically singular. These few cases were not includedin the study.

0 50 100 150

0 50 100 150

Time

Pric

e (

/MW

h)

(b)

36

93

69

Time

Pric

e (

/MW

h)

(d)onal partial linear model with the recursive method using the pruned data for the.

Page 7: Forecasting next-day electricity demand and price using nonparametric functional methods

54 J.M. Vilar et al. / Electrical Power and Energy Systems 39 (2012) 48–55

Forecasts obtained by means of the functional models (2) and(4) will be compared with those based on ARIMA models withcovariates. More specifically, for each day, 24 separate hourly ser-ies are considered (variable segmentation [24]), and the corre-sponding ARIMA (p, 1, q) models with dummy covariates areused for prediction. The dummy covariates are the same as thosementioned above, and p, q 2 {0, . . . , 7}. In practice the values forp and q were, most of the times, 7, and 0, 6 and 7, respectively.

In addition, a naïve procedure is also used for comparison. Itconsists in forecasting the demand for a given day by means ofthe demand in the previous day in the class given by the dummycovariates used in both the SFPL and ARIMA models.

Table 1 gives both the DE and SE corresponding to each model.In general, the results in this table show the good behavior of theSFPL-R forecasts. The recursive versions of the new functional pro-cedures give slightly better results than the direct ones. It is worthmentioning the good performance of the naïve approach for Tues-day–Friday.

We now compare hourly errors for the naïve, ARIMA and SFPL-Rforecasts only. Fig. 3 shows a visual comparison of the hourly er-rors of only these three forecasts. Although the three methods ex-hibit comparable results, the good behavior of SFPL-R is alsoevident from this plot.

Fig. 4 displays the naïve, ARIMA and SFPL-R forecasts for an Au-tumn week (November 17–23), while Fig. 5 shows the SFPL-R fore-casts for a week in each season (August 18–24, November 17–23,February 16–22 and May 18–24). The good behavior of SFPL-R isclearly seen from these plots.

5. Case study: electricity price

A similar study is conducted in this section for electricity priceforecasting. Prices were available for the same period as demands,and they were obtained from the same source. The period selectedto evaluate the performance of the methods is also the same as inthe previous section.

Fig. 6 shows the historical prices and the prices to be predictedcorresponding to an Autumn week (November 17–23). Similar pic-tures for the other weeks are omitted. The presence of outliers inprices is clearly seen from this figure. This is a usual feature forprice data [23].

To reduce the problem of outlier effect, pruned curves has alsobeen considered before applying the models and forecasts for theelectricity price data. More specifically, the historical prices werepruned in the following way. First, a deterministic trend (with timeas covariate) was fitted to the historical prices corresponding to thesame hour. A Nadaraya–Watson estimator with cross-validationbandwidth was used to compute this trend. Second, the residualsfrom that fit were computed and truncated to plus/minus twicetheir estimated standard deviation. Finally, transformed historicalprices were constructed by adding the new residuals to the esti-mated trend. The pruned functional data were obtained from thesetransformed historical prices. It should be noted that the percent-age of pruned prices was around 5%. Fig. 7 displays the historicalpruned curves, used to forecast the price, along the first day inthe Autumn week mentioned above. The roughness of the prunedcurves remains for the other weeks analyzed and, obviously, for theoriginal curves.

Tables 2 and 3 give both the DE and the SE corresponding toeach analyzed model. We use the notation FNP-D-P, FNP-R-P,SFPL-D-P and SFPL-R-P for the forecasts obtained from prunedcurves, either using the FNP or SFPL functional autoregressivemodels, with the direct or the recursive method. In general, work-ing with pruned data is better than using the original prices with-out correcting the outliers. It is also clear that the SFPL model is a

very competitive one for price forecasting. Unlike for demand fore-casting, the recursive method and the direct one give comparableresults. In this case, the order of the ARIMA (p, 0, q) models were,most of the times, 7, and 6 and 7, for p and q, respectively. Thenaïve method presents also a good behavior for price forecastingin Tuesday–Friday.

We now compare hourly errors for the naïve, ARIMA and SFPL-R-P forecasts only. Fig. 8 shows a comparison of the hourly errorsof these three forecasts. The competitive behavior of SFPL-R-P isclearly seen in this plot. It is worth mentioning the relative stabilityof the SFPL-R-P forecasting error along hours and days for the fourselected seasons.

Finally, Fig. 9 displays the naïve, ARIMA and SFPL-R-P forecastsfor an Autumn week (November 17–23), while Fig. 10 shows theSFPL-R-P forecasts for a week in each season. The good behaviorof SFPL-R-P is clearly seen from these figures.

6. Conclusions and perspectives

Functional data nonparametric techniques have been success-fully used for electricity demand and price forecast in the Spanishmarket. The semi-functional partial linear model proposed in thispaper gives good error results when compared to other complex al-ready existing approaches, like ARIMA models with dummy covar-iates and considering a variable segmentation. It is worthmentioning that for 0 6 p, q 6 7 these ARIMA models allow fordependence up to the previous 7 days. However, the functionaland semi-functional models used in this paper only include depen-dence on the previous day. The performance of the SFPL model isvery competitive both for demand and price forecasting.

Despite its complexity, the SFPL model has been used in a rathersimple form. For instance, the outlier pruning has been carried outusing a straightforward technique. We focused on point forecastsbut prediction bands can also be constructed using this functionaldata approach. The model is very flexible to incorporate the effectof new informative covariates that can enter it either in parametric(e.g. linear) or nonparametric form. It can be easily applied to highfrequency data (e.g. 10-min data) whenever they become available.All these features make this approach appealing and with plenty ofpotential for improving.

Acknowledgments

The authors are grateful to two anonymous referees for theirconstructive comments and suggestions, which helped to improvethe quality of the paper. This research is partly supported by GrantsMTM2008-00166 and MTM2011-22392 from Ministerio de Cienciae Innovación (Spain).

References

[1] Gross G, Galiana FD. Short-term load forecasting. Proc IEEE 1987;75:1558–73.[2] Smith M. Modelling and short-term forecasting of New South Wales electricity

system load. J Bus Econ Statist 2000;22:17–28.[3] Taylor JW, de Menezes LM, McSharry PE. A comparison of univariate methods

for forecasting electricity demand up to a day ahead. Int J Forecast2006;22:1–16.

[4] Ramanathan R, Engle R, Granger CWJ, Vahid-Araghi F, Brace C. Short-runforecasts of electricity loads and peaks. Int J Forecast 1997;13:161–74.

[5] Cottet R, Smith M. Bayesian modeling and forecasting of intraday electricityload. J Am Statist Assoc 2003;98:839–49.

[6] Pardo A, Meneu V, Valor E. Temperature and seasonality influences on Spanishelectricity load. Energy Econ 2002;24:55–70.

[7] Chang P, Fan C, Lin J. Monthly electricity demand forecasting based on aweighted evolving fuzzy neural network approach. Electr Power Energy Syst2011;33:17–27.

[8] Alves da Silva AP, Ferreira VH, Velasquez R. Input space to neural networkbased load forecasting. Int J Forecast 2008;24:616–29.

[9] Cancelo JR, Espasa A, Grafe R. Forecasting the electricity load from one day to oneweek ahead for the Spanish system operator. Int J Forecast 2008;24:588–602.

Page 8: Forecasting next-day electricity demand and price using nonparametric functional methods

J.M. Vilar et al. / Electrical Power and Energy Systems 39 (2012) 48–55 55

[10] Nogales FJ, Contreras J, Conejo AJ. Forecasting next-day electricity prices bytime series models. IEEE Trans Power Syst 2002;17:342–8.

[11] Contreras J, Espínola R, Nogales FJ, Conejo AJ. ARIMA models to predict next-day electricity prices. IEEE Trans Power Syst 2003;18:1014–20.

[12] Conejo AJ, Plazas M, Espínola R, Molina B. Day-ahead electricity priceforecasting using the wavelet transform and ARIMA models. IEEE TransPower Syst 2005;20:1035–42.

[13] García-Martos C, Rodríguez J, Sá nchez MJ. Mixed models for short-runforecasting of electricity prices: application for the Spanish market. IEEE TransPower Syst 2007;2:544–52.

[14] Serinaldi F. Distributional modeling and short-term forecasting of electricityprices by generalized additive models for location, scale and shape. EnergyEcon 2011;33:1216–26.

[15] Weron R, Misiorek A. Forecasting spot electricity prices: A comparison ofparametric and semiparametric time series models. Int J Forecast2008;24:744–63.

[16] Skantze P, Ilic M, Chapman J. Stochastic modeling of electric power prices in amulti-market environment. In: Proc power eng winter meet, Singapore; 2000.p. 1109–14.

[17] Nakashima T, Dhalival M, Niimura T. Electricity market data representation byfuzzy regression models. In: Presented at the power eng summer meet, Seattle,WA; 2000.

[18] Karsaz A, Rajabi Mashhadi H, Mirsalehi MM. Market clearing price and loadforecasting using cooperative co-evolutionary approach. Electric Power EnergySyst 2010;32:408–15.

[19] Szkuta BR, Sanabria LA, Dillon TS. Electricity price short-term forecasting usingartificial neural networks. IEEE Trans Power Syst 1999;14:851–7.

[20] Unsihuay-Vila C, Zambroni de Souza AC, Marangon-Lima JW, Balestrassi PP.Electricity demand and spot price forecasting using evolutionary computationcombined with chaotic nonlinear dynamic model. Electr Power Energy Syst2010;32:108–16.

[21] Singhal D, Swarup KS. Electricity price forecasting using artificial neuralnetworks. Electr Power Energy Syst 2011;33:550–5.

[22] Zhang L, Luh PB, Kasiviswanathan K. Energy cleary price prediction andconfidence interval estimation with cascaded neural networks. IEEE TransPower Syst 2003;18:99–105.

[23] Conejo AJ, Contreras J, Espínola R, Plazas MA. Forecasting electricity prices for aday-ahead pool-based electric energy market. Int J Forecast 2005;21:435–62.

[24] Aggarwal SK, Saini LM, Kumar A. Electricity price forecasting in deregulatedmarkets: a review and evaluation. Electr Power Energy Syst 2009;31:13–22.

[25] Weron R. Modeling and forecasting electricity loads and prices: a statisticalapproach. Chichester: Wiley; 2006.

[26] Härdle W, Vieu P. Kernel regression smoothing of time series. J Time Ser Anal1992;13:209–32.

[27] Hart JD. Some automated methods of smoothing time-dependent data. JNonparametr Statist 1996;6:115–42.

[28] Härdle W, Lütkepohl H, Chen R. A review of nonparametric time seriesanalysis. Int Statist Rev 1997;65:49–72.

[29] Carbon M, Delecroix M. Nonparametric vs parametric forecasting in timeseries: a computational point of view. Appl Stoch Model Data Anal1993;9:215–29.

[30] Matzner-Lober E, Gannoun A, De Gooijer JG. Nonparametric forecasting: acomparison of three kernel based methods. Commun Statist: Theory Meth1998;27:1593–617.

[31] Vilar-Fernández JM, Cao R. Nonparametric forecasting in time series – acomparative study. Commun Statist: Simul Comput 2007;36:311–34.

[32] Bosq D. Linear processes in function spaces: theory and applications. Lecturenotes in statistics, vol. 149. Springer-Verlag; 2000.

[33] Ferraty F, Vieu P. Nonparametric functional data analysis. New York: SpringerSeries in Statistics: Springer-Verlag; 2006.

[34] Antoniadis A, Paparoditis E, Sapatinas T. A functional wavelet-kernel approachfor time series prediction. J Roy Statist Soc Ser B 2006;68:837–57.

[35] Aneiros-Pérez G, Vieu P. Nonparametric time series prediction: a semi-functional partial linear modeling. J Multivar Anal 2008;99:834–57.

[36] Aneiros-Pérez G, Cao R, Vilar-Fernández JM. Functional methods for timeseries prediction: a nonparametric approach. J Forecast 2011;30:377–92.

[37] Ramsay JO, Silverman BW. Applied functional data analysis: methods and casestudies. New York-London: Springer Series in Statistics: Springer-Verlag; 2002.

[38] Ramsay JO, Silverman BW. Functional data analysis. New York: Springer-Verlag; 2005.

[39] Aneiros-Pérez G, Vieu P. Semi-functional partial linear regression. StatistProbab Lett 2006;76:1102–10.

[40] Benhenni K, Ferraty F, Rachdi M, Vieu P. Local smoothing regression withfunctional data. Comput Statist 2007;22:353–69.

[41] Aneiros-Pérez G, Vieu P. Automatic estimation procedure in partial linearmodel with functional data. Statist Papers 2011;52:751–71.