Comparison of Electricity Spot Price Modelling and Risk Management Applications

: In dealing with sharp changes in electricity prices, contract planning is considered as a vital risk management tool for stakeholders in deregulated power markets. In this paper, dynamics of spot prices in Turkish electricity market are analyzed, and predictive performance of several models are compared, i.e., time series models and regime-switching models. Different models for derivative pricing are proposed, and alternative portfolio optimization problems using mean-variance optimization and conditional value at risk (CVaR) are solved. Expected payoff and risk structure for different hedging strategies for a hypothetical electricity company with a given demand are analyzed. Experimental studies show that regime-switching models are able to capture electricity characteristics better than their standard counterparts. In addition, evaluations with various risk management models demonstrate that those models are highly competent in providing an effective risk control practice for electricity markets.


Introduction
In many countries around the world, electricity markets were been liberalized in the late 20th century. Subsequently, integrated state-owned electricity companies have been separated into specialized individual market participants. Before the liberalization, the power sector in most of these countries was not free to competition, and cost-based pricing was applied where prices were calculated by regulators using generation, transmission, and distribution costs of electricity. As a result, there were no price risks in the electricity market. However, as a result of liberalization, electricity price risk has appeared as one of the most critical financial risks for the market participants. In particular, both the electricity generation and distribution companies face these new uncertainty factors and therefore higher financial risk.
Electricity markets have attracted the attention of both researchers and practitioners due to the major changes in the market environment. Studies on electricity markets aim to understand the unique attributes of electricity and help the market participants interpret the characteristics of this product. Studies on electricity markets can be divided into two significant streams concerning our work. The first stream is modeling the electricity price process, and the second is the risk management of electricity portfolios. In this paper, we aim to deal with those two issues.
Electricity, as a trading commodity of the power markets, has a distinguishing characteristic that it is fundamentally non-storable and behaves different form other commodities according to [1]. Besides, demand for electricity is highly volatile due to the seasonality of customer usage as stated by [2]. The change in demand depends on both deterministic and stochastic factors. An example of the deterministic effect is the time of the day or day of the week. However, the stochasticity of the market depends on different factors, such as business cycles or weather. Electricity spot prices display such as worst return and mean semi-deviation below the mean return and solved a multiple criteria optimization problem for a single stage. In [31], authors have defined a two-stage stochastic integer programming model in order to devise an optimal power contract portfolio from the perspective of a generation company. In contrast to multi-stage models they define the second stage for balancing the demand. In a multi-stage environment, Ref. [32] deals with the portfolio selection problem for an electricity retailer using derivative contracts and applied robust optimization using decision rules to the problem. They do not incorporate any other risk parameter in their model. In [33], authors propose a model with minimizing the cost and the CVaR in a multi-stage stochastic programming framework and compare the performance of the predefined model with the hedge-and-forget case. A scenario tree of stochastic spot prices is generated using a simple autoregressive model, and a tree-based solution procedure is applied. Their experiments show that the multi-stage stochastic programming method outperforms the hedge and forget approach. However, in their multi-stage framework the contracts are only valid in a single stage; therefore, each stage can be solved independently. In our model we use future contracts with longer maturity period. In recent studies CVaR is used for different problems in the risk management in energy markets context. For example, Ref. [34] model the risks for a virtual power plant, Ref. [35] examine the supplier selection problem for large customers, or [36] risk averse natural gas generator operation in a micro-grid.
The main contributions of this study are listed below.
• Different models for electricity pricing have been proposed, and their regime-switching counterparts have been driven. All models are compared for both the in-sample and out-sample performance. • CVaR based multi-stage risk management model for a distributor company is developed, and differences between single and multi-stage models are examined.

•
The performance of different pricing and simulation models for risk hedging purposes have been investigated • Risk-return trade-off for different levels of risk averseness is analyzed.
The rest of this study is formed as follows. Electricity price models are introduced in Section 2. Portfolio optimisation models are developed in Section 3. Empirical results for the estimation of the model parameters and the optimisation results are provided in Section 5. This paper is finalized with the conclusion section.

