Policy Blog Trending

Using R in Energy Markets

In recent years, there has been a number of considerable advances in the use and development of applied analytics, specifically through the statistical language of R. Of particular relevance to this paper is the ways in which these advances can be applied to increasing the supply of renewable electricity into conventional energy markets. This growing interest in using more advanced analytics, rooted in ever-increasing volumes and variety of data which can be used to ensure better that renewable energy supply is being leveraged to meet the rising demand for energy, to achieve core business investment aims, alongside meeting ambitious climate targets to reduce greenhouse emissions from the production and supply of energy. The purpose of this paper is to further contextualize this growth in interest in applied analytics, specifically through the programming language R, within the framework of an understanding of the changing dynamics of energy markets. In particular, this paper is interested in exploring how R can be used to better match energy supply with demand for energy across a number of sectors of the economy through using these advanced analytical methods and approaches. The paper follows with an insight into some of the literature and examples of R based analytics in energy markets and what it means in practice; this is followed by a hypothetical case study of Nordic electricity interconnectors and the potential therein for R based analytics to provide richer insight into how energy efficiencies can be gained from the incorporation of advanced analytics to the data gathered from such an interconnector. Finally, this paper will finish within an insight into the future of energy market analysis, looking specifically at the ramifications of improved analysis for supply firms (most pertinently with regards to investment) and the potential for a near-perfect matching of supply through renewable resources and energy demand and how a selection of empirical methods operationalized through R can serve as the basis for this matching through improvements to forecasting.

Examples of R-Based analytics in energy markets

In the work of a number of scholars, the objective of using R-based analytics is to match better consumer demand with renewable energy supply, most notably in the electricity market. We can see this most clearly in the work of (Panagiotidis, Effraimis, & Xydis, 2019), wherein the authors state that the objective is to “reduce electricity consumption for consumers with an emphasis on the residential sector in periods of increased demand.” The authors seek to achieve this by developing a methodology that analyses energy demand data and, in turn, forecast when consumers should use energy supplied and contributes to an understanding of demand response strategies, which have a number of benefits for energy infrastructure. However, for the purposes of this paper, we focus on its role in matching renewable energy supply with consumer demand to reduce the carbon impact of the energy market. The ways in which the above authors sought to use R in providing a forecast on the energy market was in the realm of using neural networks and time series analysis models (Auto-Regressive Integrated Moving Average (ARIMA) model) which were operationalized through R. The authors note that the differences in forecasting ability do not differ significantly between neural networks and ARIMA. However, given the difficulties with neural networks that the authors instead opt to use ARIMA through R. We can also see that the advantages of using R-based analytics are outlined by the authors wherein they state that the rationale for opting for using R is due to it being “free, open-source and has a vast community of statisticians and machine learning engineers supporting it.

Moreover, the time series packages of R provide us with all the functionalities we need for our study.” This focus on R’s community component is a recurring trend across a number of different studies that rely on R for engaging with data for the energy market and provides a key advantage of R more generally. Indeed, we can also see that a number of firms develop tools for use with R, most notably THEMA’s proprietary power market model (Eriksrud & Schemde, n.d.). This model can be integrated for use with R and can be used for the preparation of price forecasts, scenario analysis, and investment evaluations. We can similarly see an integration of using R in time-series forecasting contained within (Henao, Morales, & Cardona, 2011). It is also possible to use the function within R that is called arima. This broad advantage of R that is constituted by the versatility of the programming language provides a particular benefit to those who seek to undertake an analysis in a sector that produces such larges volumes of data and where improved forecasting offers a number of tangible advantages.

A case study on Scandinavian Electricity Interconnectedness

