# Modelling the Hourly Consumption of Electricity during Period of Power
Crisis

Samuel Asante Gyamerah  Department of Statistics and Actuarial Science, Kwame
Nkrumah University of Science and Technology, Kumasi-Ghana  Laboratory for
Interdisciplinary Statistical Analysis – Kwame Nkrumah University of Science
and Technology (KNUST-LISA), Kumasi-Ghana  Henry Ofoe Agbi-Kaiser  Keziah
Ewura Adjoa Amankwah  Patience Anipa  Bright Arafat Bello

###### Abstract

In this paper, we capture the dynamic behaviour of hourly consumption of
electricity during the period of power crisis (“dumsor” period) in Ghana using
two-state Markov switching autoregressive (MS-AR) and autoregressive (AR)
models. Hourly data between the periods of January 1, 2014, and December 31,
2014 was obtained from the Ghana Grid company and used for the study. Using
different information criteria, the MS(2)-AR(4) is selected as the optimal
model to describe the dynamic behaviour of electricity consumption during
periods of power crisis in Ghana. The parameters of the MS(2)-AR(4) model are
then estimated using the expectation-maximization algorithm. From the results,
the likelihood of staying under a low electricity consumption regime is
estimated to be 87%. The expected duration for a low electricity consumption
regime is 7.8 hours daily, and the high electricity consumption regime is
expected to last 2.3 hours daily. The proposed model is robust as compared to
the autoregressive model because it effectively captures the dynamics of
electricity demand over time through the peaks and significant fluctuations in
consumption patterns. Similarly, the model can identify distinct regime
changes linked to electricity consumption during periods of power crises.

###### keywords:

Energy Consumption; Regime changes; Power crisis; Energy Sustainability

label1label1footnotetext: correspondence<EMAIL_ADDRESS>
##  1 Introduction

While energy supply in Ghana has been relatively stable in recent years, the
country has been beset by energy supply issues in the past, which have had a
substantial impact on the country’s economic status [1]. This is due to either
low levels of water in the dams or technical malfunctions of equipment caused
by high amounts of water. However, the issue of electricity generation and
delivery does not appear to be limited to Ghana; it appears to be a concern in
many developing countries, including all members of the Economic Community of
West African States (ECOWAS). In Ghana, electricity consumption is constantly
plagued with power outages and fluctuations popularly known as “DumSor”.
According to [2], the Economic Community of West African States (ECOWAS) aims
to achieve 100% electrification in all member countries by 2030, and that in
order to do so, energy generation capacities must be greatly increased.
Ghana’s electricity sector is in a period of transition and its electricity
consumption growth rate for the past five years has been increasing by 10.3%
annually, with supply falling short of expectations, [3]. Projections were
made in line with ECOWAS’ aim to make electricity accessible to all Ghanaians
by 2020 [4]. But as at the end of 2019, the access rate was 83.5% and with a
growth rate of 3.13%, the country missed the target by 14%. The actual
challenge is ensuring that this aim is met and, more importantly, that supply
is both consistent and enough. Ghana, as at 2021, still experiences nationwide
blackouts like on Sunday, March 7th, 2021 and load shedding exercises like the
Volta and Oti Region load shedding operation from Thursday, March 18th, to
Monday, March 21st, 2021. In addition, the annual increase in electricity
demand has caught up with available generation, leaving very little spare
capacity to deal with a system outage.
Different techniques for modelling hourly electricity consumption have been
studied in the literature. For instance, [5] used the self-exciting threshold
autoregressive (SETAR) model and the smooth transition regression (STR) model
to model, analyze, and forecast the residential electricity consumption in
Ethiopia. The study showed that the SETAR model was more effective than the
STR model. [6] used a back propagation neural network to model electricity
consumption. In a study conducted by [7], a regression model was used to
generate hourly electricity consumption over the course of a year for the
commercial and industrial sectors of three US cities. The model was built
using hourly datasets from the previous four years. [8] considered a new
extension of the stochastic Gamma diffusion process by introducing time
functions to model electric power consumption during a period of economic
crisis. [9] employed bottom-up stochastic models to simulate high-resolution
heating and cooling electricity consumption profiles. In a recent study, [10]
used the Markov process technique, feature selection, and clustering to model
electricity consumption forecasting for Bushehr-Iran Power Distribution
Company. [11] used principal component analysis to model the monthly
electricity consumption of public sanitary buildings using climatological
variables.
Globally, household electricity consumption is affected by factors like
seasons, the number of occupants living in the house, the income of the
household, and time of day. People also consume electricity in different ways
and with different degrees of urgency. The variation in Ghana’s household
electricity consumption is greatly affected by the time of day, where low
consumption is recorded during the early hours of the day and high consumption
is usually in the evening and nighttime since most people are employed during
the day. Understanding how variation in residential electricity demand affects
consumers and businesses alike is crucial for sustainability programs.
Typically, time series models are commonly used to evaluate the transient
behaviour of variables like power demand, exchange rates, and temperature,
among others. The mixed autoregressive moving averages (ARMA), moving average
(MA), and autoregressive (AR) models are the most popular and often used
models. Although these models are highly effective in a variety of
applications, they are incapable of representing certain nonlinear dynamic
patterns, such as asymmetry, amplitude dependency, and volatility clustering.
For example, electricity consumption normally fluctuates during the time of
the day, with high and low consumption depending on the time of the day (see
Figure 2). With this kind of data, it would be inefficient to think that a
single linear model could explain all of these different behaviors. Markov
switching models (MSM) are a type of nonlinear time series model that has
become popular for explaining how different time series regimes behave.
According to [12], the Markov switching model consists of a set of models that
may characterize time series behavioural patterns under various regimes. The
switching technique is regulated by a latent state variable that assumes the
process of a “first-order Markov chain,” which is a distinctive aspect of the
Markov switching model. For instance, [13] modeled electricity spot prices
using regime-switching models. [14] used full-period, pre-reform, and post-
reform sample times to model the demand for electricity in Ghana based on the
effects of policy regime switching. The study found that technology changes
were energy-saving during the pre-reform period, while technology changes were
energy-consuming during the post-reform period. Using the entire sample
period, electricity demand in the long run is highly influenced by GDP and
industry efficiency. [15] developed a time-dependent two-state Markov Regime
Switching (MRS) model to capture the hourly spot price of electricity. The
constructed model was efficient as it was able to capture the main
characteristics exhibited in the hourly electricity spot price. To model the
dynamics of temperature for weather derivatives, [15] used a time-changing
mean-reversion Levy regime-switching model to capture both normal and extreme
temperature fluctuations. [16] described “El Nino Southern Oscillation (ENSO)”
patterns using a two-state Markov regime-switching framework. They discovered
that the behavioral patterns of both research phases (El Nino and La Nina
events) are diametrically opposed and distinct. The findings of the study also
show that, while the Box-Jenkins approach produces a decent representation of
the time series under review, it is unable to capture some nonlinearities that
arise as a result of the presence of changing regimes. Furthermore, it was
shown that the presence of weather cycles necessitates the origin of non-
linear factors in many climatic time series for describing climatic variables.
The model was able to reflect the index’s properties across time. This study
therefore employs a Markov regime switching model to model electricity
consumption since its switching mechanism can capture the distinct behaviour
of electricity consumption. Specifically, the objective of this paper is: (1)
to model the consumption of electricity during periods of power crisis using a
Markov-regime switching model and (2) to estimate the expected duration of
each regime for the selected period.
The paper is organized as follows. The Markov switching autoregressive model
and parameter estimate of the model using the expectation maximization
algorithm are presented in Section 2. In section 3, the data description and
analysis are presented. The results and analysis are presented in Section 4,
whilst the conclusion and policy recommendations are presented in Section 5.