Electricity Price Models
The price processes are modelled via stochastic and econometric time-series approaches as they are often used to capture short term price movements. Besides, those models allow to add external factors such as the business cycles, weather conditions and fuel prices. Main stochastic (or financial) models are geometric Brownian motion models with possible addition of regime switching components, jump processes and mean reverting processes. Similarly, time series models can be categorized as autoregressive and mean reverting models with heteroscedastic components. In both time series and financial models there exists deterministic components such as trend variables and seasonal cycles. The deterministic components are modelled in the same way for all the models analysed. For that reason the deterministic component is removed from historical prices to obtain stochastic parts. Following that, the parameters for the proposed models are estimated.
In the literature, various approaches can be found for extracting deterministic components of price series for financial variables. Following [2], spot price of electricity X(t) can be represented as a sum of two independent components, i.e., deterministic component X d (t) and stochastic component X s (t) (X(t) = X d (t) + X s (t)). Deterministic component is equivalent to sum of two parts defined as trend X t (t) and seasonal X c (t). Trend components represent the increase (or decrease) in prices throughout the years due to the changes in supply of the electricity or consumption conditions. In this paper, a non-linear trend as the average price in a yearly moving window is used. In particular trend at time t is defined as Obtained historical data and the literature on prices suggest three main cycles in electricity prices. Those cycles are (i) daily cycle that is effected by change in the levels of demand during daytime and night time; (ii) weekly cycle represents differences between weekdays and weekends and (iii) yearly cycle reflects seasonal usage differences. Yearly cycle is defined as a sum of trigonometric functions given in Equation (2). Annual cycle explains seasonal variation in prices and changes with the higher and lower price periods of the year.
where k is the number of components, β y k is the magnitude of the component and ϕ y k is the phase difference between the data and the component. According to [37] the set {exp(2πκi)} κ∈Z is an orthonormal basis and any periodic function can be approximated by a sum of trigonometric functions arbitrarily good. Here as the computational part is applied to the Turkish market, hourly price data is used. If the price is determined half hourly in the market then the denominator inside the cosine function in Equation (2) should be changed by 48 instead of 24. Using a cosine function provides a better estimation for yearly data since number of variables to be estimated is smaller.
The weekly cycle is modelled through a step function that changes with respect to day of the week as in Equation (3).
In Equation (3), W i (t) is an indicator function. To clarify, W i (t) is equal to zero if time t is at day i where Monday is defined as day one. Here, Sunday is the base day for which all the indicator functions are equal to zero. Daily cycle is also defined by using orthonormal basis as in (2). Daily cycle function for hourly based prices is given in Equation (4).
Seasonal and trend components of the prices are combined and overall deterministic part is given in Equation (5).
In this paper the same form for deterministic component X d (t) is used for all the alternative approaches of price models.

Mean Reverting Model
In times of supply disruptions it is common to observe sudden price spikes in electricity markets, and after these spikes the price usually reverts to mean levels. According to [38] most of the energy spot prices have mean reverting characteristic. Specifically for electricity, speed of mean reversion in prices series distinguishes electricity from others. Among all financial time series electricity spot prices are perhaps the one with the fastest rates of mean reversion [39]. Mean reversion process (or Ornstein-Uhlenbeck process as defined in [40]) can be formulated using stochastic differential equation (SDE) and is stated in Equation (6).
In Equation (6), µ is the long term average mean for the stochastic component, κ is the mean reversion rate and W t is the standard Brownian motion. After applying Ito's Lemma to Equation (6) one can obtain the discrete time version of mean reversion process. As suggested by [41] discrete time mean reversion equation is derived as in Equation (7).
In Equation (7), δ is set to one hour and ε t is a standard normal random variable. Mean reverting model has similar characteristics with an autoregressive (AR) process with lag equal to 1.
An important assumption for mean reversion process is about normality of residuals. However, as noted by [42] normality assumption does not hold in electricity prices. Electricity price processes are heavy-tailed and positively skewed. Reason of that outcome is the instantaneous jumps in the prices. Jumps in electricity prices are usually modelled by using a Poisson error component in addition to mean reverting model in (6). Let dq be Poisson factor responsible for jumps arrivals and let J be the jump heights, then mean reversion process with jump can be written as Equation (8).
The variable J is assumed to be log-normally distributed where ln(J) > 0 that can be interpreted as positive jumps. In the discrete version of mean reversion process, jump process is added as a random variable that takes zero value with probability p and value of a log-normal random variable with probability 1 − p (Equation (9)).
Required probability values are estimated by counting the number of jumps in the process. Besides, distribution of J is estimated from the size of jumps.