While there has been an increased focus by scholars on the potential for R-based analytics for the energy market, what could this look like in practice? To answer this question, we can explore recent changes which are taking place in the development of a Nordic electricity grid (although this could be used to explore a number of different electricity grid integration plans) by looking at the recent report compiled by Energinet (Denmark), Fingrid (Finland), Statnett (Norway) and Affärsverket Svenska kraftnät (Sweden). We can observe some notable examples of not only the core benefits of increased interconnectedness of electricity grids (of which is beyond the remit of this paper), but more pertinently how using R-based analytical methods can provide greater insight into how to maximize the benefits from grid interconnectedness (Statnett, Fingrid, Energinet, & Svenska Kraftnat, 2019), both to suppliers of electricity through a richer understanding of returns based on investments into supply and from users of electricity through increased savings from better demand response strategies which lead to lower costs of energy usage and better utilization of the advantages of an enlarged grid network.

Given that the report mentioned above highlights “end-consumer flexibility, flexible industrial consumption, and large-scale batteries” as key drivers of change within the energy market, there is an importance to evaluating how using methods such as neural networks, ARIMA, and time-series forecasting allow R-based analytics within the energy market to play an increased role in addressing these particular issues. This can be achieved by addressing end-consumer flexibility through the use of big data, most notably with regards to the velocity in which increasing volumes of consumer data can be paired with data on supply to better ensure that load times are matched with anticipated consumer preferences, as such this also constitutes an increased focus on the variety of data (in particular here we would identify data generating appliances, such as the variety offered through the internet of things, and smart home appliances being a particularly novel data source which can lead to real improvements in forecasting abilities). We can similarly see such increased volumes of data stemming from users of energy helping address the challenges inherent within industrial consumption with the aim being to better balance the demand placed on an energy network to more favorable times in keeping with the intermittence of many renewable sources (a notable example being the increasing use of wind and solar resources, without reliance on battery technologies when those particular resources are maximizing their output). The changes which an interconnector can bring to national and regional energy markets can be considerable. However, integrating in recent advances in R-based analytics allows for better modeling of prices and demand; as an example, we can see that among traders across a variety of sectors, the relevance of R for modeling and forecasting can be an incredibly powerful addition to a traders toolkit (Sueppel, 2019) to better gauge changes in prices and similarly in forecasting, two particularly important uses of R relevant for this paper. With a key assumption of the report mentioned above on the Nordic interconnector, being that energy demand will increase by 15% within the Nordic region, there are a number of infrastructural investments which will be necessary to satisfy this demand, however through improved load-forecasting, it also becomes possible to organize demand on the electricity network better, we can see this work similarly being achieved through R, in the work of (Kalam, Niazi, Soni, Siddiqui, & Mundra, 2019, p. 227) These approaches provide a useful insight into how through the use of R, we can see that improved supply interconnectedness can produce a situation wherein renewable energy sourced from North Sea wind farms for example in Denmark and Norway can provide a renewable source of energy to regions in Sweden and Finland. Similarly, hydropower sources in Norway can support regions that rely on solar power when those sources may not be running at full productivity. It is in this that we can see that through using R-based analytics, not only do projects become more viable and sustainable, but that through forecasting and using increased volumes of data, it becomes more straightforward to classify peak times over a seasonal timespan better to anticipate storage and supply requirements from renewable sources, to diminish the need for coal, oil and gas methods, and that R offers a particular advantage here given the many benefits referred to by authors previously.

Of particular note to the changing nature of the energy market and the ways in which analytics can help overcome particular challenges is with regards to the energy balance, this is the process whereby supply meets demand, and accurate and timely forecasting is particularly important in overcoming this challenge in the future of the energy market, and as such an incorporation of R-based analytics provides a series of approaches which can help in producing these more accurate forecasts through the use of machine learning approaches, and the analysis of data which takes account of seasonal trends in energy usage, alongside providing assistance to energy users in optimizing when processes will take place (such as running energy-intensive home washing machines during off-peak, high energy producing times). Rigorously analyzing this available data is likely to grow in importance not only to consumers and producers of energy but also to policymakers who can seek to offset carbon emissions by further incentivizing the usage of renewable, lower-carbon sources of energy into the process.