##  2 Markov Switching Autoregressive (MS-AR) Model

The MS-AR model’s point of reference is the Markov chain. An approach called
the Markov chain explains how the likelihood of the occurrence of an event
depends solely on the attained state of a prior event. The constructed Markov
switching model is based on the studies of [12] and [17].

###  2.1 Markov Switching (MS) Model

An MS model is the name given to a combination of discrete-time stochastic
processes, one of which is unobserved(latent) and the other of which is
observed. The dynamics of the process that is not being observed affects that
of the observed. As a result, the series of observations can be used to
rebuild the distribution of the unobserved process [18]. Given that the Markov
chain is conditionally autoregressive, the unobserved process is a Markov
chain with finite-state defined as $s_{t}$, whereas the observable process is
defined as $y_{t}$.
Let $s_{t}$ denote an unobservable state variable assuming the value one or
two. A simple switching model for the variable $y_{t}$ involves two AR
specifications:

$y_{t}=\left\\{\begin{array}[]{lr}\alpha_{0}+\beta
y_{t-1}+\epsilon_{t},&s_{t}=1\\\ \alpha_{0}+\alpha_{1}+\beta
y_{t-1}+\epsilon_{t},&s_{t}=2\end{array}\right.$ (1)

where $|\beta|<1$ and $\epsilon_{t}\thicksim
i.i.d.N(0,\sigma_{\epsilon}^{2})$. When $s_{t}=0$, $y_{t}$ is a stationary AR
(1) process with mean $\alpha_{0}/(1-\beta)$ and when $s_{t}$ changes from 1
to 2, $y_{t}$ switches to another stationary AR(1) process with mean
$(\alpha_{0}+\alpha_{1})/(1-\beta)$. Based on the value of the state variable
$s_{t}$, this model accepts two dynamic structures at various levels if and
only if $\alpha_{1}\neq 1$. $s_{t}$ controls the switching between these two
states which are two distinct distributions with different means coming
together to form $y_{t}$.

###  2.2 Autoregressive (AR) Models

An Autoregressive model is a specific type of regression model for time series
where a value from the series is regressed on prior value(s) of that same
series. For example,

$y_{t}=\alpha_{0}+\alpha_{1}y_{t-1}+\epsilon_{t}$ (2)

In model (2) response variable from the preceding time period, $y_{t-1}$, has
been transformed into a predictor. Under the usual assumptions, the error
terms are $\epsilon_{t}\thicksim i.i.d.N(0,\sigma_{\epsilon}^{2})$.
The number of immediate past values used in predicting the current time value
determines the order of the AR model. A first-order autoregressive Model
abbreviated as AR (1) is given by (2).
Using two prior values of the time series as predictors in the model changes
the model from AR (1) to AR (2), a second-order autoregressive Model which can
be written as;

$y_{t}=\alpha_{0}+\alpha_{1}y_{t-1}+\alpha_{2}y_{t-2}+\epsilon_{t}$ (3)

A generalized autoregressive model of the $p$-th-order abbreviated as $AR(p)$
is obtained by incorporating prior values of the series at times
$t-1,t-2,\dots,t-p$ as predictors into a multiple linear regression model to
predict the current time value. This model may be expressed as follows:

$y_{t}=\alpha_{0}+\alpha_{1}y_{t-1}+\alpha_{2}y_{t-2}+\dots+\alpha_{p}y_{t-p}+\epsilon_{t}$
(4)

The model given by (4), predicts $y_{t}$ based on the prior time values to
time $t-p$.

###  2.3 Markov Switching Autoregressive (MS-AR) Models

The MS-AR model requires a probabilistic process to govern the transition of
$y_{t}$ from one regime (state) to another. In our case, a two-state Markov
chain is used. This chain assumes that the probability of being in state
$s_{t}$ is solely determined by the previous value of state $s_{t-1}$.

$P_{r}(s_{t}=j|s_{t-1}=i,s_{t-2}=k,...)=P_{r}(s_{t}=j|s_{t-1}=i)=p_{ij}$ (5)

where the transition probability $p_{ij}$ which depicts the possibility of
moving to state $j$ following that the process is in state $i$ satisfies
equation (6)

${\sum}_{j=1}^{K}\,\,p_{ij}=1$ (6)

The shift between regimes in the MS-AR models is governed by an unobserved
Markov chain which is based solely on the observed time series. Model (7)
summarized the general form of the MS-AR model

$(y_{t}-\mu_{s_{t}})={\sum}_{i=1}^{K}\,\,\beta_{i}(y_{t-i}-\mu_{s_{t-i}})+\epsilon_{t}$
(7)

where the relevant observations are given by $y_{t}$, the coefficients are
$\beta_{i},i=1,\dots,K$, $s_{t}$ is the regime at time $t$, $\mu_{s_{t}}$ is a
constant that depends on the regime $s_{t}$, and the distribution of
$\epsilon_{t}$ is Gaussian $N(0,\sigma^{2})$.
The conditional likelihood density model (Equation 8) can be used to depict
the likelihood density model of $y_{t}$ given the stochastic variable $s_{t}$
for $j=1,2,\dots,K$.

$f(y_{t}|s_{t}=j;\mu_{j},\sigma_{j}^{2})=\dfrac{1}{\sqrt{2\pi\sigma_{j}^{2}}}exp\left(\dfrac{-(y_{t}-\mu_{j})^{2}}{2\sigma_{j}^{2}}\right)$
(8)

Certain stochastic distributions determine the hidden or latent regime
$s_{t}$. Equation (9) shows how the model is represented by $\pi_{j}$ for the
marginal likelihood of $s_{t}$ and $j=1,2,\dots,K$.

$\pi_{j}=Pr(s_{t}=j;\theta)$ (9)

$\theta$ includes the likelihood of $\pi_{j}$, where
$\theta=(\mu_{1},\mu_{2},\dots,\mu_{K},\sigma_{1}^{2},\sigma_{2}^{2},\dots,\sigma_{K}^{2},\pi_{1},\pi_{2},\dots,\\\
\pi_{K})$.

###  2.4 Parameter Estimation of MS-AR model

The expectation maximization (EM) approach is used to estimate the model’s
parameters. In doing so, a preliminary estimate of the probability density
function is made. This function is then used to derive the log-likelihood
function. This process of estimation can be divided into two main steps.

####  2.4.1 Derivation of joint density function of $y_{t}$, $s_{t}$ and
$s_{t-1}$

The first step is to consider the joint density of $y_{t}$, $s_{t}$, and
$s_{t-1}$ conditioned on $psi_{t-1}$ information. To achieve this, we must
derive the density function of $y_{t}$. This is produced from a fundamental
analysis of a two-state Markov switching model with a first order
autoregressive term using the the MS-AR model in (7) and the transition
probability condition in (6) as shown in model equation (10).

$f(y_{t}|s_{t},s_{t-1},\psi_{t-1};\theta)=\dfrac{1}{\sqrt{2\pi\sigma_{s_{t}}^{2}}}exp\left(\dfrac{((y_{t}-\mu_{s_{t}})-\beta_{1}(y_{t-1}-\mu_{s_{t-1}}))^{2}}{2\sigma_{s_{t}}^{2}}\right)$
(10)

where $\psi_{t-1}$ refers to information up to time $t-1$ and
$\theta=(\mu_{1},\mu_{2},\sigma^{2},\beta_{1})$ is the parameter space of the
MS(2)-AR(1) model.
Then the joint density of $y_{t}$, $s_{t}$ and $s_{t-1}$ conditioned on
$\psi_{t-1}$ is:

$\begin{split}&f(y_{t},s_{t},s_{t-1}|\psi_{t-1};\theta)=f(y_{t}|s_{t},s_{t-1},\psi_{t-1};\theta)\times
Pr(s_{t},s_{t-1}|\psi_{t-1};\theta)\end{split}$ (11)

where $f(y_{t}|s_{t},s_{t-1},\psi_{t-1};\theta)$ is given by (10).

####  2.4.2 Aggregation of Densities Over Regime

Aggregating the joint density in equation (11) over all possible values for
both $s_{t}$ and $s_{t-1}$ yields the marginal density:

$\begin{split}&f(y_{t}|\psi_{t-1};\theta)\\\
&={\sum}_{s_{t}=1}^{K}\,\,{\sum}_{s_{t-1}=1}^{K}f(y_{t},s_{t},s_{t-1}|\psi_{t-1};\theta)\\\
&={\sum}_{s_{t}=1}^{K}\,\,{\sum}_{s_{t-1}=1}^{K}f(y_{t}|s_{t},s_{t-1},\psi_{t-1};\theta)\times
Pr(s_{t},s_{t-1}|\psi_{t-1};\theta)\end{split}$ (12)

Then the log-likelihood function is given by:

$\begin{split}\ln
L(\theta)={\sum}_{t=1}^{T}\,\,\ln\left\\{{\sum}_{s_{t}=1}^{K}\,\,{\sum}_{s_{t-1}=1}^{K}f(y_{t}|s_{t},s_{t-1},\psi_{t-1};\theta)\times
Pr(s_{t},s_{t-1}|\psi_{t-1};\theta)\right\\}\end{split}$ (13)

To complete the above procedure, we still need to deal with the challenges in
the calculation of $Pr(s_{t},s_{t-1}|\psi_{t-1};\theta)$. The filtering and
smoothing algorithms are used to assess the probability that an observation
will follow a particular pattern from one observation $t-1$ to the next $t$.
The filtering algorithm is illustrated with the two steps below:
STEP 1: At the $t$-th iteration or beginning of time $t$,
$Pr(S_{t-1}=i|\psi_{t-1};\theta),,i=1,2,\dots,K$ is already know. Then the
weighting terms $Pr(s_{t}=j,s_{t-1}=i|\psi_{t-1};\theta),\,i=j=1,2,\dots,K$
can be calculated as

$\begin{split}&Pr(s_{t}=j,s_{t-1}=i|\psi_{t-1};\theta)=Pr(s_{t}=j|s_{t-1}=i|;\theta)\times
Pr(s_{t-1}=i|\psi_{t-1};\theta)\\\ \end{split}$ (14)

where $Pr(s_{t}=j|s_{t-1}=i|;\theta),\,i=j=1,2,\dots,K$ are the transition
probabilities.
STEP 2: At the end of the $t-th$ iteration or the end time $t$, $y_{t}$ will
be observed. We will then update the probability terms as follows:

$\begin{split}&Pr(s_{t}=j,s_{t-1}=i|\psi_{t-1},y_{t};\theta)\\\
&=\dfrac{f(y_{t},s_{t}=j,s_{t-1}=i|\psi_{t-1};\theta)}{f(y_{t}|\psi_{t-1};\theta)}\\\
&=\dfrac{f(y_{t}|s_{t}=j,s_{t-1}=i,\psi_{t-1};\theta)\times
Pr(s_{t}=j,s_{t-1}=i|\psi_{t-1};\theta)}{{\sum}_{s_{t}=1}^{K}\,\,{\sum}_{s_{t-1}=1}^{K}f(y_{t}|s_{t},s_{t-1},\psi_{t-1};\theta)\times
Pr(s_{t},s_{t-1}|\psi_{t-1};\theta)}\end{split}$ (15)

with

$\begin{split}Pr(s_{t}=j|\psi_{t-1},y_{t};\theta)={\sum}_{i=1}^{K}Pr(s_{t}=j,s_{t-1}=i|\psi_{t-1},y_{t};\theta)\\\
\end{split}$ (16)

Iterating the above two steps for $t=1,2,\dots,T$ provides us with the
appropriate weighting terms in (12).
The smoothing algorithm on the other hand uses all the observation in the
sample. This gives $Pr(s_{t}=j|\psi_{T};\theta),\,t=1,2,\dots,T,$ which is the
smoothed probability as opposed to
$Pr(s_{t}=j|\psi_{t-1},y_{t};\theta)=Pr(s_{t}=j|\psi_{t};\theta),\,t=1,2,\dots,T,$
which is the filtered probability in (16), [19].
The smoothing algorithm as illustrated below considers the derivation of the
joint probability that $s_{t}=j$ and $s_{t+1}=k$ is based on the full
observation:

$\begin{split}&Pr(s_{t}=j,s_{t+1}=k|\psi_{T};\theta)\\\
&=Pr(s_{t+1}=k|\psi_{T};\theta)\times Pr(s_{t}=j,s_{t+1}=k|\psi_{t};\theta)\\\
&=\dfrac{Pr(s_{t+1}=k|\psi_{T};\theta)\times
Pr(s_{t}=j,s_{t+1}=k|\psi_{t};\theta)}{Pr(s_{t+1}=k|\psi_{t};\theta)}\\\
&=\dfrac{Pr(s_{t+1}=k|\psi_{T};\theta)\times Pr(s_{t}=j|\psi_{t};\theta)\times
Pr(s_{t+1}=k|s_{t}=j;\theta)}{Pr(s_{t+1}=k|\psi_{t};\theta)}\\\ \end{split}$
(17)

and

$\begin{split}Pr(s_{t}=j|\psi_{T};\theta)={\sum}_{k=1}^{K}Pr(s_{t}=j,s_{t+1}=k|\psi_{T};\theta)\\\
\end{split}$ (18)

The basic filter’s last iteration produces $Pr(s_{T}|\psi_{T})$ which would be
use in the above iteration for $t=T-1,T-2,\dots,1$ to generate the smoothed
probabilities, $Pr(s_{t}|\psi_{T}),\,\,t=T-1,T-2,\dots,1.$
There are two limiting models, $\pi 1$ and $\pi 2$, for a two regime MS-AR
model. As stated in model (19), the maximum likelihood in the Lagrange model
is estimated using the log-likelihood approach.

$\begin{split}J(\theta)=\ln{L(\theta)}+\lambda(1-\pi 1-\pi 2)\end{split}$ (19)

We then differentiate each of the parameters in
$\theta=(\mu_{j},\sigma_{j}^{2},\pi_{j},\beta_{j})$ and equating to zero, the
parameter estimates can be maximized on $\theta$. This is illustrated in (20)

$\begin{split}\dfrac{\partial\ln{L(\theta)}}{\partial\theta}={\sum}_{t=1}^{T}\dfrac{1}{f(y_{t};\theta)}\times\dfrac{\partial{f(y_{t};\theta)}}{\partial\theta}\end{split}$
(20)

The MS-AR model parameters can be estimated with the equations below:

$\begin{split}\mu_{j}=\dfrac{{\sum}_{t=1}^{T}\,\,y_{t}\times
Pr(s_{t}=j|y_{t};\theta)}{{\sum}_{t=1}^{T}\,\,Pr(s_{t}=j|y_{t};\theta)}\end{split}$
(21)
$\begin{split}\sigma_{j}^{2}=\dfrac{{\sum}_{t=1}^{T}\,\,(y_{t}-\mu_{j})^{2}\times
Pr(s_{t}=j|y_{t};\theta)}{{\sum}_{t=1}^{T}\,\,Pr(s_{t}=j|y_{t};\theta)}\end{split}$
(22)
$\begin{split}\pi_{j}=\dfrac{1}{T}{\sum}_{t=1}^{T}\,\,Pr(s_{t}=j|y_{t};\theta)\end{split}$
(23)
$\begin{split}\beta_{j}=\dfrac{{\sum}_{t=1}^{T}\,\,{\sum}_{j=1}^{K-1}\,\,(y_{t}-\mu_{j})\times
Pr(s_{t}=j|\psi_{T};\theta)}{{\sum}_{t=1}^{T}\,\,{\sum}_{j=1}^{K-2}\,\,Pr(s_{t}=j|\psi_{T};\theta)}\end{split}$
(24)

The expected duration of the regimes is then estimated with the equation
below:

$\begin{split}E(D)=\dfrac{1}{1-p_{jj}}\end{split}$ (25)

##  3 Data Description

The electricity consumption data was obtained from the Ghana Grid Company
(GRIDCO) limited. The data was analyzed from January 1, 2014, to December 31,
2014. The data obtained is the hourly power consumed by all installations
linked to the distribution network. This study period is the period where
Ghana was in a power crisis which was popularly referred to as “dumsor”
period.
Multilevel seasonality is an essential characteristic of electricity
consumption; the consumption pattern varies by month, day of the week, and
hour of the day. These seasonalities are highly predictable and can be
deterministically modelled. Figure 1 shows the time series plot of the hourly
electricity consumption data for the period under study. The plot exhibits
seasonal movement. Generally, it can be seen that the electricity consumption
during the power crisis is mean-reverting, that is, it reverts back to its
mean, which is about 1488 MW. Figure 2 shows changes in the consumption of
electricity for a period of one month. Clearly, there are two distinct periods
that can be characterized by this plot–high and low consumption periods. This
can be attributed to the fact that electricity consumption during the power
crisis period was lower in the early hours of the day and higher in the latter
hours of the day. Each of these two periods is characterized by distinct
behavioral tendencies that are inherently opposed to one another. The length
of the phases that occur between the two, however, is unknown. The MS-AR
approach can be used to model the electricity consumption data based on the
above-mentioned conditions. The low consumption state is determined to be
state one (1), while state two (2) is designated as the high consumption
state.
The descriptive statistics are shown in Table 1. The skewness values are
observed to be above $0$ which indicates the consumption series is positively
skewed and, as such, not normally distributed. The kurtosis is 0.2580, which
implies that the distribution of the series is leptokurtic. The standard
deviation value clearly shows that there is high volatility in the amount of
electricity consumed during the electricity crisis period.

Table 1: Descriptive Statistics of hourly electricity consumption for 2014

| Minimum | Maximum | Mean | Standard Deviation | Skewness | Kurtosis
---|---|---|---|---|---|---
2014 | 809 | 1974 | 1488.0913 | 142.7847 | 0.1885 | 0.2580

Figure 1: Plot of Hourly Electricity Consumption Time Series Data Figure 2:
Illustration of electricity consumption during time of the day over a one
month period

The ACF plots in Figure (3) clearly show a daily seasonal trend with peaks at
24 hours, 48 hours, 72 hours, and so on. Consider the equation below:

$L(t)=\tilde{L}_{t}+C_{t}$

where $L(t)$ is the hourly electricity consumption, $\tilde{L}_{t}$ is the
deseasonalized electricty consumption and $C_{t}$ is detrministic seasonal
component for
$t=0\mbox{hour},1\mbox{hour},2\mbox{hours},3\mbox{hours},\cdots$. From
Equation (3), the electricity consumption data can be deseasonalized.

Figure 3: ACF Plot of Time Series Data 2014

###  3.1 Test for Stationarity of Deseasonalized Data

A stationarity test was done on the data to ascertain if a unit root exists or
not. The ADF and PP tests are the methodologies used in this case. The results
are presented in Table 2 and 3 respectively. The ADF test for the three years
covered by the study is summarized in Table 2. Several exogenous factors
(without constant, with constant, and with constant and trend) are used in
this test. The test results indicated that, regardless of the exogenous
factors utilized, the series for the various years is stationary since the
absolute value of the test statistics of all the three years’ test results is
greater than the absolute of the corresponding critical value. The PP unit
root test result is shown in Table 3. The series is stationary, as evidenced
by the test results for all three years.

Table 2: ADF Test Results of hourly electricity consumption for 2011, 2014,
2017

Year | Test Statistics | 5% Critical Value
---|---|---
Without Constant |  |
2014 | -2.2313 | -1.95
With Constant |  |
2014 | -24.3513 | -2.86
With Constant and Trend |  |
2014 | -27.8649 | -3.41

Table 3: PP Test Results of hourly electricity consumption for 2011, 2014,
2017

Year | Test Statistics | 5% Critical Value
---|---|---
With Constant |  |
2014 | -20.8710 | -2.862418
With Trend |  |
2014 | -23.6494 | -3.413069

###  3.2 Correlogram

The number of significant autoregressive terms needed to estimate the
parameters, including the transitional probabilities and autoregressive
coefficients, is obtained from the partial autocorrelation function (PACF) and
autocorrelation function (ACF) plots. To correctly model the electricity
consumption data sets, it is essential to obtain a lag order that will result
in the best autoregressive model. The PACF plot is used to establish the
optimal order of the AR process since it eliminates differences caused by
prior lags and keeps only the pertinent features. Utilizing the PACF also
guarantees that only the necessary features or lags are kept, which is another
benefit. PACF plots of the deseasonalized time series for 2011, 2014, and 2017
are shown in Figure 4. For the period under consideration, lags 1, 2, 3, and 4
are statistically significant enough to be incorporated into the model.

Figure 4: ACF and PACF plots of Deseasonalized 2011 Data

##  4 Results and Analysis

###  4.1 Markov Switching Autoregressive Model Parameter Estimation

From Figure (4), the PACF suggested we consider an AR(1), AR(2), AR(3) and
AR(4) for our MS(2)-AR(p). model.
To select the optimum model that describes the phenomenon, lag values 1,2,3,4
of the MS(2)-AR(p) models are analyzed and the AIC, BIC, HQC and log-
likelihood values were calculated. The model with the greatest log-likelihood
value but least AIC, BIC, and HQC values performs better than the others.
Using the Log-likelihood, AIC, BIC, and HQC values, the best model obtained
from Table (4) was MS(2)-AR(4).

Table 4: Models for 2014 Hourly Electricity Consumption Data

Model | AIC | BIC | HQC | Log-likelihood
---|---|---|---|---
MS(2)-AR(1) | 90520.77 | 90585.39 | 90530.43 | -45256.39
MS(2)-AR(2) | 90413.28 | 90510.21 | 90427.75 | -45200.64
MS(2)-AR(3) | 90391.16 | 90520.40 | 90410.45 | -45187.58
MS(2)-AR(4) | 90381.16 | 90542.71 | 90405.28 | -45180.58

To ascertain the efficiency of the MS(2)-AR(4) model, it is compared with four
(4) single-state models: AR(1), AR(2), AR(3), and AR(4). AIC, BIC, HQC, and
log-likelihood are used to select the best model. From Table 5, the AIC, BIC,
and HQC values of the MS(2)-AR(4) model are the lowest, and the log-likelihood
value of MS(2)-AR(4) is the largest. These indicate the superiority of the
constructed MS(2)-AR(4) model in capturing the dynamics of electricity
consumption through time and at different regimes.

Table 5: Comparison of single-state regime models and 2-state regime Model for
Hourly Electricity Consumption

Model | AIC | BIC | HQC | Log-likelihood
---|---|---|---|---
AR(1) | 92472.54 | 92493.78 | 92479.78 | -46233.27
AR(2) | 92293.95 | 92322.26 | 92303.59 | -46142.97
AR(3) | 92272.28 | 92307.67 | 92284.34 | -46131.14
AR(4) | 92269.50 | 92311.97 | 92283.97 | -46128.75
MS(2)-AR(4) | 90381.16 | 90542.71 | 90405.28 | -45180.58

From the parameter estimation procedure using expectation maximization, the
estimates of the model specification (MS(2)-AR(4)) of the transition
probabilities and autoregressive coefficients are computed. The Table (6)
summarizes the estimated parameters. $\mu$ is the estimated regime constant
which depends on $s_{t}$ and the $\beta_{i}$ parameters are the autoregressive
coefficients for the regimes.

Table 6: Estimates of 2014 (during DumSor) Hourly Electricity Consumption
Regime Parameters

Regime | Parameter | Coefficient | Std. Error | t-Statistic | p-value
---|---|---|---|---|---
1 | $\mu$ | 72.9800 | 6.4039 | 11.3962 | <0.0001
| $\beta_{1}$ | 0.8705 | 0.0143 | 60.8741 | <0.0001
| $\beta_{2}$ | 0.0751 | 0.0156 | 4.8141 | <0.0001
| $\beta_{3}$ | -0.0106 | 0.0136 | -0.7794 | 0.4357
| $\beta_{4}$ | 0.0171 | 0.0105 | 1.6286 | 0.1034
2 | $\mu$ | 211.3742 | 27.5262 | 7.6790 | <0.0001
| $\beta_{1}$ | 0.6267 | 0.0303 | 20.6832 | <0.0001
| $\beta_{2}$ | 0.0827 | 0.0387 | 2.1370 | 0.03260
| $\beta_{3}$ | 0.1040 | 0.0439 | 2.3690 | 0.01784
| $\beta_{4}$ | 0.0389 | 0.0376 | 1.0346 | 0.30086

The MS(2)-AR(4) fitted model for 2014 Hourly Electricity Consumption can
therefore be specified as;

$y_{t}=\left\\{\begin{array}[]{lr}0.8705(y_{t-1}-\mu_{s_{t-1}})+0.0751(y_{t-2}-\mu_{s_{t-2}})\\\
-0.0106(y_{t-3}-\mu_{s_{t-3}})+0.0171(y_{t-4}-\mu_{s_{t-4}}),&s_{t}=1\\\
0.6267(y_{t-1}-\mu_{s_{t-1}})+0.0827(y_{t-2}-\mu_{s_{t-2}})\\\
+0.1040(y_{t-3}-\mu_{s_{t-3}})+0.0389(y_{t-4}-\mu_{s_{t-4}}),&s_{t}=2\\\
\end{array}\right.$ (26)

The expected duration of the two regime with the transitional, smoothed, and
filtered probabilities are estimated using the fitted model. The transitional
probabilities for the MS(2)-AR(4) model is illustrated as a matrix bellow:

$P=\left(\begin{array}[]{lr}P_{11}&P_{12}\\\ P_{21}&P_{22}\\\
\end{array}\right)=\left(\begin{array}[]{lr}0.8714&0.1286\\\ 0.4416&0.5584\\\
\end{array}\right)$ (27)

which satisfies Equation (6). From Matrix (27), the likelihood of the
consumption of electricity remaining low during the next hour given that it
was low in the previous hour is $P_{11}=0.8714$ and the likelihood of the
consumption of electricity been high during the next hour given that it was
high in the previous hour is $P_{12}=0.8714$. With a probability of
$P_{22}=0.5584$, the consumption of electricity will remain high during the
next hour given that it was high in the previous hour and with a probability
of $P_{21}=0.4416$ the consumption will move to the low consumption regime.
The expected duration of the low electricity consumption regime in 2014 is at
least 7.8 hours, while the high electricity consumption regime is expected to
last at least 2.3 hours every day.
Figures (5) and (6) illustrate the plots for the filtered and smoothed
probability, respectively. They approximate the odds of remaining in the same
regime to one or zero for a given regime. During a low consumption regime, the
likelihood of being in state 1, $P(S(t)=1)$ is approximately one. This
confirms $P_{11}=0.8714$ in Matrix (27). In contrast, the likelihood of being
in state 2, $P(S(t)=2)$ is approximately zero during a low consumption regime.

Figure 5: Filtered Probability for 2014 Hourly Electricity Consumption Data
Figure 6: Smoothed Probability for 2014 Hourly Electricity Consumption Data

To test the validity of the fitted model, we examined the residuals of the
model with the Durbin-Watson test. The MS(2)-AR(4) has a Durbin-Watson test
statistic of 2.00223, indicating uncorrelated residuals, which implies that
the error terms’ variances are constant. Figure (7) shows the residuals plot.
Data was simulated using the estimated parameter values from the MS(2)-AR(4)
model. The simulated data was fitted to the original deaseasonalized series.
The deseasonalized series, as well as the fitted MS(2)-AR(4) model, are
depicted in Figure (8). The figure shows that the proposed model is capable of
effectively capturing the index’s behavior over time. The suggested model can
identify peaks and significant fluctuations in the electricity consumption
pattern in 2014. Similarly, the model can identify distinct regime swings
linked with electricity consumption.

Figure 7: Residual Plot for 2014 Figure 8: Deseasonalized and fitted plot of
2014

###  4.2 Discussions of Findings

According to the study’s results, the expected duration for low and high
electricity consumption periods is 7.8 and 2.3 hours, respectively, during
periods of power crisis. Transitional periods also exist between these low and
high consumption regimes. These are transitions from a low consumption regime
to a high consumption regime and from a high consumption regime to a low
consumption regime. For the year under consideration, the transition from a
low to high electricity consumption regime and from a high to a low
consumption regime is projected to take at least 1.1 and 1.8 hours,
respectively. It is clear that electricity consumption in Ghana is low on
average, with an erratic pattern. As seen in Figure (1), It also swings and
varies over time, with some extremely low periods of consumption possibly due
to the effects of climate change. This is reinforced by [20], who concludes
that under various scenarios of climate change, temperature rises would impact
household electricity consumption significantly.

##  5 Conclusion and Policy Recommendation

From the study, a two-state MS(2)-AR(4) model best captures Ghana’s electrical
consumption pattern during the period of power crisis. According to the
analysis, the likelihood of maintaining a low electricity consumption regime
in 2014 is estimated to be 87%. During the power crisis, the expected duration
of a low electricity consumption regime is 7.8 hours daily. Over the course of
the entire research period, the high electricity consumption regime is
expected to last 2.3 hours daily.The study calculated the probability of
transitioning from one regime to another as well as the predicted duration for
each regime. This information should be used by electricity distributors to
measure the amount to be distributed on an hourly basis during periods of a
power crisis.

## Declarations

### Funding

This work did not receive any funding.

### Competing Interests

There are no competing interests with the publication of the present
manuscript.

### Availability of data and materials

Data are available from the corresponding author upon request.

## References

  * Kumi [2017] E. N. Kumi, The electricity situation in Ghana: Challenges and opportunities, Center for Global Development Washington, DC, 2017.
  * Adeoye and Spataru [2019] O. Adeoye, C. Spataru,  Modelling and forecasting hourly electricity demand in west african countries,  Applied Energy 242 (2019) 311–333.
  * Energy Commission [2021] Energy Commission, Energy Outlook for Ghana 2021, http://www.energycom.gov.gh/planning/data-center/energy-outlook-for-ghana, 2021\. Last checked on Feb 16, 2022.
  * Eshun and Amoako-Tuffour [2016] M. E. Eshun, J. Amoako-Tuffour,  A review of the trends in ghana’s power sector,  Energy, Sustainability and Society 6 (2016) 1–9.
  * Gabreyohannes [2010] E. Gabreyohannes,  A nonlinear approach to modelling the residential electricity consumption in ethiopia,  Energy Economics 32 (2010) 515–523.
  * Nwulu and Agboola [2012] N. I. Nwulu, O. P. Agboola,  Modelling and predicting electricity consumption using artificial neural networks,  in: 2012 11th International Conference on Environment and Electrical Engineering, IEEE, pp. 1059–1063.
  * Pielow et al. [2012] A. Pielow, R. Sioshansi, M. C. Roberts,  Modeling short-run electricity demand with long-term growth rates and consumer price elasticity in commercial and industrial sectors,  Energy 46 (2012) 533–540.
  * Nafidi et al. [2016] A. Nafidi, R. Gutiérrez, R. Gutiérrez-Sánchez, E. Ramos-Ábalos, S. El Hachimi,  Modelling and predicting electricity consumption in spain using the stochastic gamma diffusion process with exogenous factors,  Energy 113 (2016) 309–318.
  * Palacios-Garcia et al. [2018] E. Palacios-Garcia, A. Moreno-Munoz, I. Santiago, J. Flores-Arias, F. Bellido-Outeirino, I. Moreno-Garcia,  A stochastic modelling and simulation approach to heating and cooling electricity consumption in the residential sector,  Energy 144 (2018) 1080–1091.
  * Dalkani et al. [2021] H. Dalkani, M. Mojarad, H. Arfaeinia,  Modelling electricity consumption forecasting using the markov process and hybrid features selection,  Int. J. Intell. Syst. Appl 13 (2021) 14–23.
  * Pérez-Montalvo et al. [2022] E. Pérez-Montalvo, M.-E. Zapata-Velásquez, L.-M. Benitez-Vazquez, J.-M. Cermeno-Gonzalez, J. Alejandro-Miranda, M.-A. Martinez-Cabero, Á. de la Puente-Gil,  Model of monthly electricity consumption of healthcare buildings based on climatological variables using pca and linear regression,  Energy Reports 8 (2022) 250–258.
  * Hamilton [1989] J. D. Hamilton,  A new approach to the economic analysis of nonstationary time series and the business cycle,  Econometrica: Journal of the econometric society (1989) 357–384.
  * Bierbrauer et al. [2004] M. Bierbrauer, S. Trück, R. Weron,  Modeling electricity prices with regime switching models,  in: International Conference on Computational Science, Springer, pp. 859–867.
  * Adom and Bekoe [2013] P. K. Adom, W. Bekoe,  Modelling electricity demand in ghana revisited: The role of policy regime changes,  Energy policy 61 (2013) 42–50.
  * Gyamerah and Ngare [2018] S. A. Gyamerah, P. Ngare,  Regime-switching model on hourly electricity spot price dynamics (2018).
  * Cárdenas-Gallo et al. [2015] I. Cárdenas-Gallo, M. Sánchez-Silva, R. Akhavan-Tabatabaei, E. Bastidas-Arteaga,  A markov regime-switching framework application for describing el niño southern oscillation (enso) patterns,  in: 12th International Conference on Applications of Statistics and Probability in Civil Engineering (ICASP12).
  * Hamilton [1994] J. D. Hamilton,  State-space models,  Handbook of econometrics 4 (1994) 3039–3080.
  * Kuan [2002] C.-M. Kuan,  Lecture on the markov switching model,  Institute of Economics Academia Sinica 8 (2002) 1–30.
  * Kim [1994] C.-J. Kim,  Dynamic linear models with markov-switching,  Journal of econometrics 60 (1994) 1–22.
  * Avordeh et al. [2021] T. K. Avordeh, S. Gyamfi, A. A. Opoku,  Quantitative estimation of the impact of climate change on residential electricity demand for the city of greater accra, ghana,  International Journal of Energy Sector Management (2021).