ARMA Model
In addition to mean reversion processes, autoregressive moving average (ARMA) processes are also widely used to model the electricity prices [42]. ARMA process consists of two parts where the autoregressive components consider the last p previous prices, and the mean average part is based on the last q error terms. Although there exists different extensions for ARMA processes, the standard ARMA process used in this paper can be defined as given in Equation (10).
In Equation (10), t is a normal random variable. ARMA process assumes that the residuals are normal with independent and identically distributed . It is a well-known fact that the electricity residuals do not satisfy this assumption [43]. That issue is a consequence of the jump processes and the heteroscedastic variance. Usually after the jump occurrences, volatility stays high since the markets are often nervous about the equilibrium price levels. Using Generalized AutoRegressive Conditional Heteroskedasticity (GARCH) models those types of market behaviour can be effectively modelled.
Several forms of GARCH modeling are proposed in the literature. In this paper the definition suggested by [44] is used. Formula for GARCH (p, q) model (p is the order of the volatility terms and q is the order of the residual terms) is given by Equation (11).
It is usually common to set p and q values equal to one. In Equation (11), ω is a constant, α g z and β g z are the autoregressive and moving average coefficients, σ t−z stands for time-variant variance and ε t−z represents residual terms.

Regime Switching Models
Although the jump process explains the sudden movements in the price shifts of stock market variables, they are not adequate to model the price dynamics of electricity. In electricity price series a positive jump caused by interruptions is followed by some period of high prices and afterwards a negative jump as a result of the system repair [45]. Stochastic jump is considered as poor at explaining the sudden change of regime in prices. Use of mean reversion with jump process has its drawbacks since the reverting rate after the jumps and in normal periods needs to be different. It is not possible to distinguish normal operating times from the post-catastrophic events. This induces high estimation errors.
Regime switching models aid to avoid this problem by introducing different regimes for different market conditions. The idea of the regime-switching models is that the time series behaves differently in different economic environments by defining an environmental variable, i, the state or regime. Although it is possible to estimate models with n different regimes, in the literature usually two or three states are suggested for regime switching time series models. One of the regimes model ordinary conditions whereas the other(s) models disruption periods which may include the price spikes or the negative prices. Here, two different regimes, i.e., base regime (State 0) and peak regime (State 1) are used. A sample diagram used in regime switching models is illustrated in Figure 1. The regime switching electricity market can be modelled using discrete time Markov chains since prices set with hourly time intervals. In order to model a market using Markov chains one needs to estimate the transition probability matrix. Probability of the market's regime being the same between consecutive periods is denoted by π ii for i = 0, 1. More specifically, π 00 (π 11 ) is the probability that a base regime (peak regime) continues given the previous one is base (peak regime). Transition matrix is defined in Equation (12).
Note that, π 01 = 1 − π 00 is probability of transition of the market from base to peak regimes and π 10 = 1 − π 11 is from peak to base state.
The parameters for the Markov process are calculated using historical stochastic residues of electricity prices. The process at time t is assumed to be in peak regime if X s (t) is 3σ higher than the mean level. After classifying the past data into different regimes transition probabilities π ij are calculated as the probability of switching to or remaining in the respective regime between two time steps through historical data.
Regime switching approach are applied to mean reversion, ARMA and GARCH models. It is assumed that the process in base regime is mean reverting, ARMA, or GARCH and estimate the parameters using the historical data for the base regime. Then the parameters of peak regime using the corresponding historical price residuals are calculated.
The methodology for price estimation and simulation is represented in Figure 2. The historical price series is used to estimate the deterministic components, namely the trend component and the yearly, weekly, and daily cycles. After the estimation of the deterministic components, they are removed from the historical prices to get the stochastic part in step 1. Then, if a regime-switching model is used, different types of regimes are extracted in step 2. For each regime, the parameters for the time series model are estimated. If a model without regime-switching is used, then step 2 is skipped, and the parameters are estimated from the whole process. The estimated models are used to generate the simulations for the portfolio optimization model described in Section 3.2. First, the random time series are simulated. Then for regime-switching models, the Markov chain is simulated, which changes states according to the transition probability matrix. Then the deterministic components are added in step 4, to get the simulated price processes. The regime switching models are simulated as shown in Figure 3. In the first step the regime s for time period t is simulated. Then if the regime is regular then the price at time t is simulated using regular process whereas if the regime is jump regime, then the price is simulated using the jump process. A uniform random variable r is used to generate the next period regime. When current regime is regular regime, if r is less than π 00 , then the regime process at time t + 1 is also regular regime. Similarly, for a jump regime, if r is less than π 10 then the regime is converted to regular regime.