The future of energy market analysis

The changes that are impacting the processes and investments within the energy market are considerable. With a number of countries and regions making substantial commitments to reduce their carbon emissions, changes in the energy sector constitute a sector wherein this reduction can be met in a significant part. But what does this mean when we look at the change in analytical methods which we can use, and how will changes in relational data management alter the way in which energy (specifically electricity) is consumed and produced, and what impact will this have on often costly investment decisions is rooted in how best forecasting can be improved through the use of R-based analytics.

As mentioned previously, the Auto-Regressive Integrated Moving Average (ARIMA) model has found widespread use by a number of scholars (Jakaša, Andročec, & Sprčić, 2011; Panagiotidis et al., 2019). However, a key advantage of this model, which is largely focused on time-series data, is that they provide a clear interpretability of each predictor variable’s exact influence to a prediction result (Panagiotidis et al., 2019). The reason R is particularly useful in this regard is that the ARIMA model, amongst a number of others models which are focused on time-series and linear problems are possible through the use of an R package called ‘forecast’ (Rob, Ihaka, Reid, & Shaub, 2020). Given the logical flow in which packages can be incorporated into R loops, it then becomes possible to run iterations based on updated data, to make timely, accurate and low computationally intensive forecasts, which can further aide in making recommendations to consumers of energy, alongside aiding in providing accurate, and robust forecasts which can provide better certainty in the effectiveness of particular investments.

It is for this reason that the future of the energy market is likely to be dominated by the advances we can observe taking place in analytical methods, most notably those which are developed in the R language, due to the many advantages which this language possesses, and how to engage with the large swathes of new data sources we can observe coming on stream in the not too distant future such as smart appliances, it is likely that on both the consumption of energy side and also in producing better forecasts rooted deeply in the advances we can observe in machine learning that R-based analytical methods are likely to rise in importance and that as bigger datasets are developed and over a longer timespan, the accuracy in which forecasting models can be applied is only likely to increase, and for this reason, we are likely to observe considerable growth in interest by a number of stakeholders involved in the energy market into the future given this factor.


Eriksrud, A. L., & Schemde, A. von. (n.d.). Power market model. Retrieved 3 December 2020, from Thema.no website: https://thema.no/price-forecasts-and-models/power-market-model/?lang=en

Henao, J. D. V., Morales, Y. O., & Cardona, C. J. F. (2011). Análisis y predicción de series de tiempo en mercados de energía usando el lenguaje R. DYNA (Colombia), 78(165), 287–296.

Jakaša, T., Andročec, I., & Sprčić, P. (2011). Electricity price forecasting ARIMA model approach. 2011 8th International Conference on the European Energy Market, EEM 11, (May), 222–225. https://doi.org/10.1109/EEM.2011.5953012

Kalam, A., Niazi, K. R., Soni, A., Siddiqui, S. A., & Mundra, A. (2019). Intelligent Computing Techniques for Smart Energy Systems: Proceedings of ICTSES 2018. Springer Singapore.

Panagiotidis, P., Effraimis, A., & Xydis, G. A. (2019). An R-based forecasting approach for efficient demand response strategies in autonomous micro-grids. Energy and Environment, 30(1), 63–80. https://doi.org/10.1177/0958305X18787259

Rob, A., Ihaka, R., Reid, D., & Shaub, D. (2020). Forecast package.

Statnett, Fingrid, Energinet, & Svenska Kraftnat. (2019). Nordic Grid Development Plan 2019.

Sueppel, R. (2019). The power of R for trading. Retrieved 3 December 2020, from Systemic risk and systematic value website: https://www.sr-sv.com/the-power-of-r-for-trading-part-1/


Jason Deegan

Jason Deegan is a PhD Candidate (Stipendiat) and research fellow at the University of Stavanger. His work primarily focuses on; Innovation, Regional Studies, Smart Specialisation and Policy.

Leave a Reply