Portfolio Risk Management
Extraordinary nature of electricity, i.e., lacking the opportunity of utilizing the inventory, spikes or high weather dependency, makes the market players shape and manage their risk constantly if they want to survive [46]. For example, in the aftermath of the failure of two major plants in the US in 1998, the spot price for electricity have escalated up to USD 7000 per MWatt, noting that the normal price level oscillates in interval of USD 30-60 at that time of the year [47]. In [39], authors compare the relative price volatility of the electricity and some other assets in German spot market on daily scale and concludes that although treasury bills and notes have volatilities less than 0.5% and even very volatile stocks have volatilities around 4% level, for electricity this could go up to 50%. considering that issue, taking action against the extreme spikes in advance would provide the companies from catastrophic outcomes such as bankruptcy.
There is a hypothetical electricity distribution company without any production facilities and the company has to meet the customer demand by buying electricity from producers. Therefore the company faces the risk due to spot price since it is not possible to pass the price fluctuations in the electricity spot market onto customers and price charged to the final consumer is usually fixed. Therefore, the retailer should use risk management tools while making decisions on how to build an electricity purchasing portfolio.
At period t = 0, assuming an electricity retailer has to decide on how to allocate the portfolio for future electricity delivery for the horizon until time T where δt is the price interval (one hour in our case) and there are T periods. The demand is stochastic and equal to D t at time t and the retailer must satisfy all the demand either by purchasing electricity in the day-ahead market or using available bilateral contracts and derivative markets. Using only the spot market to satisfy demand is very risky because of the high variability of the spot price X(t) at time t. Therefore, the company can set up different forward contracts indexed by i = 1, 2, . . . , I that are available at the over the counter or the exchange market. The forward contract guarantees delivery of electricity for the given time period and the retailer is obliged to buy the prescribed amount of electricity at the agreed price. Retailer company can decide to buy forward contracts at certain decision times s ∈ Θ where s < T and the coverage period of the contract starts after s. Market price of long position in forward contract i is assumed to be equal to f i (s) at time s. Retailer can sell a part of its position on a given contract at a later decision epoch. There are different types of forward contracts, i.e., daily, monthly or quarterly, covering the base period, peak period or the whole period. Peak time forward contract provides a pre-defined amount of electricity between 8:00 and 20:00. Time period between 20:00 and 8:00 are accepted as off-peak time hence the corresponding forward prices are relatively lower than peak hours. Base load contracts supply the consumers some desired amount of electricity 24-hour day time constantly. We define an I × T indicator matrix A(i, t) as A(i, t) = 1 if contract i is active at period t and otherwise 0. The volume of contract type i purchased at decision epoch s is denoted by θ i s . Total amount of electricity contracts that are active at time t are equal to Given the above assumptions, total electricity purchasing costs C(T) for the period between 0 and T, can be written as given Equation (13).
Cost function is defined as sum of the cost of purchasing derivative contracts and purchasing extra electricity that is needed. The retailer company does not effect the prices in the market by its decisions.
The objective of the retailer is to minimize E [C (T)] with respect to some risk parameter. Different risk definitions are used in the literature and the most widely used risk definition is the variance (or the standard deviation) suggested by [48]. In [48], risk is defined as the variance of returns and a model is given therein for an investor tries to minimize the risk and maximize the return. Following [49] one way to define the risk for electricity retailer company is using the variance of the cost function. Although there has been a well-established research on that risk definition there are some drawbacks require attention. First of all, variance treats the downside risk equal to the upside where the cost is smaller and profits are larger. Furthermore, variance does not satisfy three of the assumptions of coherent risk measures which is discussed at Section 3.2. Although there are possible problems with mean variance models, it is used as a benchmark model at Section 3.1.
An alternative risk definition is conditional value at risk (CVaR). This definition concentrates on the average cost given that the price realisations are at the worst α percentile. Details on this formulation are presented in Section 3.2.

Mean Variance Model
In line with study given in [49], the goal of the retailer company is to find the portfolio of assets with the minimum expected cost for a predefined level of risk that can be accepted by the company. Risk is defined as the variance of the cost function. Then, purchasing problem of the retailer can be defined as the optimization problem given in Equation (14).
In Equation (14), var (C (T)) is the variance of the total costs that the retailer is happy to accept. For mean-variance optimisation problem it is enough to specify the mean and variance of the prices in the electricity spot price series. It is clear from the discussions in Section 2 that the first two moments are not enough to describe the statistical properties of the electricity prices. However, due to the nature of the model the higher moments do not effect the decisions. Therefore, this model is used to see possible drawbacks of the mean-variance formulation.
In this section total electricity demand for the retailer and price of electricity in the spot market are assumed to be independent. This is reasonable since the customers of the retailer use electricity at a constant price. Therefore, their demand structure is not effected by the sudden changes in electricity prices in the market.
Expected cost at time 0 can be written in matrix notation and given in Equation (15).
In Equation (15), µ p t is the expected value of price at time t where µ p is the vector of means, and µ D t is the expected value of demand at time t with µ D vector. The vectors f consist of price vectors of different derivative contracts for all decision epochs. Similarly, θ is the decision vector over the quantity bought on all available derivative contracts for all decision epochs. By using the independence assumption, the variance of the cost calculated at time 0 as given in Equation (16).
In Equation (16), Λ p is the covariance matrix of the prices between different time periods up to 24 periods. Similarly, Λ d is the covariance matrix of the demands between different time periods.
Besides, tr(·) is the matrix trace operator. As stated in [49], it is possible to solve this problem using a second order solver.

CVaR Framework
Value at risk (VaR) is a risk measure used previously in banking industry to calculate the level of possible losses for a portfolio of financial assets. VaR of a portfolio is defined as the threshold level of loss for which the return on portfolio will be greater than that threshold level for β percentage of the cases at a given time horizon. Although the main use of VaR is to compute regulatory capital, it has also been used for risk management purposes. The mathematical formulation of β percentage value at risk VaR β is where x is the decision variable and Ψ is the cumulative distribution function for the random cost depending on x. Since VaR β is a threshold value it is independent of how big the losses can be if the cost is higher than this threshold. The details of coherent risk measures we first introduced in [50].
In contrast to its popularity VaR is clearly not a coherent risk measure since it contradicts the principle of risk reduction by diversification. In addition, it does not provide a convex structure which results computationally intractable optimization models. An alternative risk measure to VaR is conditional value at risk (CVaR) is defined as the expected value of losses on condition that loss function is greater than VaR threshold. The CVaR formula is given as Equation (18).
In Equation (18), f (x, y) represents a loss function for a random outcome y. CVaR is a coherent and convex measure thus it can be considered as practically more sensible and computationally tractable. Formulation in (18) can be characterised by a convex and continuously differentiable function F β (x, α β ) in terms of the threshold value α as where ϕ β (x) = min α∈R F β (x, α β ) (for the derivations see [51]). Although the CVaR risk measure provides a convex optimisation problem, evaluation of CVaR efficiently is still intractable. Besides, distribution information of the loss function is often not available. However, one can approximate the risk measure by sampling the probability distribution using samples ω according to its density function with probability of each sample is equal to π ω . The resulting approximated function can be written asF Since the approximation is a piecewise linear function of the α value, CVaR minimisation problem can be solved using the linear programming technique introduced by [51] through the CVaR constraints using positive auxiliary variables u ω where u ω ≥ f (x, y ω ) − α.
In order to convert the electricity retailer cost optimisation problem into CVaR based model, simulation of the price paths are needed. Therefore, the scenario tree based approach as suggested in [52] is used. The sequential simulation method is applied where the nodes are defined as either the decision epochs or the end nodes corresponding to the terminal time. Every node has limited number of leaves and a price path for each leaf is calculated thorough the decision epoch s to s + 1 using the corresponding process defined as in Section 2. Therefore, each price path from a node to its child node consists of all the simulated prices between times s to s + 1.
The nodes in the simulation path are defined as follows. The set of all nodes is N including the base node 0 and the set of the terminal nodes N K . A parent of a node n is referred as pre(n). The time T (n) refers to the time at which the decisions for node n are taken. The nodes of the decision process is illustrated in Figure 4. The price process has a tree based structure where for each node there aren child nodes. In the initial stage there is only one node. Therefore, there is only one decision for this stage initially. This node 0 has n 1 =n children nodes. Therefore, for all nodes from 1 to n 1 the parent node is node 0 (pre(1) = pre(2) = · · · pre(n 1 ) = 0). For stage 1 there are n 1 different alternatives. For each possible scenario there is a node that is corresponding to the scenario. Similarly, for each node in stage 1 there aren children nodes which results inn 2 total nodes in stage 2. This repeats on subsequent periods; therefore, the total number of nodes at terminal stage (stage k) is equal to n k . In a single stage hedge and hold model the only decision is taken at the initial stage which is represented by a red circle. This approach is compared with a stochastic model. In this case decision is taken at all the nodes except the terminal nodes (green circles). The green circles are the terminal nodes; therefore, no decision is taken at those nodes however the cost is calculated. In this model there are in total n k possible scenarios however some scenarios follow similar path for some stages; therefore, the tree representation is used. The advantage of the tree representation type modelling is that there no need for nonanticipativity constraints. One way to use the CVaR formulation is to minimise the risk measure. The portfolio allocation problem with an objective to minimise CVaR risk measure can be modelled as a linear program (P CVaR ) that is stated as follows: In formulation (P CVaR ), π n is the probability of each terminal node. γ n refers to the cost of purchasing electricity from market between node pre(n) and n plus the cost of derivative contracts purchased at time T (n) . Since for node zero there is no parent node, there wont be any electricity price purchased from the market. Similarly at any node n ∈ N K it is not possible to buy derivative contracts for the planning horizon; therefore, θ i N K are all equal to zero. In formulation (P CVaR ), the objective is to minimize the risk. Usually the companies try to find a balance between the risk and return. Decisions taken by merely using risk minimisation models can end up to be too much conservative. As a consequence, the resulting profit would be too small. An alternative formulation can be suggested similar to mean variance problem where the objective is to minimize the expected cost (which results a maximized return) for a given limit on the risk budget. In terms of CVaR framework the intuition is to have a limited budget threshold, and the CVaR of the cost cannot be above which the worst case lost (defined as CVaR). Then the problem turns out to be a constrained portfolio optimisation problem where CVaR value appears as a constraint with a cost minimisation objective. This problem can be formulated as in (P ret ) CVaR optimization approach takes into account investor's risk preferences. CVaR minimization and maximization models impose single objective to find an optimal investment strategy. While the first one minimizes risk, the latter maximizes portfolio wealth considering risk preferences of the investor. Multi-objective formulation involves the minimum risk investment strategy to achieve pre-determined wealth W target . The size of the problem (in terms of number of constraints and variables) depends on the number of assets as well as the number of scenarios generated. In Section 4 the empirical results of the proposed models is analysed.

Computational Experiments
In this section, in order to analyze the effect of different models for the risk management models, a series of experiments are given. Specifically, the objective is to answer the following questions:

•
How well different models fit the historical electricity spot price data? • How do different modeling techniques affect the decisions over derivative contracts? • How different risk awareness levels of companies affect the total cost of electricity?
In order to address these issues, different models for the electricity spot price are modeled using Python. Then, three different models, the mean-variance model, P CVaR , and P ret using simulated price series, are solved. The optimization models are implemented in MATLAB version R2016b using the modeling interface YALMIP [53] and the solver GUROBI version 8.1.1.

Electricity Price Modelling-Seasonal Part
In the computational experiment part, hourly electricity spot market data between 2012 and 2019 in the Turkish Electricity market is considered. The price data is collected from the EPIAS (Turkish Electricity Market Regulator) website. Descriptive statistics for the entire period and the different years are presented in Table 1. The historical data show that the electricity spot market has very heavy tails and positively skewed. This situation verifies the non-normality of the data and the need for the use of extreme jumps. Furthermore, the averages tend to change from one year to another, where the most noticeable change occurred from 2017 to 2018. The reason for this case is the rapid increase in exchange rates in Turkey. Due to the increase in exchange rates, electricity prices have also increased since a significant portion of Turkey's production depends on imported resources, such as natural gas. If the historical spot prices are analyzed, the jumps are evident. Figure 5 displays the historical prices from 2012-2019 in the top-left chart. The highest allowable price in Turkey is 2000 Turkish Liras. The jumps are more common in the year 2012, which can also be observed by the skewness and kurtosis values in Table 1. However, in the years 2014 and 2015, they are smoother. The top-right chart represents the histogram of the prices. The nonnormality and the two-state pattern of the prices are observable in the histogram. The bottom-left chart of Figure 1 shows the corresponding autocorrelation function (ACF), which clearly shows the price data's seasonal behavior. The autocorrelation function plot is for lags up to 24,000 h. Here the weekly seasonality can be observed with small stings, whereas the sinusoidal shape shows the yearly seasonality.
The spot price has a positive trend component, which can be observed by comparing the yearly averages in Table 1. The trend component can be removed by decomposition analysis in the time series. Trend component, calculated by taking the yearly average values, is given in the bottom-right chart of Figure 5. The trend is smooth around 150 TRY until 2016 and increases steadily after that point as the exchange rates against Turkish Lira rise.
The yearly seasonal component is derived through Equation (2) using the de-trended data for k = 5. The parameters for the yearly component are summarised in Table 2 Table 3. The parameters for the daily component are also given in Table 2, where the ϕ values represent the time in terms of days for this case. The yearly and daily seasonal component functions are given in Figure 6.
Yearly   The residuals are derived after cleaning all the seasonal and trend components. Figure 7 presents the histogram, the autocorrelation function, and the partial autocorrelation (PACF) for the residual process. From the PACF diagram, one can observe the autoregressive behavior. When tested for unit root using Augmented Dickey-Fuller test, the null hypothesis of series possessing a unit root is rejected with a p-value less than 0.0000001 and it is strongly shown that the data does not have a unit root. Therefore, both the ARMA models and the mean reversion model can be used. Residuals are used to model the processes that are introduced in Section 2.

Electricity Price Modelling-Stochastic Part
The processes that are introduced in Section 2 are used to model the residuals after removing the trend and seasonality components. The models used are; mean reversion process, ARMA process, and GARCH process. Three different ARMA models are selected according to their Bayesian information criterion (BIC) values. The GARCH model is driven for the ARMA(1,1) model. The parameters for different types of models estimated for dates between 2012 and 2019 are shown in Table 4. A jump or state change is defined as the cases where the residual is at least three standard deviations different from the mean. The mean reversion with jump process has the jump probability equal to 1.28% with an average jump size of 151.7 from the seasonal expected value. The parameters for regime-switching models are estimated by separating the base regime and jump regime. Here the probability that the next hour will be a base regime given this hour is a base regime is π 00 = 0.977, whereas the next hour will be a peak regime given this hour is a peak regime is π 11 = 0.769. This shows that disruptions in average continues for 4.32 h.
After estimating parameters for each model, predictive performances of the simulations are evaluated. Three error measures are selected: mean average percentage value (MAPE), root mean squared error (RMSE) and coefficient of determination(R 2 ). The formulae of these performance measures are given in Equations (19) and (20). In these equations, N, T, and P represents the number of simulations, the number of simulated hours and the prices, respectively.
The calculations are done through sorted price paths of both the historical data and the simulated data. The reason to use sorted paths is that the retailer is not concerned about exactly knowing when the price jump will occur but it is more interested in the number and amplitude of the jumps. A sorted comparison gives a better measurement on how well each model works over modelling the jump processes. The sorted price paths are called price duration curves. In order to achieve robust results we determine the quality of solutions over 100 simulated paths for every model. The results of performances for different models used are given in Table 5. It is clear that the regime switching models perform better in terms of R 2 and RMSE criteria. This shows the importance and advantage of using models with regime switching.

Hedging Portfolios
In this section, the results for different portfolio hedging problems are presented, particularly mean-variance, P CVaR , and P ret . Different models for spot price processes are assumed and the price paths according to those processes are simulated. The objective is to compare the goodness of fit results calculated in Section 4.2 with hedging performance results.
Demand forecast is assumed as 5% of total demand of electricity market in Turkey for the retailer. The planning horizon is assumed to be three months. Two different planning scenarios are analysed, in particular

•
The only decision epoch is the beginning of three month period; • There are three different decision epochs at the beginning of each month in the decision quarter.
Therefore, in the first plan the decision maker builds his/her hedging portfolio initially then does not buy or sell any more future/forward contracts. In the second scenario the decision maker can update his/her portfolio at intermediate time periods. The price paths are simulated as a tree type structure where the nodes are placed at the decision points and each node has 20 children which results in a total of 8000 scenarios. For each experiment 10 replications are performed.
In the market there are monthly and quarterly contracts for peak, off peak and base hour of electricity. The peak contract is sold at a 3% premium compared to the expected cost of electricity. The off peak is sold at par and the base contract is sold at 1% premium. These are parallel with the real market conditions.
For the mean-variance case the historical data is used to calculate the mean vector and covariance matrix. In Figure 8 we present the results for mean variance model at different levels of variance tolerance. The efficient frontier is different from the portfolio optimisation case since the objective in our problem is to minimise cost rather than maximize the profit.   Figure 9 presents the results for simulations done using ARMA(1,1) in model P CVaR with decisions made at the beginning. Here, as the β value increases the risk appetite of the retailer company decreases so the number of contracts that are purchased increases. Furthermore, the expected cost increases. The CVaR values are the empirical 95% CVaR of simulated results. Furthermore, the area plot shows how many of each derivative the retailer buys at given levels of α. 9 Figure 9. Effect of β for CVar model. Figure 10 presents the solutions for model P ret and where the simulations are done using ARMA (1,1) with decisions made at the beginning. Here β = 95% and the budget level i set between the optimal solution of P CVaR and the budget needed if no derivative contract is bought. It can be observed that the number of contract needed increases with the increased budget. Furthermore, the contract mix does not change as the budget is increased. A higher budget allows the retailer to minimise the expected cost. The histograms shows the results of scenarios with respect to different budget levels.
The diagram on the left shows the cost scenarios for a budget of 9.41 M whereas the one on the right shows the scenario results for a budget of 9.75 M. If the budget is tight more contracts are bought so it is less likely that very high costs are seen. But also low costs are not possible. In order to compare multi-stage decision making with the hedge and forget approach the expected cost and CVaR values for two models in Figure 11 are compared using different budget levels. The stochastic programming approach provides lower cost or lower risk because if in the first period there are not too many jumps then the budget available and the company hedges only small part of portfolio. If there were a lot of jumps then company needs to buy more contracts to hedge in the remaining periods.  Figure 11. Multi stage recourse in problem P ret .
In order to compare different models an out-sample analysis is performed. First the parameters are estimated using 2012-2015 data. Then the electricity prices are forecasted for each quarter as a rolling horizon. In Table 6 the out of sample error measures estimated for each of the 4 quarters using different models are summarised. Furthermore, the cost of electricity purchase using P CVaR case with three stage recourse for every model is presented. It is clear that the regime switching models behave better compared to standard models. This also shows that using regime switching can better explain the electricity spot price data and also can be useful for risk management applications.

Conclusions
In this paper, the hedging portfolio allocation problem for an electricity retailer company under the price uncertainty is studied. The retail companies that operate in this market may either buy the electricity at the day ahead market or hedge their electricity price risks via bilateral contracts or financial derivative instruments. Since the bilateral agreements depend on the private negotiations between different parties, the derivative contracts are used. The company aims to hedge its cost of electricity for a given period. The company's objective is either minimization of the risk of cost or minimization of the cost of electricity for a given level of the risk level. For this setting, a multi-stage stochastic optimization model that decides on the monthly and quarterly hedging strategies is developed.
The risk is defined as the CVaR for the cost in addition to the variance of the cost. In order to calculate CVaR values, price scenarios for electricity are generated. The electricity prices bear highly volatile properties due to unexpected jumps. Therefore, appropriate models are needed. The Electricity price paths are simulated through different stochastic processes. The standard models and their extended counterparts with their regime-switching components, which can capture the jump phenomenon, are analyzed. It is observed that using the regime-switching approach not only fits the data better for an in-sample experiment but also has better forecasting power at the out-of-sample analysis. Therefore, we conclude that regime-switching models have the power to capture structural changes that result in instantaneous jumps in the prices. As a result, the use of complex models that incorporate Markovian structure is inevitable for the players in the electricity market for price simulations. This paper's main contribution is to combine the price forecasting and model comparison part with the risk management problem. Computational tests are conducted by using datasets for the Turkish electricity market regulated by Epiaş. The portfolio optimization and risk hedging properties of different models are compared according to their performances in the conditional value at risk problems. In particular, for the out-of-sample examination, comparison in terms of risk levels for various models is carried out and added as an extra column in addition to the forecasting metrics in the results table. For the in-sample analysis, best models appear to be ARMA(1,1) with regime-switching and mean reversion with regime-switching according to RMSE and MAPE values. For the out-of-sample analysis, regime-switching models behave better according to both the forecasting metrics and financial performances. The regime-switching models have around 1% lower cost compared to their standard counterparts. The model with the lowest cost after hedging is mean reversion with regime-switching. This result shows that if a model to capture the jump component such as a Markovian process is used, then even with simple models, it is possible to achieve good hedging performance. Since the regime-switching models perform better than their traditional counterparts, a market participant in the electricity sector is advised to use Markov processes in their scenario generation models.
Another contribution of this study is the modeling and analysis of multi-stage risk models. A scenario tree for electricity price simulations is generated. In the computational experiment section, a quarterly planning horizon with monthly balancing decision epochs is analyzed as an alternative to the hedge-and-wait approach. A multi-stage CVaR optimization model where the portfolio is managed dynamically is modeled and solved in this paper. It has empirically been shown that the multi-stage model results in better portfolios in terms of risk and profit. The Pareto optimal solutions for the dynamic case results in a more efficient frontier compared to the static case where all decisions are taken upfront with a risk reduction of around 2.5% for the same level of cost. Therefore, a multi-stage CVaR model, as the methods introduced in this paper, which can hedge the price risks in the market dynamically, is inevitable for the electricity distribution companies.
We conclude that the risk-averse approaches for electricity distribution companies can decrease the company's price risk through a slight increase in cost. Proper model selection for the price before the optimization step remarkably increases the benefit of the model. In particular, the regime-switching approaches to capture the jumps in the electricity prices are markedly lucrative.