Introduction

Global warming and climate change are currently among the world's most disputed and concerning topics, and there is growing agreement that these concerns must be addressed immediately (Udeagha and Ngepah 2021a, 2021b). In recent years, the world has seen a rapid increase in greenhouse gas (GHG) emissions, such as carbon dioxide (CO2) emissions, which are the driving forces for climate change resulting from internal changes within the climate system, from 22 billion tonnes in 1990 to over 34 billion tonnes emitted annually (World Bank 2021). The assumption that environmental degradation exclusively affects industrialised nations and not poor countries is no longer acceptable, at least in terms of consequences (Bekun et al. 2021). The accumulation of GHG emissions on the earth's surface has a significant impact on all countries, developed and developing, regardless of who is releasing them. The earthquakes in Pakistan and Haiti, the floods in Australia, the fires in Russia, and the tsunami in Japan are just a few of the significant catastrophes that have occurred throughout the world in recent decades that may be linked to the consequences of climate change and environmental degradation (Hu et al. 2021). Many people have died as a result of these catastrophes, which have wreaked havoc on infrastructure and natural resources such as forests, animals, agricultural output, and land throughout the last several decades.

Environmental degradation has become a global problem since every country is affected, and many industrial countries such as Germany, Japan, Russia, India, the USA, and China, who are categorised as large GHG polluters, bear responsibility for protecting the globe (World Bank 2021). Meanwhile, the commitment of these and a few other nations is critical to reducing global CO2 emissions. However, because energy usage is essential for economic growth and CO2 emissions are linked to it, lowering CO2 emissions would result in lower output, which would slow economic growth (Islam et al. 2021). This circumstance makes it extremely difficult for these countries to commit to or follow through on programs that are explicitly meant to reduce global CO2 emissions. As a result, better methods for achieving green economic growth and improved environmental circumstances are required. Some policymakers throughout the globe have embraced a variety of tactics to combat environmental degradation and global warming in this endeavour (Ponce and Khan 2021). One of these measures, paying proper attention to economic policy uncertainty (EPU), is seen to be a useful avenue for enhancing environmental quality.

EPU is a result of the uncertainty created by government policies, notably fiscal and monetary policies, which have an impact on the economic activities that enterprises engage in (Abbasi and Adedoyin 2021). EPU refers to the occurrences of certain news media references that deal with issues such as uncertainties, policies, government acts, forecaster disagreement rates, and the economy (Gu et al. 2021a). EPU may be linked to the risks posed by the government's uncertain policy responses as an economic agent in addressing specific macroeconomic challenges and introducing certain regulatory measures, which cause households and businesses to become indecisive and uncertain in their own decisions, causing consumption and investment to be halted until confidence in the environment is restored (Syed et al. 2022). EPU, as Knight (1921) points out, comes from agents' incapacity to forecast the likelihood of occurrences occurring. Similarly, Binge and Boshoff (2020) define EPU as a lack of information about a collection of potential outcomes and their associated likelihoods, which makes prediction difficult because the outcome is typically unique and tremendously complex. Similarly, Shabir et al. (2022) see EPU as a result of future policies implemented by state authorities, particularly in the areas of environmental, taxing, fiscal, monetary, and regulatory policies, all of which have an impact on economic activity, market volatility, and the environment in which households and businesses operate. Political and economic uncertainty exists all around the world as a result of global instabilities that have a negative impact on economic activity (Guidolin and La Ferrara 2010). In 2003, for example, the second Gulf War created economic uncertainty in the global market (Rigobon and Sack 2005). In 2008, the globe was hit by a severe financial crisis that resulted in enormous economic hardship (Amin and Dogan 2021). Similarly, in 2009, the Eurozone debt crisis wreaked havoc on several nations, with disastrous repercussions (Chu and Le 2022). At this time, the covid-19 pandemic has become a major concern for every country on the planet (Nakhli et al. 2022). The fact that EPU is institutionally driven has significant negative consequences for the business environment (Ullah et al. 2022), financial markets (Phan et al. 2021), innovation activities(Guan et al. 2021), firm investment (Zhou et al. 2021), and real economy(Gu et al. 2021b).

South Africa has been engaged in a series of internal political upheavals over the last three decades, as well as being exposed to a number of global economic concerns (Wen et al. 2022). The country, like every other emerging economy, is considerably more vulnerable to long-term and severe episodes of uncertainty brought on by political and economic shocks. Frail confidence and prevailing political instability have recently been identified as two important causes for the country's growth estimate for 2018. (International Monetary Fund 2017). Following the global financial crisis of 2008—the Great Recession—and the covid-19 pandemic, which decimated the country, the government and policymakers in South Africa have increasingly focused on uncertainty. For example, millions of South Africans lost their money, houses, and jobs as a result of the global financial crisis of 2008 (Wu and Wu 2021). The crisis wreaked havoc on the country's economy and created so much uncertainty that no one, even the government and policymakers, knew what the country's future contained. As the crisis worsened, so did the economy's consequences, and South Africa's financial market saw a dramatic shift in risk appetite (Albert and Gómez-Fernández 2021). The result was a change from the decades of loose lending conditions to a state of tight credit and, in some cases, a dysfunctional market, accompanied by a loss of company and consumer confidence, with significant negative implications on the economy (Edey 2009). In order to deal with the crisis, the administration ran enormous budget deficits in the public sector. As a result, during a time when a balanced budget and a decrease in the deficit should be strongly pursued in South Africa, this action caused increased uncertainty and enormous amounts of government borrowing (Balcilar et al. 2017). All of these characteristics make South Africa a compelling case study for examining the moderating role of EPU in the traditional EKC framework via the channels of energy intensity, renewable and non-renewable energy consumption, and economic complexity.

South Africa, on the other hand, is classified as the 15th greatest CO2 emitter in the world (1.09 percent of global emissions) and the highest emitter in Africa, with an expected 390 million tonnes in 2020 (World Bank 2021). The usage of coal appears to be the primary cause of the country's ever-increasing CO2 emissions (Udeagha and Ngepah 2021a, 2021b). Coal is the primary source of energy in South Africa, and it is also the primary source of CO2 emissions. Coal accounts for around 77 percent of total primary energy supply, with 2% utilised for residential cooking and heating, 12% for metallurgical industries, 33% for petrochemical industries, and 53% for power generation (Shahbaz et al. 2013). Meanwhile, South Africa has proven coal reserves of 35,053 million tons (MMst) in 2020, and the country is heavily reliant on the energy industry, with coal consumption dominating industrial activities. These characteristics make South Africa an ideal target for this research, which will look at the indirect environmental consequences of EPU via the channels of energy intensity, renewable and non-renewable energy use, and economic complexity.

The influence of EPU on economic activities (such as asset prices, investment, economic growth, stock market volatility, firm investment, innovation activities, financial market, and business environment) in South Africa has been studied in several empirical studies. Kisten (2020) discovered that EPU decreases industrial production and the actual effective exchange rate using a time-varying parameter (TVP) VAR approach for the period 1990–2015. Wu and Wu (2021), who studied the EPU-tourism nexus in South Africa, found a favourable link between EPU and tourist activities. Balcilar et al. (2017) looked at the consequences of monetary policy uncertainty in South Africa and found that when uncertainty rises, interest rates, inflation, and production fall. Wen et al. (2022) found that a rise in monetary policy uncertainty affects stock returns in South Africa using a quantile-on-quantile paradigm. Dave and Aye (2015) investigated the impact of oil price uncertainty on savings in South Africa and discovered that uncertainty reduces savings. Similarly, Salisu and Isah (2021), who looked into the moderating role of EPU in the capital flight-growth nexus from 1986 to 2010, revealed that uncertainty in macroeconomic policies exacerbates capital flight's negative impact on economic growth in South Africa and the rest of Sub-Saharan Africa. Despite the fact that various studies have looked into the influence of EPU on economic activities in South Africa, no research has looked into the direct and indirect impacts of EPU on environmental quality in the country.

Although some empirical studies have investigated the relationship between EPU and environmental quality in a global context by focusing primarily on direct effects of EPU (Abbasi and Adedoyin 2021; Adedoyin et al. 2021), the indirect effects appearing through energy intensity, renewable and non-renewable energy consumption, and economic complexity have been significantly overlooked particularly for South Africa. It is therefore important to note that conducting tests for the indirect effects of EPU on environmental quality through these variables is critical for the following reasons: first, EPU influences energy generation, causes energy prices to fluctuate, and leads to higher energy consumption, all of which deteriorate environmental quality significantly. Given this, this paper finds uniqueness in the fact that previous research has not looked into the role of EPU in energy generation, which has an impact on environmental quality through higher energy intensity, with a large number of previous studies focusing on factors influencing energy demand (Ulusoy and Demiralay 2017; da Silva et al. 2018) and energy causality link (Zafar et al. 2019; Tugcu et al. 2012). Second, EPU determines the levels of renewable and non-renewable energy consumption in an economy because government actions, such as direct investment and subsidies, are designed to create a more favourable macroeconomic environment for energy generation. This encourages investment in the energy sector, which in turn boosts both demand and supply. Previous research has not looked into the role of EPU in promoting environmental quality through the channels of renewable and non-renewable energy consumption, with most studies focusing on either the nexus between renewable energy consumption and environmental quality (Adedoyin et al. 2021; Sharif et al. 2020) or non-renewable energy consumption-pollution relationship (Ponce and Khan 2021; Ibrahim and Ajide 2021a). EPU can stifle energy supply of both renewable and non-renewable energy sources, which has an impact on environmental quality, due to oil shortages and price shocks. We contribute to the current information on energy debate in South Africa by highlighting the moderating influence of EPU on environmental quality through the channels of both renewable and non-renewable energy consumption. Finally, the EPU has an impact on the relationship between economic complexity and environmental quality. Economic complexity refers to a country's diversity of knowledge and how that knowledge is utilised to generate commodities and services in an efficient and productive manner. Because the EPU has such a strong impact on how this knowledge is integrated, it is natural to assume that the nexus between economic complexity and environmental quality is influenced by the unpredictability of economic policy. Previous research has looked into the relationship between economic complexity and environmental quality (Shahzad et al. 2021; Rafique et al. 2021); however, the role that EPU plays in the economic complexity–environmental quality nexus has been largely overlooked. To the best of our knowledge, there is no study that has explored this especially for South Africa. Therefore, this study fills this vital gap in the literature by investigating the moderating role of EPU on environmental quality through the channels of energy intensity, renewable and non-renewable energy consumption, and economic complexity.

Figure 1 depicts the relationship between EPU and CO2 emissions in South Africa from 1960 to 2020. In South Africa, both EPU and CO2 emissions are growing with time, as seen in the graph. On the one hand, like every other emerging economy, South Africa is considerably exposed to chronic and severe bouts of uncertainty stemming from political and economic shocks, as seen in the graph. On the other hand, the graph shows that the country's CO2 emissions in metric tons have been rising from 1960 to 2020. Meanwhile, with an expected 390 million tonnes of CO2 emissions in 2020, South Africa is rated as the 15th greatest emitter in the world and the highest emitter in Africa, accounting for 1.09 percent of global CO2 emissions (World Bank 2021). The increased trend of CO2 emissions, as seen in Fig. 1, visually illustrates this point. The usage of coal, which is the primary source of CO2 emissions, appears to be the cause of the increased trend in South Africa's CO2 emissions. As a result, the purpose of this article is to see if the higher trend in EPU has any meaningful influence on rising CO2 emissions in South Africa between 1960 and 2020.

Fig. 1
figure 1

Trends in economic policy uncertainty and CO2 emissions in South Africa, 1960–2020. Note: (i) We could have used the economic policy uncertainty index (EPU) suggested by Baker et al. (2016), but due to data unavailability for South Africa, this study uses the world uncertainty index (WUI) developed by Ahir et al. (2018) as a proxy for economic policy uncertainty (EPU); (ii) data on WUI(a proxy for EPU) and CO2 emissions are sourced from https://fred.stlouisfed.org/series/WUIZAF, accessed on 22 February 2022 and World Bank World Development Indicators, respectively

The remainder of the work is organised as follows. The second section examines the relevant literature on the link between EPU and environmental quality. The material and methodological framework are discussed in Sect. 3, and the findings are presented in Sect. 4. The policy consequences are discussed in Sect. 5.

Literature review and contributions of the study

This section is divided into two subheadings in this study. We discuss and present theoretical and empirical literature on the EPU–environmental quality relationship in the first subheading, while the literature gap and contributions of the current study to the scholarship on the impact of EPU on environmental quality are discussed and presented in the second subheading.

Review of previous literature

Only a few theoretical studies have been able to relate EPU to environmental quality. For example, Jiang et al. (2019) found two mechanisms via which EPU influences environmental quality, namely direct policy change effect and indirect policy demand effect. The former illustrates how an increase in EPU typically delays and diverts the government's emphasis on resolving environmental deterioration, because more effort is spent to managing uncertainty than improving environmental quality. As a result, all resources are devoted toward ensuring economic stability, resulting in an increase in environmental degradation. According to the latter, the EPU has an impact on the economic behaviour and decision-making activities of both consumers and enterprises when it comes to energy consumption. EPU increases energy usage, which has a negative impact on the environment. However, as Wang et al. (2020) pointed out in another theoretical study, EPU has an impact on environmental quality through consumption and investment channels. On the one side, EPU improves environmental quality by reducing the use of energy-intensive consumable products through the consumption channel. EPU, on the other hand, degrades environmental quality through the investment channel by impeding technological innovation and development as well as limiting investment in research and development (R&D). Uncertainty in economic policy stifles technological innovation, inhibits additional investment in R&D, and so contributes to increased CO2 emissions. Yu et al. (2021) identified three pathways via which EPU effects environmental quality: energy intensity, fraction of fossil fuel energy, and innovation. To begin, the energy intensity channel demonstrates that EPU increases energy intensity, resulting in severe degradation of environmental quality. Second, in terms of the percentage of fossil fuel energy, uncertainty in economic policy leads to an increase in the share of non-renewable energy sources, which significantly increases CO2 emissions. Finally, according to the innovation channel, EPU reduces technological innovation and development, inhibits capital investment in energy-efficient technology, and has a negative impact on environmental quality. Uncertainty in economic policy decreases R&D investment, stifles technological innovation and progress, and increases CO2 emissions.

Several research have looked at the EPU–environmental quality nexus, according to empirical literature. However, the findings of these research are contradictory and diverse, depending on the methodological techniques used and the nations studied. EPU has been shown to improve environmental quality in a number of studies (Ahmed et al. 2021; Chu and Le 2022; Ivanovski and Marinucci 2021; Liu and Zhang 2022; Gu et al. 2021a; Xin and Xin 2022; Zeng and Yue 2022; Chen et al. 2021). For example, Ahmed et al. (2021) reported that EPU decreases CO2 emissions in the USA using the nonlinear autoregressive distributed lag (NARDL) technique for the period 1985–2017. Chu and Le (2022) employed fully modified ordinary least squares (FMOLS) and fixed-effect techniques to support this empirical finding.

Chu and Le (2022) employed fully modified ordinary least squares (FMOLS) and fixed-effect techniques to study the role of EPU in nurturing environmental quality and found that EPU enhances environmental quality by decreasing CO2 emissions among the G7 nations under consideration. Similarly, an empirical study by Ivanovski and Marinucci (2021) using the dynamic common correlated effect mean group (DCCEMG) and common correlated effect mean group (CCEMG) methods, found that EPU helps to reduce environmental pollution in both developed and developing countries between 1990 and 2015. In addition, Liu and Zhang (2022), who used panel data analysis to evaluate the dynamic effect of EPU on environmental quality in China from 2003 to 2017, found that EPU reduces CO2 emissions. Gu et al. (2021b) came to a similar conclusion after studying the effects of EPU on CO2 emissions in China using spatial econometric models. In a similar vein, Xin and Xin (2022) found that EPU enhances environmental performance in 25 nations from 1976 to 2018. In addition, empirical research by Zeng and Yue (2022) used the nonlinear autoregressive distributed lag-pooled mean group (NARDL-PMG) framework to evaluate the environmental effect of EPU and found that EPU enhances environmental quality for the BRICS economies throughout the period 1991–2019.

Another group of studies, on the other hand, found that EPU degrades environmental quality (Adedoyin et al. 2021; Amin and Dogan 2021; Anser et al. 2021a; Atsu and Adams 2021; Khan et al. 2022; Lei et al. 2022; Nakhli et al. 2022; Shabir et al. 2022; Syed et al. 2022; Ullah et al. 2022; Xue et al. 2022; Yu et al. 2021; Zakari et al. 2021; Zhang et al. 2022; Zhao et al. 2022; Adams et al. 2020; Adedoyin and Zakari 2020; Jiang et al. 2019; Pirgaip and Dinçergök 2020; Ulucak and Khan 2020). Adedoyin et al. (2021), for example, used the dynamic panel system-GMM technique to evaluate the environmental effect of EPU in Sub-Saharan Africa from 1996 to 2014, and found that EPU degrades environmental quality. Similarly, Amin and Dogan (2021) found that EPU contributes significantly to increased CO2 emissions in China using the dynamic simulated ARDL technique. Furthermore, Anser et al. (2021b) demonstrated that EPU deteriorates environmental performance in the top 10 carbon emitter nations from 1990 to 2015. Atsu and Adams (2021) found similar results for BRICSFootnote 1 countries; Khan et al. (2022) for East Asian economies; Lei et al. (2022) for China; Nakhli et al. (2022) for USA; Shabir et al. (2022) for 24 developing and developed countries; Syed et al. (2022) for BRICSTFootnote 2 countries; Ullah et al. (2022) for low and high globalised OECDFootnote 3 economies; Xue et al. (2022) for France; Yu et al. (2021) for Chinese manufacturing firms; Zakari et al. (2021) for OECD countries; Zhang et al. (2022) for USA and China; Zhao et al. (2022) for China; Adams et al. (2020) for resource-rich countries; Adedoyin and Zakari (2020) for UK; Jiang et al. (2019) for USA; Pirgaip and Dinçergök (2020) for G7 countries; and Ulucak and Khan (2020) for USA.

Table 1 also includes a summary of studies on the association between EPU and environmental quality in order to facilitate comparisons across countries and areas.

Table 1 Synopsis of studies

Literature gap and contributions of the study

According to a review of the literature, the environmental impact of EPU is debatable, and it has created significantly more heat than light. These contentious shards of evidence have prompted a number of scholars to study the role of EPU in promoting environmental quality using a variety of samples and recently developed approaches. Furthermore, previous research on the EPU–environmental quality nexus focuses mostly on EPU's direct effects on environmental quality. However, the indirect effects appearing through the channels of energy intensity, renewable and non-renewable energy consumptions, and economic complexity, notably in South Africa, have been largely ignored. In the commonly used traditional EKC paradigm for South Africa, this research proposes a new mechanism to explore the moderating impact of EPU. The extended forms of the EKC have been studied in the previous studies. Meanwhile, statistical theory implies that moderation occurs when two variables interact in such a way that a third variable, the moderator, is required. This work adds to the current literature on the EPU–pollution nexus by adopting and creating certain interaction terms. To the best of our knowledge, this is the first study in South Africa that aims to experimentally analyse the moderating role of EPU in the environmental Kuznets curve (EKC). As a result, this research sheds fresh light on the role of EPU as a moderator in the conventional EKC in reducing environmental degradation in South Africa.

Furthermore, existing studies in the global context, including the ones mentioned above, that assessed the EPU-CO2 emissions relationship while controlling for trade openness have been criticised for using a one-dimensional trade proxy that fails to capture the true environmental effect of trade openness. In the link between EPU and environmental quality, previous studies have consistently employed trade intensity (TI) as a measure of trade openness and applied the basic ARDL methodology. The ratio of trade (exports + imports) to GDP, which primarily captures "TI," was traditionally used to define and proxy trade openness in these studies. This trade openness metric solely considers a country's relative position in terms of trade performance inside its own economy. As a result, this metric effectively overlooks a country's openness to global trade and fails to represent the true environmental impact of trade openness (Squalli and Wilson 2011). Although intuitively sound, this metric falls short of addressing the ambiguity in the definition and proper assessment of trade openness. The TI-based measure of trade openness has a significant flaw in that it only analyses one component of trade openness: the country's relative position in terms of trade performance in its own economy. By the implication, this measure considerably ignores a country’s openness to world trade, thus practically fails to reflect the accurate environmental impact of trade openness (Squalli and Wilson 2011). As a result, large and wealthy economies are incorrectly labelled as closed, while their smaller and poorer equivalents are lauded as open. For example, applying TI penalises larger and performing economies like South Africa, Japan, China, France, the USA, Germany, and many others since they are classified as closed economies due to their larger GDP. However, this measure of trade openness improperly classifies relatively poor nations (such as Togo, Nigeria, Ghana, Uganda, Venezuela, Zambia, Zimbabwe, and many more) with comparatively small GDP as open economies (Squalli and Wilson 2011).

Furthermore, model misspecifications, nations sampled, and methodological framework discrepancies are among the causes for the lack of empirical consensus and inconsistent (mixed) findings on the role of EPU in alleviating environmental degradation.

In light of this, this research adds to the current literature on EPU's environmental consequences in the following ways: (i) to the best of our knowledge, this is the first study in South Africa that aims to experimentally investigate the moderating role of EPU in EKC. The study uses the EKC framework to test whether EPU affects environmental quality in South Africa, as well as (ii) whether EPU helps to buffer the environmental impact of energy intensity. (iii) The study explores and evaluates whether EPU mediates the impacts of renewable and non-renewable energy consumption, as well as economic complexity, on environmental quality, using the EKC framework and treating EPU as a moderating factor. It is also important to note that testing for the indirect effects of EPU on environmental quality via these factors is critical because—(a) on the one hand, EPU influences energy generation, causes energy prices to fluctuate, and leads to higher energy consumption, which significantly worsens environmental quality; on the other hand, EPU encourages firms to switch to high-energy-based techniques powered by relatively cheap fossil fuels, which also significantly worsens environmental quality. (b) Since government policies are designed to provide a more favourable macroeconomic environment for energy generation, in the form of direct investment and subsidies, EPU impacts the levels of renewable and non-renewable energy consumption in an economy. (c) By influencing how knowledge is integrated, EPU has a substantial impact on the nexus between environmental quality and economic complexity (which encompasses a country's diversity of knowledge and how this information is effectively and productively combined to generate commodities and services). (iv) This research employs Brambor et al. (2006)'s robust technique to visually depict the environmental implications of EPU via the channels of energy intensity, renewable and non-renewable energy consumption, and economic complexity. Using this robust method, we can estimate the environmental marginal impacts of all of these factors at various EPU levels, as well as systematically analyse the EPU threshold values required to reduce the negative environmental consequences of all of these variables. Despite the allure of Brambor et al. (2006)'s robust modelling method, no previous studies have employed it to study the hypothesised link. (v) Previous studies of the EPU-CO2 emissions relationship in the global context, including the ones mentioned above, have frequently used the simple ARDL framework proposed by Pesaran et al. (2001) and other cointegration approaches that can only investigate the short- and long-run nexus between the variables under consideration. However, this study adds to the current literature on a methodological level by utilising an advanced econometric methodology, the novel dynamic ARDL simulations model created by Jordan and Philips (2018), to overcome the limits and problems of the simple ARDL approach. The novel dynamic ARDL simulations model competently overcomes the limitations and challenges in the result interpretations of the simple ARDL approach by automatically simulating and plotting to predict graphs of (negative and positive) changes in the variables, as well as examining the associated short-run and long-run relationships among the variables under consideration. As a result, the implementation of this unique technique in this study produces trustworthy and impartial results. (vi) Previous studies that looked at the EPU-CO2 emissions link while controlling for trade openness were criticised for employing a one-dimensional trade proxy that fails to reflect the true environmental impact of trade openness. This study adds to the existing literature on the relationship between EPU and environmental quality by carefully employing a new and innovative trade openness proxy developed by Squalli and Wilson (2011) to account for two dimensions of trade openness: the trade share in GDP and the size of trade relative to global trade. As a result, utilising the Squalli and Wilson measure of trade openness sets us apart from previous studies that assessed and proxied trade openness using conventional trade intensity. (vii) Finally, this article employs second-generation econometric approaches to adequately assess and capture the consequences of multiple structural breaks, which have hitherto been disregarded. Because empirical data show that structural breaks are permanent, and structural breaks impact a wide range of macroeconomic variables, including CO2 emissions and EPU, failing to account for them might lead to misleading and inconsistent results. In this direction, we use Narayan and Popp (2010)'s structural break unit root test to check for structural breaks in our dataset.

Material and methods

Using the novel dynamic ARDL simulations model, this work seeks to empirically analyse the moderating influence of EPU on environmental quality for South Africa for the period 1960–2020. We begin by doing a unit root test on the variables to explore their sequence of integration before using the novel dynamic ARDL simulations model. The Kwiatkowski–Phillips–Schmidt–Shin (KPSS), Augmented Dickey–Fuller (ADF), Phillips–Perron (PP), and Dickey–Fuller GLS (DF-GLS) tests are used in this study to achieve this goal. Because structural breaks are widespread, and failure to control them might lead to biased and inconsistent findings, the work uses the technique suggested by Narayan and Popp (2010) to control for them. The novel dynamic ARDL simulations model is used to explore the long- and short-run coefficients of the variables. Finally, the research employs Brambor et al. (2006)'s comprehensive modelling methodology to graphically depict the environmental implications of EPU as they manifest themselves through the channels of energy intensity, renewable and non-renewable energy consumption, and economic complexity.

Functional form

This research investigates the moderating influence of EPU on environmental quality in South Africa using the robust empirical method used in prior works and the usual EKC hypothesis methodology. According to the EKC theory, environmental degradation accelerates as economic growth accelerates, particularly during the early stages of society's development. This is because society is more concerned with achieving higher economic growth than with achieving lower environmental decay; therefore, a rise in income (economic growth) leads to an increase in environmental degradation. This concept explains the positive association between the scale effect (a proxy for economic growth) and environmental quality intuitively and fundamentally. The industrial stage of development, on the other hand, results in higher degrees of environmental deterioration. As society industrialises, moving away from agricultural-dominated production activities, environmental deterioration accelerates; as a result, people become more environmentally sensitive, leading to the implementation of stricter environmental regulations to enhance environmental quality. Thus, people's desire for a clean environment, as well as the government's enforcement of increasingly stricter environmental rules, significantly contributed to the improvement of environmental quality throughout the advanced industrial stage of societal development. Consequently, as income (economic growth) rises, so does environmental damage. This notion explains intuitively the negative relationship between the technique effect (square of economic growth) and environmental quality.

As a result, we propose the typical EKC hypothesis as follows, based on Udeagha and Ngepah (2022, 2021c), Udeagha and Breitenbach (2021), and Cole and Elliott (2003):

$${CO2}_{t}=F\left(SE, TE\right)$$
(1)

where CO2 denotes the CO2 emissions, a proxy for environmental quality; SE is a scale effect that captures economic growth (income); and TE is a technique effect that captures the square of economic growth. Log-linearising Eq. (1) yields the following:

$${\mathrm{In}CO2}_{t}=\alpha +\varphi In{SE}_{t}+\beta {InTE}_{t}+{\varepsilon }_{t}$$
(2)

As income grows, the scale effect (economic growth) adds to increased environmental degradation; however, the technique effect lessens environmental decay as much stricter environmental regulations are enacted to improve environmental quality (Ling et al. 2015; Cole and Elliott 2003; Udeagha and Ngepah 2021a). As a result, the validity of the EKC hypothesis requires that \(\varphi >0\) and \(\beta <0\). Following literature, trade openness and technological innovation are both controlled for in the model. Thus, we specify our baseline model, which captures the main effects without multiplicative interaction terms, as follows:

$${\mathrm{In}CO2}_{t}=\alpha +\vartheta {\mathrm{In}CO2}_{t-1}+\varphi In{SE}_{t}+\beta {InTE}_{t}+\psi {InEPU}_{t}+\pi In{EI}_{t}+\delta {InREC}_{t}+\tau {InNREC}_{t}+\varsigma {InECI}_{t}+\omega In{OPEN}_{t}+\rho {InTECH}_{t}+{U}_{t}$$
(3)

where \({InEPU}_{t}\) denotes the economic policy uncertainty; \(In{EI}_{t}\) stands for the energy intensity; \({InOPEN}_{t}\) signifies the trade openness, \(In{REC}_{t}\) denotes the renewable energy consumption; \(InNR{EC}_{t}\) signifies the non-renewable energy consumption; \(In{ECI}_{t}\) represents the economic complexity index; \({InTECH}_{t}\) is the technological innovation; and all variables are in their natural log. \(\varphi ,\beta ,\psi ,\rho , \pi , \delta , \tau , \varsigma and \omega\) are the coefficients to be estimated, which capture various elasticities, while \({U}_{t}\) is the stochastic error term with standard properties. The paper uses the first lag of the dependent variable (\({\mathrm{In}CO2}_{t-1}\)) to capture the dynamic effect of CO2 emissions in the model.

Equation (3) hypothesises the standalone (direct) environmental impact of EPU while validating the presence of EKC hypothesis. In the first step, this paper argues that EPU can serve as a moderating variable in the nexus between energy intensity and environmental quality (see Amin and Dogan 2021; Chu and Le 2022; Adedoyin and Zakari 2020; Ulucak and Khan 2020). Thus, Eq. (3) is augmented by adding the multiplicative interaction term of EPU and energy intensity (EI) to capture this impact. We have the following equation:

$$\begin{array}{c}{\mathrm{In}CO2}_{t}=\alpha +\vartheta {\mathrm{In}CO2}_{t-1}+\varphi In{SE}_{t}+\beta {InTE}_{t}+\psi {InEPU}_{t}+\pi In{EI}_{t}\\ +{\pi }^{*}In\left({EI}_{t}*{EPU}_{t}\right)+\delta {InREC}_{t}+\tau {InNREC}_{t}+\varsigma {InECI}_{t}\\ +\omega In{OPEN}_{t}+\rho {InTECH}_{t}+{U}_{t}\end{array}$$
(4)

Adding the multiplicative interaction term captures the moderating impact of EPU in the nexus between energy intensity and environmental quality (see Amin and Dogan 2021; Chu and Le 2022; Adedoyin and Zakari 2020; Ulucak and Khan 2020). Since EPU influences energy generation, causes the price of energy to fluctuate, leads to higher energy consumption, and substantially deteriorates environmental quality, EPU will serve as a moderating (mediating) factor in the relationship between energy intensity and environmental quality when \(\pi\) is positive and statistically significant and \({\pi }^{*}\) is negative and statistically significant. Therefore, the multiplicative interaction term in Eq. (4) is expected to be statistically significant to validate the presence of moderating role of EPU in the energy intensity–environmental quality nexus (Amin and Dogan 2021; Chu and Le 2022; Adedoyin and Zakari 2020; Ulucak and Khan 2020).

Similarly, the moderating impact of EPU in the nexus between renewable energy consumption (REC) and environmental quality can be investigated using the following equation:

$$\begin{array}{c}{\mathrm{In}CO2}_{t}=\alpha +\vartheta {\mathrm{In}CO2}_{t-1}+\varphi In{SE}_{t}+\beta {InTE}_{t}+\psi {InEPU}_{t}+\pi In{EI}_{t}\\ +\delta {InREC}_{t}+{\delta }^{*}In\left({REC}_{t}*{EPU}_{t}\right)+\tau {InNREC}_{t}+\varsigma {InECI}_{t}\\ +\omega In{OPEN}_{t}+\rho {InTECH}_{t}+{U}_{t}\end{array}$$
(5)

Likewise, in the relationship between non-renewable energy consumption (NREC) and environmental quality, the moderating impact of EPU can be assessed using the following equation:

$$\begin{array}{c}{\mathrm{In}CO2}_{t}=\alpha +\vartheta {\mathrm{In}CO2}_{t-1}+\varphi In{SE}_{t}+\beta {InTE}_{t}+\psi {InEPU}_{t}+\pi In{EI}_{t}\\ +\delta {InREC}_{t}+\tau {InNREC}_{t}+{\tau }^{*}In\left(N{REC}_{t}*{EPU}_{t}\right)+\varsigma {InECI}_{t}\\ +\omega In{OPEN}_{t}+\rho {InTECH}_{t}+{U}_{t}\end{array}$$
(6)

Following the same fashion, this study investigates the moderating impact of EPU on environmental quality through the channel of economic complexity (ECI). To capture this effect, we further augment our baseline model by adding the multiplicative interaction term of EPU and ECI as follows:

$$\begin{array}{c}{\mathrm{In}CO2}_{t}=\alpha +\vartheta {\mathrm{In}CO2}_{t-1}+\varphi In{SE}_{t}+\beta {InTE}_{t}+\psi {InEPU}_{t}+\pi In{EI}_{t}\\ +\delta {InREC}_{t}+\tau {InNREC}_{t}+\varsigma {InECI}_{t}+{\varsigma }^{*}In\left({ECI}_{t}*{EPU}_{t}\right)\\ +\omega In{OPEN}_{t}+\rho {InTECH}_{t}+{U}_{t}\end{array}$$
(7)

Lastly, the paper follows the robust modelling technology suggested by Brambor et al. (2006) to graphically illustrate and estimate the marginal impacts of energy intensity, renewable energy consumption, non-renewable energy consumption, and economic complexity for various levels of EPU.

Measuring trade openness

To successfully overcome the inadequacies of trade intensity (TI) utilised in earlier research, this study employs the composite trade intensity (CTI) suggested by Squalli and Wilson (2011). The CTI effectively accounts for two characteristics of trade openness: the percentage of trade in GDP and the quantity of trade in relation to global trade. As a result, adopting the Squalli and Wilson measure of trade openness separates our study from previous studies that used the traditional TI to measure and proxy trade openness. Furthermore, by employing this comprehensive method of capturing trade openness, the constraints of the traditional TI are effectively addressed. In essence, the new CTI comprises more essential aspects about a country's trade contribution share in respect to the global economy (Squalli and Wilson 2011). Furthermore, because it accounts for two aspects of a country's relationships with the rest of the globe, this novel proxy for trade openness reflects trade result reality. As suggested by Squalli and Wilson (2011), we show the CTI as follows:

$$CTI=\frac{{(X+M)}_{i}}{\frac{1}{n}{\sum }_{j=1}^{n}{(X+M)}_{j}} \frac{{(X+M)}_{i}}{{GDP}_{i}}$$
(8)

where i denotes South Africa; j reflects her trading partners; X represents the exports; and M denotes the imports. In Eq. (8), while the first segment captures world trade share, the second portion accounts for South Africa’s trade share.

Variables and data sources

We use annual time series data spanning the years 1960 to 2020 in our analysis. The dependent variable in this study, CO2 emissions (kg per 2015 US$ of GDP), is employed as a proxy for environmental quality. World Bank World Development Indicators provided data on CO2 emissions (kg per 2015 US$ of GDP) from 1960 to 2020. Another dependent variable, the ecological footprint (EFP) in million gha, is utilised to check for robustness. The Global Footprint Network provided data for EFP from 1960 to 2020. To confirm the validity of the EKC hypothesis, we use the scale effect to represent economic growth and the technique effect to express the square of economic growth. The World Bank World Development Indicators are used to gather relevant data for the scale and technique effects from 1960 to 2020. The world uncertainty index (WUI)Footnote 4 is a proxy for economic policy uncertainty (EPU), and it counts the frequency of articles in EIUFootnote 5 reports that use the word "uncertainty." WUI data are available from https://fred.stlouisfed.org/series/WUIZAF for the period 1960 to 2020. Energy intensity (EI) is measured in kilograms of oil equivalent; renewable energy consumption (REC) is measured in British thermal unit (BTU) and includes hydroelectric power, geothermal, solar, wind, and biomass; non-renewable energy consumption (NREC) is measured in BTU and contains petroleum, natural gas, and coal; and economic complexity index (ECI) is a measure of a country's export diversity and ubiquity. World Bank World Development Indicators provide data on EI, REC, and NREC from 1960 through 2020. The Observatory Economic Complexity (OEC 2020) provides ECI data from 1960 to 2020, and data are available at Data Availability | OEC—The Observatory of Economic Complexity. Following empirical studies, control variables include trade openness (OPEN), which is calculated using a composite trade intensity as shown above, and technological innovation (TECH), which is measured by gross domestic spending on Research and Development (R&D). The World Bank World Development Indicators are used to gather data for OPEN from 1960 through 2020. Due to a lack of data for TECH, this analysis only covers the years 1997 to 2020, with data from the World Bank World Development Indicators. The definitions of variables and the data sources are summarised in Table 2.

Table 2 Definition of variables and data sources

Narayan and Popp’s structural break unit root test

We begin by doing a unit root test on the variables to explore their order of integration before using the novel dynamic ARDL simulations model. The Kwiatkowski–Phillips–Schmidt–Shin (KPSS), Augmented Dickey–Fuller (ADF), Phillips–Perron (PP), and Dickey–Fuller GLS (DF-GLS) tests are used in this study to achieve this goal. Because structural breaks are widespread, and failure to control them might lead to biased and inconsistent findings, the work uses the technique suggested by Narayan and Popp (2010) to control for them.

ARDL bounds testing approach

We employ the bounds test framework to investigate the moderating role of EPU on environmental quality. For illustration, Eq. (3), our baseline model without multiplicative interaction terms is used here. In subsequent illustrations, we will focus more on the models with the multiplicative interaction terms. Following Pesaran et al. (2001), we present the ARDL bounds testing approach as follows:

$$\begin{array}{l}{\Delta In{CO2}_t=\gamma}_0+\theta_1{InCO2}_{t-i}+\theta_2{InSE}_{t-i}+\theta_3{InTE}_{t-i}+\theta_4{InEPU}_{t-i}\\+\theta_5{InEI}_{t-i}{+\theta}_6{InREC}_{t-i}+\theta_7{InNREC}_{t-i}+\theta_8{InECI}_{t-i}+\theta_9{InOPEN}_{t-i}+\theta_{10}{InTECH}_{t-i}\\+\sum_{i=1}^q\gamma_{1i}\Delta{InCO2}_{t-i}+\sum_{i=0}^2\gamma_{2i}\Delta{InSE}_{t-i}+\sum_{i=0}^q\gamma_{3i}\Delta In{TE}_{t-i}\sum_{i=0}^q\gamma_{4i}\Delta In{EPU}_{t-i}\\+\sum_{i=0}^q\gamma_{5i}\Delta{EI}_{t-i}+\sum_{i=0}^q\gamma_{6i}\Delta{REC}_{t-i}+\sum_{i=0}^q\gamma_{7i}\Delta{InNREC}_{t-i}+\sum_{i=0}^q\gamma_{8i}\Delta In{ECI}_{t-i}\\+\sum_{i=0}^q\gamma_{9i}\Delta In{OPEN}_{t-i}+\sum_{i=0}^q\gamma_{10i}\Delta In{TECH}_{t-i}+\varepsilon_t\end{array}$$
(9)

where \(\Delta\) represents the first difference of InEPU, InREC, InECI, InOPEN, InNREC, InEI, InTECH, InTE, InSE, InCO2 and \({\varepsilon }_{t}\) signifies the white noise. Meanwhile, t-i is the ideal lags determined by Schwarz's Bayesian Information Criterion (SBIC), and \(\theta\) and \(\gamma\) are the long- and short-run coefficients to be calculated, respectively. The ARDL model for the long and short runs will be approximated if the variables are cointegrated. The null hypothesis for long-run nexus is as follows:\({({H}_{0}:\theta }_{1}={\theta }_{2}={\theta }_{3}={\theta }_{4}={\theta }_{5}={\theta }_{6}={\theta }_{7}={\theta }_{8}={\theta }_{9}={\theta }_{10}=0\)) against the alternative hypothesis \({({H}_{1}:\theta }_{1}\ne {\theta }_{2}\ne {\theta }_{3}\ne {\theta }_{4}\ne {\theta }_{5}\ne {\theta }_{6}\ne {\theta }_{7}\ne {\theta }_{8}\ne {\theta }_{9}\ne {\theta }_{10}\ne 0)\).

Meanwhile, whether the null hypothesis may be accepted or rejected is determined by the value of the derived F-statistic. When the estimated F-statistic value exceeds the upper bound, the null hypothesis is rejected, and we infer that the variables are cointegrated. When the estimated F-statistic falls below the lower bound, on the other hand, we accept the null hypothesis and conclude that the variables are not cointegrated. Furthermore, when the calculated F-statistic value falls between the lower and upper bounds, the ARDL bounds test is inconclusive. The long-run ARDL model is stated as follows:

$$\begin{array}{c}In{CO2}_{t}={\beta }_{0}+\sum_{i=1}^{q}{\omega }_{1}{InCO2}_{t-i}+\sum_{i=0}^{q}{\omega }_{2}{InSE}_{t-i}+\sum_{i=0}^{q}{\omega }_{3}{InTE}_{t-i}+\sum_{i=0}^{q}{\omega }_{4}{InEPU}_{t-i}\\ +\sum_{i=0}^{q}{\omega }_{5}{InEI}_{t-i}+\sum_{i=0}^{q}{\omega }_{6}{InREC}_{t-i}+\sum_{i=0}^{q}{\omega }_{7}{InNREC}_{t-i}+\sum_{i=0}^{q}{\omega }_{8}{InECI}_{t-i}\\ +\sum_{i=0}^{q}{\omega }_{9}{InOPEN}_{t-i}+\sum_{i=0}^{q}{\omega }_{10}{InTECH}_{t-i}+{\varepsilon }_{t}\end{array}$$
(10)

The long-run variance of the variables in Eq. (10) is denoted by \(\omega\). The correct lags are selected using the SBIC. The error correction model for short run is presented as follows:

$$\begin{array}{c}\Delta In{CO2}_{t}={\beta }_{0}+\sum_{i=1}^{q}{\pi }_{1}\Delta {InCO2}_{t-i}+\sum_{i=0}^{q}{\pi }_{2}\Delta {InSE}_{t-i}+\sum_{i=0}^{q}{\pi }_{3}\Delta {InTE}_{t-i}\\ +\sum_{i=0}^{q}{\pi }_{4}{\Delta InEPU}_{t-i}+\sum_{i=0}^{q}{\pi }_{5}{\Delta InEI}_{t-i}+\sum_{i=0}^{q}{\pi }_{6}\Delta {InREC}_{t-i}\\ \begin{array}{c}+\sum_{i=0}^{q}{\pi }_{7}{In\Delta NREC}_{t-i}+\sum_{i=0}^{q}{\pi }_{8}\Delta {InECI}_{t-i}+\sum_{i=0}^{q}{\pi }_{9}\Delta {InOPEN}_{t-i}\\ +{\sum_{i=0}^{q}{\pi }_{10}\Delta {InTECH}_{t-i}+\mathrm{\varnothing }EC{T}_{t-i}+\varepsilon }_{t}\end{array}\end{array}$$
(11)

The short-run variability of the variables is captured by \(\pi\) in Eq. (11), whereas ECT denotes the error correction term that captures the adjustment speed of disequilibrium. We further use a good number of diagnostic tests to check for the stability of the model. Serial correlations are checked in the model using the Breusch–Godfrey LM test; the presence of heteroscedasticity in the model is tested using the ARCH and Breusch–Pagan–Godfrey tests; correct model specification is checked using the Ramsey RESET test; and normality is checked using the Jarque–Bera Test. Finally, structural stability is checked using the cumulative sum of squares of recursive residuals (CUSUMSQ) and cumulative sum of recursive residuals (CUSUM).

Dynamic autoregressive distributed lag (Dynamic ARDL) simulations

On the one hand, the traditional ARDL framework developed by Pesaran et al. (2001), which yields long- and short-run estimations, has often been employed in previous research that studied the link between EPU and environmental quality. The ARDL approach is commonly utilised in energy, economic, and environmental investigations because of its statistical benefits. In the case of small sampling, the ARDL framework is very suitable, robust, and appropriate (Pesaran et al. 2001). The autocorrelation problem is not an issue with the ARDL approach, and the endogeneity problem is solved by choosing the right lag length (Langnel and Babington 2020). Also, the ARDL approach may be used whether the variables under examination are stationary at level I(0) or at the first difference I(1). This approach also yields the long- and short-run cointegration parameters of an error correction model in a single equation. On the other hand, in energy and environmental economics, the novel dynamic ARDL simulations model for time series data has gained popularity. This is because it overcomes the challenges in interpreting estimations obtained by the usual ARDL technique for examining long- and short-run coefficients of study variables (Jordan and Philips 2018). Dynamic simulation approaches are gaining popularity as a convenient way to obtain practical conclusions from time-series models, whose coefficients may have nonintuitive or "hidden" meanings (Jordan and Philips 2018). The novel dynamic ARDL simulations model can estimate, simulate, and automatically plot the actual positive and negative shocks in regressors and dependent variable while controlling for other variables. It is necessary to guarantee that the dependant variable is stationary at the first difference when using the dynamic ARDL simulations model. Second, in the model, the order of integration for regressors cannot be greater than I(1). Even if the analysis does not have to make the potentially tough I (0)/I (1) decision, all regressors must be checked for explosiveness or seasonal unit roots (Jordan and Philips 2018). Thus, the use of this novel methodology in this work leads to reliable and unbiased results. The dynamic ARDL error correction algorithm uses 1000 simulations in this paper because of multivariate normal distribution for the parameter vector. In addition, this work employs the graphs to investigate the actual changes of the independent variables and their effects on the dependent variable. Meanwhile, a large number of empirical studies have employed this robust technique to study the short- and long-run correlations between the variables under consideration. For example, Pata and Isik (2021) utilised this approach to investigate the impacts of human capital, natural resource rent, per capita income, and energy intensity on the load capacity factor for China from 1981 to 2017, which focuses on environmental issues on both the supply and demand sides. Similarly, Li et al. (2022) used this technique to explore the link between income inequality and environmental quality by adding the effects of human capital and globalisation in the model. Likewise, the study by Khan and Ulucak (2021) employed the novel ARDL simulations framework to examine the role that technological innovation plays in fostering environmental quality in both the USA and China. Using Eq. (3), our baseline model and following Jordan and Philips (2018), we present the novel dynamic ARDL simulations model as follows:

$$\begin{array}{c}\Delta In{CO2}_{t}={\alpha }_{0}+{\rho }_{0}{InCO2}_{t-1}+{\varphi }_{1}\mathrm{\Delta In}{SE}_{t}+{\rho }_{1}In{SE}_{t-1}+{\varphi }_{2}\mathrm{\Delta In}{TE}_{t}+{\rho }_{2}{InTE}_{t-1}\\ +{\varphi }_{3}\mathrm{\Delta In}{EPU}_{t}+{\rho }_{3}In{EPU}_{t-1}+{{\varphi }_{4}\mathrm{\Delta In}{EI}_{t}+{\rho }_{4}In{EI}_{t-1}+\varphi }_{5}\mathrm{\Delta InR}{EC}_{t}\\ \begin{array}{c}+{\rho }_{5}{InREC}_{t-1}+{\varphi }_{6}\mathrm{\Delta In}{NREC}_{t}+{\rho }_{6}{InNREC}_{t-1}+{\varphi }_{7}\Delta {InECI}_{t}+{\rho }_{7}{InECI}_{t-1}\\ +{\varphi }_{8}\mathrm{\Delta In}{OPEN}_{t}+{\rho }_{8}In{OPEN}_{t-1}+{\varphi }_{9}\mathrm{\Delta In}{TECH}_{t}+{\rho }_{9}In{TECH}_{t-1}\\ +\delta EC{T}_{t-1}+{\varepsilon }_{t}\end{array}\end{array}$$
(12)

To test the moderating role of EPU on environmental quality through energy intensity (EI) channel, Eq. (4) is rewritten in the novel dynamic ARDL simulations model as follows:

$$\begin{array}{c}\Delta In{CO2}_{t}={\alpha }_{0}+{\rho }_{0}{InCO2}_{t-1}+{\varphi }_{1}\mathrm{\Delta In}{SE}_{t}+{\rho }_{1}In{SE}_{t-1}+{\varphi }_{2}\mathrm{\Delta In}{TE}_{t}+{\rho }_{2}{InTE}_{t-1}\\ +{\varphi }_{3}\mathrm{\Delta In}{EPU}_{t}+{\rho }_{3}In{EPU}_{t-1}\\ \begin{array}{c}+{\varphi }_{4}\mathrm{\Delta In}{EI}_{t}+{\rho }_{4}In{EI}_{t-1}+{{\varphi }_{4}}^{*}\mathrm{\Delta In}\left({EI}_{t}*{EPU}_{t}\right)+{{\rho }_{4}}^{*}\mathrm{In}\left({EI}_{t-1}*{EPU}_{t-1}\right)+{\varphi }_{5}\mathrm{\Delta InR}{EC}_{t}+{\rho }_{5}{InREC}_{t-1}\\ +{\varphi }_{6}\mathrm{\Delta In}{NREC}_{t}+{\rho }_{6}{InNREC}_{t-1}+{\varphi }_{7}\Delta {InECI}_{t}+{\rho }_{7}{InECI}_{t-1}\\ \begin{array}{c}+{\varphi }_{8}\mathrm{\Delta In}{OPEN}_{t}+{\rho }_{8}In{OPEN}_{t-1}+{\varphi }_{9}\mathrm{\Delta In}{TECH}_{t}+{\rho }_{9}In{TECH}_{t-1}\\ +\delta EC{T}_{t-1}+{\varepsilon }_{t}\end{array}\end{array}\end{array}$$
(13)

Similarly, the moderating impact of EPU in the nexus between renewable energy consumption (REC) and environmental quality can be investigated by rewriting Eq. (5) in the novel dynamic ARDL simulations model as follows:

$$\begin{array}{c}\Delta In{CO2}_{t}={\alpha }_{0}+{\rho }_{0}{InCO2}_{t-1}+{\varphi }_{1}\mathrm{\Delta In}{SE}_{t}+{\rho }_{1}In{SE}_{t-1}+{\varphi }_{2}\mathrm{\Delta In}{TE}_{t}+{\rho }_{2}{InTE}_{t-1}\\ +{\varphi }_{3}\mathrm{\Delta In}{EPU}_{t}+{\rho }_{3}In{EPU}_{t-1}+{{\varphi }_{4}\mathrm{\Delta In}{EI}_{t}+{\rho }_{4}In{EI}_{t-1}+\varphi }_{5}\mathrm{\Delta InR}{EC}_{t}\\ \begin{array}{c}+{\rho }_{5}{InREC}_{t-1}+{{\varphi }_{5}}^{*}\mathrm{\Delta In}\left({REC}_{t}*{EPU}_{t}\right)+{{\rho }_{5}}^{*}\mathrm{In}\left({REC}_{t-1}*{EPU}_{t-1}\right)\\ +{\varphi }_{6}\mathrm{\Delta In}{NREC}_{t}+{\rho }_{6}{InNREC}_{t-1}+{\varphi }_{7}\Delta {InECI}_{t}+{\rho }_{7}{InECI}_{t-1}\\ \begin{array}{c}+{\varphi }_{8}\mathrm{\Delta In}{OPEN}_{t}+{\rho }_{8}In{OPEN}_{t-1}+{\varphi }_{9}\mathrm{\Delta In}{TECH}_{t}+{\rho }_{9}In{TECH}_{t-1}\\ +\delta EC{T}_{t-1}+{\varepsilon }_{t}\end{array}\end{array}\end{array}$$
(14)

Likewise, in the relationship between non-renewable energy consumption (NREC) and environmental quality, the moderating impact of EPU can be assessed by rewriting Eq. (6) in the novel dynamic ARDL simulations model as follows:

$$\begin{array}{c}\Delta In{CO2}_{t}={\alpha }_{0}+{\rho }_{0}{InCO2}_{t-1}+{\varphi }_{1}\mathrm{\Delta In}{SE}_{t}+{\rho }_{1}In{SE}_{t-1}+{\varphi }_{2}\mathrm{\Delta In}{TE}_{t}+{\rho }_{2}{InTE}_{t-1}\\ +{\varphi }_{3}\mathrm{\Delta In}{EPU}_{t}+{\rho }_{3}In{EPU}_{t-1}+{{\varphi }_{4}\mathrm{\Delta In}{EI}_{t}+{\rho }_{4}In{EI}_{t-1}+\varphi }_{5}\mathrm{\Delta InR}{EC}_{t}\\ \begin{array}{c}+{\rho }_{5}{InREC}_{t-1}+{\varphi }_{6}\mathrm{\Delta In}{NREC}_{t}+{\rho }_{6}{InNREC}_{t-1}+{{\varphi }_{6}}^{*}\mathrm{\Delta In}\left({NREC}_{t}*{EPU}_{t}\right)\\ +{{\rho }_{6}}^{*}\mathrm{In}\left(\mathrm{N}{REC}_{t-1}*{EPU}_{t-1}\right)+{\varphi }_{7}\Delta {InECI}_{t}+{\rho }_{7}{InECI}_{t-1}+{\varphi }_{8}\mathrm{\Delta In}{OPEN}_{t}\\ +{\rho }_{8}In{OPEN}_{t-1}+{\varphi }_{9}\mathrm{\Delta In}{TECH}_{t}+{\rho }_{9}In{TECH}_{t-1}+\delta EC{T}_{t-1}+{\varepsilon }_{t}\end{array}\end{array}$$
(15)

Lastly, the moderating impact of EPU on environmental quality through economic complexity (ECI) channel is tested by rewriting Eq. (7) in the novel dynamic ARDL simulations model as follows:

$$\begin{array}{c}\Delta In{CO2}_{t}={\alpha }_{0}+{\rho }_{0}{InCO2}_{t-1}+{\varphi }_{1}\mathrm{\Delta In}{SE}_{t}+{\rho }_{1}In{SE}_{t-1}+{\varphi }_{2}\mathrm{\Delta In}{TE}_{t}+{\rho }_{2}{InTE}_{t-1}\\ +{\varphi }_{3}\mathrm{\Delta In}{EPU}_{t}+{\rho }_{3}In{EPU}_{t-1}+{{\varphi }_{4}\mathrm{\Delta In}{EI}_{t}+{\rho }_{4}In{EI}_{t-1}+\varphi }_{5}\mathrm{\Delta InR}{EC}_{t}\\ \begin{array}{c}+{\rho }_{5}{InREC}_{t-1}+{\varphi }_{6}\mathrm{\Delta In}{NREC}_{t}+{\rho }_{6}{InNREC}_{t-1}+{\varphi }_{7}\Delta {InECI}_{t}+{\rho }_{7}{InECI}_{t-1}\\ +{{\varphi }_{7}}^{*}\mathrm{\Delta In}\left({ECI}_{t}*{EPU}_{t}\right)+{{\rho }_{7}}^{*}\mathrm{In}\left({ECI}_{t-1}*{EPU}_{t-1}\right)+{\varphi }_{8}\mathrm{\Delta In}{OPEN}_{t}\\ +{\rho }_{8}In{OPEN}_{t-1}+{\varphi }_{9}\mathrm{\Delta In}{TECH}_{t}+{\rho }_{9}In{TECH}_{t-1}+\delta EC{T}_{t-1}+{\varepsilon }_{t}\end{array}\end{array}$$
(16)

The estimable equations used in our analysis are Eqs. (12), (13), (14), (15), and (16). For robustness check, these estimable equations are re-run using ecological footprint (EFP) as the dependent variable.

Empirical results and their discussion

Summary statistics

Before presenting and discussing the results, we begin by analysing the summary statistics of the variables employed. Table 3 shows a summary of descriptive statistics, with the average values of CO2 emissions being the least and technique effect (TE) being the largest in proportion to other variables, respectively, 0.361 and 60.316. Technological innovation (TECH) has the second highest mean value of 9.360, according to the findings. While the Jarque–Bera test statistics are used to ensure that our variables are normal, Table 3 uses kurtosis to indicate how significantly the tails of distributions depart from those of normal distributions. Technological innovation (TECH), energy intensity (EI), trade openness (OPEN), economic complexity index (ECI), economic policy uncertainty (EPU), and renewable energy usage all exhibit a negative trend. The biggest variance is linked with TE, indicating that this variable is the most volatile when compared to others. CO2 emissions, on the other hand, have a low variance, signifying that this variable is largely steady. Furthermore, our data series are normally distributed, according to Jarque–Bera statistics.

Table 3 Descriptive statistics

Order of integration of the respective variables

After we have gone through the summary statistics, we look at the stationarity properties of all the variables in the research. In order to do this, this research employs four stationarity tests: KPSS, ADF, PP, and DF-GLS, the results of which are shown in Table 4. Using KPSS, empirical evidence shows that the dependent variable (InCO2) is stationary at both I(1) and I(0). However, when other three tests are used, namely ADF, PP, and DF-GLS, we found that InCO2 is only stationary at I(1). Similarly, InEFP, InSE, InTE, InEPU, InREC, InNREC, InECI, InTECH, InEI and InOPEN are stationary at both I(1) and I(0) or either of them when different tests are used. Table 4 shows that any variable that is non-stationary at the level becomes stationary at I(1) after first differencing. This empirical evidence shows that all of the variables under examination are I(1) or I(0), and none is I(2). However, traditional stationarity tests do not account for structural breaks in the data. As a result, the Narayan and Popp's unit root test, a rigorous testing approach that takes into account two structural breaks in the variables, is used to successfully remedy this weakness, and the findings are likewise shown in the right-hand panel of Table 4. The null hypothesis of unit root is rejected, implying that the variables are integrated of order one and indicating that the dynamic ARDL bounds testing technique should be used.

Table 4 Unit root analysis

Lag length selection results

The results of several tests for determining adequate lags are presented in Table 5. The SIC, AIC, and HQ approaches have been frequently utilised in empirical research to select acceptable lags. This paper uses the SIC approach for lag selection because of its superior performance. This approach considers lag one to be the most suited for our investigation since SIC produces the lowest result when compared to other techniques.

Table 5 Lag length criteria

Cointegration test results

Table 6 shows the cointegration test results using the surface-response regression proposed by Kripfganz and Schneider (2018), where the null hypothesis of no cointegration is rejected because the F- and t-statistics are higher than the upper bound critical values at various significance levels. As a result, this means that the variables studied in this paper are cointegrated. Again, the conventional cointegration test used above does not account for structural breaks in the data. As a result, we move on to a cointegration test to see if these variables have a long-run connection in the presence of endogenous structural breaks now that we have confirmed the presence of structural breaks in the variables. The Gregory–Hansen test of cointegration with regime shifts is also used in this work, and the findings are provided in Table 10 (see Appendix). The results reveal that at the break point, the variables under investigation are cointegrated. Our findings are compatible with the previously observed cointegrating connection, assuming no structural breaks.

Table 6 ARDL bounds test analysis

Diagnostic statistics tests

The findings of several diagnostic statistic tests used in our paper to assess model consistency and reliability are shown in Table 7. Our model is well fitted, as seen by the results of these tests, since it passes all of the diagnostic tests. The Breusch–Godfrey LM test reveals that serial correlation and autocorrelation have no effect on the chosen model. As assessed by ARCH and the Breusch–Pagan–Godfrey test, the diagnostic statistic test also confirms that the model has no heteroscedasticity. Furthermore, the chosen model is devoid of model misspecification. Finally, the Jarque–Bera test confirms that the residuals are normally distributed.

Table 7 Diagnostic statistics tests

Dynamic ARDL simulations model results

This section is separated into three subheadings to allow for straightforward exposition of the findings. The first subsection examines the baseline outcomes of EPU's direct impacts on environmental quality and other environmental factors in South Africa. The second subsection focuses only on the outcomes of EPU's moderating role (indirect effects) on environmental quality via the channels of energy intensity, economic complexity, and renewable and non-renewable energy consumption. The robustness check is dealt with in the last subheading.

Direct effect of EPU on CO2 emissions (Baseline results)

The baseline findings of the direct influence of EPU on CO2 emissions as well as the environmental consequences of other variables as shown in Eq. (12) using the dynamic ARDL simulations model are presented in Column (1) of Table 8. Our findings show that the calculated coefficients for long- and short-term economic growth (income) (expressed by scale effect, InSE) are both positive and statistically significant, implying that economic growth in South Africa leads to rising CO2 emissions. In the long and short term, however, the predicted coefficients on the square of economic growth (income) (denoted by technique effect, InTE) are negative and statistically significant, showing that technique effect helps to reduce environmental quality in South Africa. As a result, the presence of the EKC hypothesis in South Africa is experimentally validated by the positive influence of scale effect and the negative impact of technique effect. Economic growth rises in tandem with CO2 emissions, but there comes a point where more economic expansion leads to a reduction in environmental quality. The inverted U-shaped connection between income and pollution exists in South Africa for a variety of reasons, including technological development, institutional change, and the enforcement of severe environmental rules. In addition, as income grows, environmental consciousness develops, resulting in stricter environmental rules requiring the use of energy-efficient technology in order to reduce environmental deterioration. Our findings are in line with those of Udeagha and Ngepah (2021b); Aziz et al. (2021); Bekun et al. (2021); Ahmad et al. (2021); Zeraibi et al. (2022); Pata (2021a); Genç et al. (2022); Bibi and Jamil (2021). Our findings contradict the results of Pata and Caglar (2021); Pata and Aydin (2020); Bandyopadhyay and Rej (2021); Alola and Donve (2021); Halliru et al. (2020); Udeagha and Ngepah (2019); Altıntaş and Kassouri (2020); Koc and Bulus (2020).

Table 8 Dynamic ARDL simulations analysis

The estimated coefficients on economic policy uncertainty (InEPU) in the short and long run are both statistically significant and positive, implying that a 1% increase in EPU worsens environmental deterioration by 0.252 percent and 0.151 percent in the short and long run, respectively, in South Africa. The country, like every other emerging economy, is unquestionably more vulnerable to long-term and severe episodes of uncertainty brought on by political and economic shocks. Frail confidence, as well as prevailing political instability, have recently been identified as two important causes for the country's growth estimate for 2018 (International Monetary Fund 2017). Following the global financial crisis of 2008—the Great Recession—and the COVID-19 pandemic, which decimated the country, the government and policymakers in South Africa have increasingly focused on uncertainty. Millions of South Africans lost their savings, houses, and jobs as a result of the global financial crisis of 2008. The crisis wreaked havoc on the country's economy and created so much uncertainty that no one, even the government and policymakers, knew what the country's future contained. As the crisis worsened, so did the negative impacts on the economy, and the government and officials paid less attention to environmental protection. As a result, an increase in EPU degrades the country's environmental quality. Adedoyin et al. (2021) observed that EPU degrades environmental quality in Sub-Saharan Africa, which supports our empirical results. Similarly, Amin and Dogan (2021) discovered that EPU had a significant impact on CO2 emissions in China. Furthermore, Anser et al. (2021a) found that EPU had a negative impact on the environment in the top 10 carbon emitter countries. Atsu and Adams (2021) found similar results for BRICS countries; Khan et al. (2022) for East Asian economies; Lei et al. (2022) for China; Nakhli et al. (2022) for USA; Shabir et al. (2022) for 24 developing and developed countries; Syed et al. (2022) for BRICSTFootnote 6 countries; Ullah et al. (2022) for low and high globalised OECD economies; Xue et al. (2022) for France; Yu et al. (2021) for Chinese manufacturing firms; Zakari et al. (2021) for OECDFootnote 7 countries; Zhang et al. (2022) for USA and China; Zhao et al. (2022) for China; Adams et al. (2020) for resource-rich countries; Adedoyin and Zakari (2020) for UK; Jiang et al. (2019) for USA; Pirgaip and Dinçergök (2020) for G7 countries; and Ulucak and Khan (2020) for USA. Our findings, however, contradict those of Ahmed et al. (2021), who reported that EPU lowers CO2 emissions in the USA. Chu and Le (2022) discovered that EPU helps the environment by cutting CO2 emissions among the G7 nations studied, which supports this empirical result. Similarly, an empirical study by Ivanovski and Marinucci (2021) indicated that EPU helps rich and developing nations reduce pollution between 1990 and 2015. In addition, Liu and Zhang (2022), who studied the dynamic influence of EPU on environmental quality in China, found that EPU reduces CO2 emissions. Gu et al. (2021a) came to a similar result after studying the impact of EPU on CO2 emissions in China using spatial econometric models. In a similar vein, Xin and Xin (2022) found that EPU enhances environmental performance in 25 nations from 1976 to 2018. In addition, according to an empirical study by Zeng and Yue (2022), EPU enhances environmental quality for BRICS economies from 1991 to 2019.

The computed short- and long-run coefficients for the energy intensity variable (InEI) are both positive and statistically significant. This information implies that South Africa's growing CO2 emissions are mostly due to increased energy demand. Production and economic development are both aided by the utilisation of energy. Increased energy usage raises CO2 emissions in South Africa due to the country's heavy reliance on energy for commodities manufacturing. Adebayo et al. (2021) found that energy intensity degrades environmental quality in South Korea, which supports our empirical findings. Our empirical evidence is further supported by Pata (2018a), who found that energy consumption contributes to escalate environmental degradation in Turkey over the period 1974–2013. Aslan et al. (2021) found similar results for 17 Mediterranean countries, Doğanlar et al. (2021) for Turkey, Udeagha and Breitenbach (2021) for SADC countries, Hongxing et al. (2021) for 81 BRIFootnote 8 economies, Hu et al. (2021) for Guangdong, China, Udeagha and Ngepah (2021b) for South Africa, and Islam et al. (2021) for Bangladesh. Our findings, however, contradict those of Baloch et al. (2021), who found that energy innovation lowers energy intensity and, as a result, CO2 emissions in OECD nations. Energy innovation, according to Dauda et al. (2019), enhances environmental quality in G6 countries.

The results show that the predicted coefficient for renewable energy consumption (InREC) is statistically significant and negative only in the long term, implying that an increase in REC improves environmental quality by lowering CO2 emissions in South Africa. As Udeagha and Ngepah (2021b) noted out, the development of renewable energy consumption through the use of hydroelectricity, solar, water, wind, and other sources contributes significantly to reducing world CO2 emissions. Our findings are in line with those of Ponce and Khan (2021), who found that REC enhances environmental quality in nine developed European and non-European nations. Similarly, Khan et al. (2021a) pointed out that transitioning from high-carbon-emitting fuels to renewable energy sources like solar, water, and hydropower improves environmental quality while also helping to accomplish the Sustainable Development Goals in the USA. In addition, Baye et al. (2021), who investigated the impact of REC in promoting environmental quality, discovered that REC increases environmental sustainability in 32 countries in Sub-Saharan Africa. Likewise, Pata (2021b), who performed the Fourier cointegration and causality tests to examine the environmental effect of REC, found that REC promotes environmental sustainability in BRIC countries. Our findings are also supported by the conclusions reached by Zhan et al. (2021) for Pakistan; Khattak et al. (2020) for BRICS economies; Çıtak et al. (2021) for the USA; Khan et al. (2020) for G7 countries; Ike et al. (2020) for G7 countries; Acheampong et al. (2019) for 46 Sub-Saharan African countries; Alola et al. (2019) for European largest states; Ngepah and Udeagha (2018) for African countries; and Cheng et al. (2019) for BRICS countries. The findings, on the other hand, contradict Boluk and Mert (2014), who found that REC degrades environmental quality in 16 EU nations. Pata (2018c) observed that REC leads to the deterioration of environmental quality in Turkey, with similar findings. Also, Pata and Caglar (2021) found evidence that REC has no effect on carbon emissions in China.

Both the short- and long-run estimated coefficients on non-renewable energy consumption (InNREC) are statistically significant and positive, implying that non-renewable energy sources such as oil, petroleum, natural gas, and coal have negative environmental repercussions in South Africa. Our empirical research mirrors the current energy scenario in South Africa, where coal energy dominates and accounts for the majority of the country's non-renewable energy. Meanwhile, South Africa is the world's seventh-largest emitter of greenhouse gases due to its reliance on coal for energy (Kanat et al. 2022). The country's coal-fuelled economy is unavoidable, as coal energy consumption is essential for boosting output and facilitating economic progress. Because of the continued reliance on coal for energy supply, a 1 percent increase in NREC results in 0.428 and 0.172 percent increases in CO2 emissions in the long and short term, respectively. Given this empirical evidence, it is critical that a policy mix be rigorously implemented in order to effectively manage coal's pollution-increasing role, thereby moderating the country's rising levels of coal-induced environmental deterioration. As a result, diversifying the energy portfolio to include hydroelectricity, solar, water, wind, biomass, and other sources will make a significant contribution to improving the country's environmental quality. Naeem et al. (2021) observed that NREC degrades environmental quality in Pakistan, which supports our findings. Ibrahim and Ajide (2021a) for BRICS economies; Ahmad et al. (2021) for 31 Chinese provinces; Alola and Donve (2021) for Turkey; Magazzino et al. (2020) for South Africa; Joshua et al. (2020) for South Africa; Adedoyin et al. (2020) for BRICS economics; and Çıtak et al. (2021) for the USA all came to similar conclusions. Our findings, however, contradict Cheng et al. (2021), who found no causal link between NREC and CO2 emissions in China.

Economic complexity index (InECI) long-run estimated coefficient is determined to be statistically significant and positive. Its short-run estimated coefficient, on the other hand, is not statistically significant. In the long term, a 1 percent increase in ECI results in a 0.581 percent increase in CO2 emissions, according to the long-run positive coefficient. Our findings suggest that increased economic sophistication and growing levels of product complexity have a significant impact on South Africa's environmental quality. Our empirical evidence is backed up by Shahzad et al. (2021), who found that increased ECI adds considerably to environmental deterioration in the USA. ECI, according to Yilanci and Pata (2020), degrades environmental quality in China. Our findings are also in line with those of Wang et al. (2021) and Neagu (2019), who observed that when ECI rises, environmental degradation rises in complex nations. Our findings, however, contradict those of Can and Gozgor (2017), who indicated that increasing ECI improves environmental quality in France. Dogan et al. (2020) observed that ECI contributes to decreased CO2 emissions in OECD nations, with similar findings. Rafique et al. (2021) show that ECI is an important policy instrument for reducing environmental degradation in both E7 and G7 countries. Romero and Gramkow (2021) for 67 nations, Boleti et al. (2021) for 88 developed and developing countries, and Chu (2021) for 118 countries all confirm this finding.

The predicted long- and short-run coefficients for trade openness (InOPEN) are both positive and statistically significant, meaning that a 1 percent increase in trade openness results in 0.105 and 0.214 percent increases in CO2 emissions in the long and short run, respectively. Udeagha and Ngepah (2022, 2021c) agreed with our findings, stating that trade openness has a significant negative impact on environmental quality in South Africa. The pollution-raising role of trade openness naturally raises worries about South Africa's government and policymakers' escalating trade liberalisation initiatives. Despite the fact that trade openness helps the country's economic progress, its environmental effects have been disregarded. Meanwhile, the structure of South Africa's global export basket is the primary reason why trade openness is harmful to the country's ecology. This is because the types of exportable items that make up this basket necessitate extensive energy usage, which exacerbates the country's environmental degradation. For example, in the export and production of mineral resources such as diamonds, gold, iron, rare earth elements, natural gas, coal, and other natural resource-intensive energy goods, South Africa enjoys a comparative advantage. The country's environmental quality has greatly worsened as a result of the continual harvest of these items to suit the expanding demand in the worldwide market (Ngepah and Udeagha 2019, 2018). Furthermore, our findings for South Africa, that trade openness degrades the country's environmental quality in the short and long run, could be linked to the theoretical work of Lopez (1994), which emphasises that energy-based activities arising from the continuous harvest of these mineral resources-based energy products require a large amount of energy, posing a significant barrier to environmental quality. Ibrahim and Ajide (2021b) for G7 nations; ZA. Khan et al. (2021b) for Pakistan; and Udeagha and Breitenbach (2021) for the SADC region back up our findings. However, our findings contradict those of Ding et al. (2021), who claim that trade openness helps G7 economies improve environmental quality. Ibrahim and Ajide (2021c), who discovered that trade openness enhances environmental quality for G20 nations, came to similar conclusions. Similarly, Ibrahim and Ajide (2022), who looked at the impact of trade openness in promoting environmental quality in 48 Sub-Saharan African economies, discovered that trade openness is beneficial to the environment. Also, Pata (2018b), who investigated the environmental effect of trade openness by separating trade openness into import and export, found that export contributes to improve environmental quality while import leads to environmental damage.

The long- and short-run estimated coefficients for technological innovation (InTECH) are both negative and statistically significant, implying that a 1 percent increase in technological innovation and development reduces CO2 emissions by 0.145 percent and 0.302 percent, respectively, in the long and short run. South Africa recently enacted a number of legislative initiatives aimed at promoting technological innovation in order to improve the country's environmental quality. Environmentally friendly technical advancements in South Africa encourage efficient energy usage, make renewable energy sources more accessible at lower costs, and enhance environmental quality. Innovations in technology help to reduce CO2 emissions in South Africa by increasing energy efficiency through multiple channels such as altering fuel mix, adopting energy-efficient industrial practises, and utilising end-of-pipe technology. More crucially, South Africa's high R&D spending and technological change are the primary reasons why technical breakthroughs improve the country's environmental quality. The country has undertaken many programmes to strengthen the government's active engagement in R&D, allowing it to progressively transition its industrial operations from high-energy-intensive coal-based techniques to high-energy-efficient techniques spurred by technological breakthroughs. All of these governmental initiatives that encourage technological innovation have substantially aided in the reduction of carbon emissions in South Africa. Erdogan (2021) for the BRICS nations and Guo et al. (2021) for China discovered that technological advancements generate an enabling environment that decreases energy usage, increases energy efficiency, and finally leads to carbon emissions mitigation. These findings are further supported by Anser et al. (2021b) for EU countries; Yang et al. (2021) for BRICS economies; Shan et al. (2021) for Turkey; Baloch et al. (2021) for OECD countries; Ahmad and Raza (2020) for America; An et al. (2021) for Belt and Road host countries; Khan et al. (2020) for G7 countries; Destek and Manga (2021) for big emerging market; and Udeagha and Ngepah (2020) for South Africa. However, our findings contrast those of Dauda et al. (2021), who concluded that technological progress in Sub-Saharan African nations degrades environmental quality. Usman and Hammar (2021) found similar results for Asian countries; Faisal et al. (2020) found similar results for big emerging markets; Arshad et al. (2020) found similar results for Asian countries; Dauda et al. (2019) found similar results for BRICS economies; Villanthenkodath and Mahalik (2022) found similar results for India.

The speed of adjustment is denoted by the error correction term (ECT). Table 8 demonstrates that the predicted coefficient on ECT(-1) is negative and statistically significant, indicating that the variables studied are linked in the long term. For example, an estimated coefficient of -0.826 in column (1) of Table 8 indicates that 82 percent of the disequilibrium is rectified in the long. The R-squared result indicates that the explanatory factors used in this study account for 72 percent of the variation in environmental quality. Our model has a strong fit, as evidenced by the estimated p value of F-statistics.

The dynamic ARDL simulations automatically illustrate the predictions of actual regressor change and its impact on the dependent variable while keeping the other explanatory variables constant. To graphically capture their relationships, the effects of economic growth (proxied by scale effect), the square of economic growth (denoted by technique effect), economic policy uncertainty, energy intensity, renewable energy consumption, economic complexity index, non-renewable energy consumption, trade openness, and technological innovation are forecasted for a 10 percent increase (decrease).

Figure 2 shows the impulse response plot for the economic growth (as proxied by scale effect)–CO2 emissions nexus. The graph depicts the economic growth transition and how it affects CO2 emissions. A 10% increase in scale effect indicates that economic expansion has a positive long-term and short-term impact on environmental quality, while a 10% decrease in scale effect indicates that economic growth has a negative impact on environmental quality. The impact of a 10% increase is bigger than the impact of a 10% drop in economic growth. This research demonstrates that as the scale effect increases, environmental quality deteriorates, but improves as the scale effect decreases in South Africa.

Fig. 2
figure 2

The Impulse Response Plot for Scale Effect (Economic Growth) and CO2 Emissions. Figure 2 presents an increase (a decrease) by 10% in scale effect and its effect on CO2 emissions where dots denote average prediction value. The dark blue to light blue line shows 75, 90, and 95% confidence interval, respectively

Figure 3 shows the square of economic growth (as proxied by the technique effect) and environmental quality in South Africa as an impulse response plot. The plot of the technique effect–pollution nexus indicates that a 10% increase in technique effect decreases environmental degradation in the short and long term, whereas a 10% decrease in technique effect accelerates environmental deterioration. This graphical evidence demonstrates that an increase in technique effect improves environmental quality in the long and short run in South Africa, but a decrease in technique effect degrades environmental quality in the long and short run.

Fig. 3
figure 3

The Impulse Response Plot for Technique Effect and CO2 Emissions. Figure 3 presents an increase (a decrease) by 10% in technique effect and its effect on CO2 emissions where dots denote average prediction value. The dark blue to light blue line shows 75, 90, and 95% confidence interval, respectively

Figure 4 depicts the impulse response plot of the economic policy uncertainty–pollution relationship, which shows that a 10% increase in economic policy uncertainty accelerates environmental deterioration in the short and long term, while a 10% decrease in economic policy uncertainty improves environmental quality in the short and long term in South Africa.

Fig. 4
figure 4

The Impulse Response Plot for Economic Policy Uncertainty and CO2 Emissions. Figure 4 presents an increase (a decrease) by 10% in economic policy uncertainty and its effect on CO2 emissions where dots denote average prediction value. The dark blue to light blue line shows 75, 90, and 95% confidence interval, respectively

Figure 5 depicts the impulse response plot, which displays the relationship between energy intensity and environmental quality. The graph indicates that increasing energy intensity by 10% has a positive long-term and short-term impact on environmental quality, whereas decreasing energy intensity by 10% has a negative impact on environmental quality. This research demonstrates that while an increase in energy intensity increases pollution, a decrease in energy intensity improves environmental quality in South Africa in the short and long term.

Fig. 5
figure 5

The Impulse Response Plot for Energy Intensity and CO2 Emissions. Figure 5 presents an increase (a decrease) by 10% in energy intensity and its effect on CO2 emissions where dots denote average prediction value. The dark blue to light blue line shows 75, 90, and 95% confidence interval, respectively

The impulse response plot between renewable energy use and environmental quality in South Africa is shown in Fig. 6. The graph indicates that a 10% increase in renewable energy consumption has a negative short- and long-term impact on environmental quality, whereas a 10% decrease in renewable energy consumption has a positive short- and long-term impact. This study reveals that an increase in renewable energy consumption improves environmental quality, but a decrease in renewable energy consumption increases pollution levels in South Africa in the long and short term.

Fig. 6
figure 6

The Impulse Response Plot for Renewable Energy Consumption and CO2 Emissions. Figure 6 presents an increase (a decrease) by 10% in renewable energy consumption and its effect on CO2 emissions where dots denote average prediction value. The dark blue to light blue line shows 75, 90, and 95% confidence interval, respectively

Figure 7 depicts the impulse response plot connecting economic complexity index to environmental quality, which shows that a 10% increase in economic complexity index has a positive short-term and long-term impact on environmental quality, while a 10% decrease has a negative short-term and long-term impact. This research shows that an increase in economic complexity index worsens environmental degradation in the long and short run, whereas a decrease in economic complexity index improves environmental quality in the long and short run by lowering CO2 emissions in South Africa.

Fig. 7
figure 7

The Impulse Response Plot for Economic Complexity Index and CO2 Emissions. Figure 7 presents an increase (a decrease) by 10% in economic complexity index and its effect on CO2 emissions where dots denote average prediction value. The dark blue to light blue line shows 75, 90, and 95% confidence interval, respectively

Figure 8 depicts the impulse response plot of both variables under discussion, illustrating how non-renewable energy usage contributes to worsening environmental degradation. Figure 8 shows that a 10% increase in non-renewable energy consumption has a positive short-term and long-term impact on environmental quality, whereas a 10% decrease has a negative short-term and long-term impact. This means that increasing non-renewable energy consumption degrades the environment in the short and long term but reducing non-renewable energy consumption enhances environmental quality in the short and long term through lowering CO2 emissions in South Africa.

Fig. 8
figure 8

The Impulse Response Plot for Non-renewable Energy Consumption and CO2 Emissions. Figure 8 presents an increase (a decrease) by 10% in non-renewable energy consumption and its effect on CO2 emissions where dots denote average prediction value. The dark blue to light blue line shows 75, 90, and 95% confidence interval, respectively

The influence of trade openness on environmental degradation is visually depicted in Fig. 9, which shows the impulse response plot of the trade openness–pollution nexus. The graph shows that a 10% increase in trade openness degrades environmental quality in both the long and short run; however, a 10% reduction in trade openness lowers environmental deterioration in both the long and short runs. In South Africa, increasing trade openness increases pollution levels in the short and long term, but decreasing trade openness improves environmental quality in the long and short term.

Fig. 9
figure 9

The Impulse Response Plot for Trade Openness and CO2 Emissions. Figure 9 presents an increase (a decrease) by 10% in trade openness and its effect on CO2 emissions where dots denote average prediction value. The dark blue to light blue line shows 75, 90, and 95% confidence interval, respectively

In South Africa, technological innovation helps to enhance environmental quality. The impulse response plot of the technological innovation–environmental quality relationship is shown in Fig. 10. The plot, which depicts the impact of technological innovation on environmental quality, shows that a 10% increase in technological innovation has a negative long-term and short-term impact on environmental quality; however, a 10% decrease in technological innovation has a negative long-term and short-term impact on environmental quality. This research demonstrates that increasing technology development and innovation improves environmental quality, whereas decreasing technological development and innovation deteriorates environmental quality in both the long and short term in South Africa.

Fig. 10
figure 10

The Impulse Response Plot for Technological Innovation and CO2 Emissions. Figure 10 presents an increase (a decrease) by 10% in technological innovation and its effect on CO2 emissions where dots denote average prediction value. The dark blue to light blue line shows 75, 90, and 95% confidence interval, respectively

We use Pesaran and Pesaran (1997)'s cumulative sum of squares of recursive residual (CUSUMSQ) and cumulative sum of recursive residuals (CUSUM) to analyse the model's structural stability. The CUSUM and CUSUMSQ charts for testing mode stability are visualised in Figures 15 and 16 (see Appendix). When the plots are inside a key bound level of 5%, the model's parameters are usually stable. We may infer that the model parameters are stable over time since Figures 15 and 16 show that the model trend shows inside the bounds at a 5% level.

Moderating role (indirect effects) of EPU on environmental quality

In Table 8, the outcomes of EPU's moderating impacts on environmental quality through the channels of energy intensity, renewable energy consumption, non-renewable energy consumption, and economic complexity are provided in columns (2), (3), (4), and (5), respectively, and are explored below:

This research experimentally tests the validity of EPU's moderating influence on environmental quality through the energy intensity channel by using the multiplicative interaction term between EPU and energy intensity (i.e. In(EI*EPU)). The estimated coefficients on this multiplicative interaction term for the long run and short run are both statistically significant and positive, implying that EPU encourages enterprises to use significantly low-cost fossil fuels, resulting in deterioration of environmental quality in South Africa, as shown in Column (2) of Table 8. On the one hand, EPU pushes South African businesses to transition to high-energy-based technology powered by relatively inexpensive fossil fuels, resulting in considerable environmental degradation. EPU, on the other hand, has an impact on energy generation, causes energy prices to vary, and leads to increased energy consumption, all of which contribute to a significant deterioration in South Africa's environmental quality. Our findings are congruent with those of Yu et al. (2021), who found that EPU allows businesses to switch to relatively inexpensive fossil fuels, resulting in significant environmental degradation in China. Chu and Le (2022) discovered that EPU allows both households and enterprises to utilise energy more intensively, which leads to increased CO2 emissions in G7 nations. Ulucak and Khan (2020), who indicated that EPU adds tremendously to strengthening the pollution enhancing role of energy intensity in the USA, bolster our results.

We employ the multiplicative interaction term between EPU and renewable energy consumption (i.e. In(REC*EPU)) to experimentally examine the validity of EPU's moderating influence on environmental quality through the renewable energy consumption channel. The long- and short-run estimated coefficients on this multiplicative interaction term are both statistically significant and positive, showing that EPU inhibits investment in clean energy sources, resulting in environmental deterioration in South Africa, as shown in column (3) of Table 8. When examining the degree of renewable energy consumption in the country, EPU is a critical component to consider. EPU makes it impossible to invest in renewable energy sources. As a result, investors are discouraged from expanding their energy portfolios to include hydropower, solar, water, wind, biomass, geothermal, and other renewable energy enterprises that can help the country's environmental quality. To compensate for low turnover, Sohail et al. (2021) discovered that EPU supports the use of more traditional, low-cost energy sources and fewer renewable energy sources. This, in turn, degrades environmental quality. Our findings, on the other hand, contradict those of Adedoyin et al. (2021), who showed that EPU favours investments in clean energy sources that enhance environmental quality in Sub-Saharan Africa.

We employ the multiplicative interaction term between EPU and non-renewable energy consumption (i.e. In(NREC*EPU)) for the indirect environmental effect of EPU emerging through the channel of non-renewable energy consumption. The long- and short-run estimated coefficients on this multiplicative interaction term in column (4) of Table 8 are both statistically significant and positive, implying that EPU facilitates investment in non-renewable energy sources such as oil, petroleum, natural gas, and coal, which have negative environmental consequences in South Africa.

In terms of EPU's moderating effect on environmental quality via the economic complexity channel (captured by In(ECI*EPU)), the results in column (5) of Table 8 show that the long-run estimated coefficient on the multiplicative interaction term is negative and statistically significant, implying that EPU helps to improve ECI's pollution augmenting role. In South Africa, EPU could be linked to the risks posed by the government's uncertain policy responses as an economic agent in addressing specific macroeconomic challenges and introducing certain regulatory measures, which force households and businesses to become indecisive and uncertain in their own decisions, causing consumption and investment to be halted until the environment's confidence is restored. As a result, the reduction in consumption and investment as a result of EPU contributes to improved environmental quality. This is because by reducing consumption and investment, households and businesses release less carbon, resulting in an improvement in environmental quality. Our findings are in line with Chu and Le (2022), who found that EPU helps to improve the negative impact of ECI on environmental quality in G7 nations.

This research employs Brambor et al. (2006)'s robust technique to visually depict the environmental implications of EPU via the channels of energy intensity, renewable and non-renewable energy consumption, and economic complexity. Using this robust method, we can estimate the environmental marginal impacts of all of these factors at various EPU levels, as well as systematically analyse the EPU threshold values required to reduce the negative environmental consequences of all of these variables. This method also allows us to see the evolution of the marginal impacts of energy intensity, renewable energy consumption, economic complexity, and non-renewable energy consumption on environmental quality as EPU increases. Figures 11, 12, 13 and 14 depict their findings graphically.

Fig. 11
figure 11

Marginal Effect of Energy Intensity on CO2 Emissions Conditional on Economic Policy Uncertainty

Fig. 12
figure 12

Marginal Effect of Renewable Energy Consumption on CO2 Emissions Conditional on Economic Policy Uncertainty

Fig. 13
figure 13

Marginal Effect of Non-renewable Energy Consumption on CO2 Emissions Conditional on Economic Policy Uncertainty

Fig. 14
figure 14

Marginal Effect of Economic Complexity on CO2 Emissions Conditional on Economic Policy Uncertainty

The marginal effect of energy intensity on environmental quality displayed in Fig. 11 demonstrates that the effect is statistically significant and positive at increasing levels of EPU. An upsurge in EPU escalates the inadvertent environmental impact of energy intensity. This is because EPU encourages enterprises to use substantially low-cost fossil fuels, which ultimately deteriorate environmental quality. On the one hand, EPU encourages firms to switch to high energy-based techniques driven by relatively cheap fossil fuels, and this significantly leads to environmental deterioration. On the other hand, EPU influences energy generation, causes the price of energy to fluctuate, leads to higher energy consumption, which substantially deteriorates environmental quality. Meanwhile, a rise in EPU further encourages households and firms to intensively utilise more high carbon-emitting fuels and less energy-efficient technologies leading to environmental deterioration.

Figure 12 demonstrates that the marginal effect of renewable energy consumption on environmental quality is statistically significant and positive at increasing levels of EPU. A rise in EPU intensifies the unintended environmental consequence of renewable energy consumption. This is because EPU discourages investment in clean energy sources leading to environmental deterioration. EPU is a crucial variable to be looked at while considering the level of renewable energy consumption in the country. Since EPU prevents the investment in renewable energy sources, the investors are discouraged from diversifying energy portfolio to the utilisation of hydroelectricity, solar, water, wind, biomass, geothermal and other renewable energy enterprises that can contribute to improve environmental quality.

Similarly, the marginal effect of non-renewable energy consumption on environmental quality shown in Fig. 13 reveals that the effect is statistically significant and positive at increasing levels of EPU. An upsurge in EPU significantly escalates the pollution augmenting role of non-renewable energy consumption. Higher EPU facilitates investment in non-renewable energy sources—oil, petroleum, natural gas, and coal, which have detrimental consequences on environmental quality. Also, high EPU enables firms to divert to relatively cheap fossil fuels and non-renewable energy sources leading to high levels of environmental deterioration. In addition, a rise in EPU enables both households and businesses to utilise non-renewable energy sources more intensively, which in turn escalates the rising levels of CO2 emissions.

Lastly, Fig. 14 reveals that the marginal effect of economic complexity on environmental quality is statistically significant and negative at increasing levels of EPU. EPU could be associated with the risks emanating from uncertain policy responses undertaken by the government being an economic agent to address particular macroeconomic challenges and introduce certain regulatory measures, which consequently force households and businesses to become indecisive and uncertain in their own decisions, hence suspending consumptions and investments, respectively, pending when the confidence in environment is restored. As such, the shrinkage in both consumptions and investments due to EPU helps to improve environmental quality. This is because, by contracting both consumption and investment activities, households and firms respectively tend to engage in less carbon-emitting activities, which lead to improvement in environmental quality.

Robustness check

To undertake robustness tests on the calculated parameters, this study employs the ecological footprint (EFP) as another proxy for environmental quality. We test the robustness of the predicted coefficients derived using CO2 emissions as the major proxy for environmental quality by employing this proxy. As a result, the robustness of computed coefficients using CO2 emissions as a proxy for environmental quality (columns (1)-(5) in Table 8) is assessed using EFP as an alternative environmental proxy (columns (1)-(5) in Table 9). When the findings from both proxies are compared, it appears that there is little or no difference in the estimated coefficients, especially in terms of their signs and magnitudes. Several variables keep their signs while being statistically significant using both proxies. In terms of magnitudes, although employing EFP as a proxy, results in a modest (trivial) change in a few situations, we found no difference in the magnitudes of the predicted coefficients in the majority of cases. The estimated coefficients on economic growth (proxied by scale effect) and the square of economic growth (proxied by technique effect) are also found to be statistically significant with their correctly hypothesised signs using both proxies (CO2 emissions and EFP), confirming the existence of the EKC hypothesis for South Africa. Furthermore, we are able to establish the presence of cointegration among the variables under consideration using both proxies. Meanwhile, in both proxies, the error correction term (ECT), which represents the speed of adjustment, is higher. Table 8 demonstrates that the predicted coefficients on ECT(-1) in both proxies are negative and statistically significant, confirming the presence of a long-run nexus between the variables studied. R-squared values are greater when both proxies are used, indicating that the explanatory factors used in this study explain changes in environmental quality. We are able to check that our model is a good match using both proxies, as seen by the predicted p values of F-statistics in Tables 8 and 9. Given all of the aforementioned considerations, we can confidently conclude that the estimated coefficients derived from CO2 emissions are robust, consistent, and not significantly different from those derived from EFP as an alternative proxy for environmental quality.

Table 9 Dynamic ARDL simulations analysis

Furthermore, the cointegration results show an existence of structural breaks in the data and the study accounts for it in the model's estimation. To accommodate for the occurrence of structural breaks in the variables, a dummy variable (D1993) is constructed for the break year of 1993. Table 11 displays the results (see Appendix). Our results reveal that the presence of structural break is not statistically significant.

Conclusions and Policy Implications

South Africa has been wracked by a series of internal political upheavals and has been exposed to a slew of global economic woes. Desertification, landslides, flood outbursts, fire burnouts, and other environmental disasters have occurred in the country, all of which have been exacerbated by rising GHG emissions, particularly CO2 emissions, which are the driving forces for climate change resulting from internal changes within the climate system. Similarly, the disruption of economic operations as a result of economic policy uncertainty might result in increased pollution and, as a result, negative environmental implications. The current study was inspired by a lack of research on the relationship between economic policy uncertainty and pollution. This article examines the moderating influence of economic policy uncertainty on environmental quality in South Africa from 1960 to 2020 through energy intensity, renewable and non-renewable energy consumption, and economic complexity. The research uses Jordan and Philips (2018)'s recently created innovative dynamic ARDL simulations model to achieve its goal, which can automatically estimate, simulate, and produce graphs of (positive and negative) changes in the variables, as well as their short- and long-run correlations. Using this methodology, we can identify the negative and positive links between environmental quality (measured by CO2 emissions) and economic growth (measured by scale effect), the square of economic growth (measured by technique effect), economic policy uncertainty, energy intensity, renewable energy consumption, economic complexity index, non-renewable energy consumption, trade openness, and technological innovation for South Africa, allowing us to address the shortcomings of the simple ARDL framework commonly used in previous works. This study adds to the body of knowledge by utilising Brambor et al. (2006)'s robust modelling technology to calculate graphically the evolution of the marginal effects of energy intensity, renewable energy consumption, economic complexity, and non-renewable energy consumption on environmental quality as EPU increases. The study also contributes to the empirical literature by employing a new trade openness proxy developed by Squalli and Wilson (2011) to successfully solve the drawbacks of the widely used trade intensity (TI). Our findings show that while scale effect accelerates environmental degradation, technique effect slows it down, confirming the existence of the EKC hypothesis in South Africa. While energy intensity, economic complexity, non-renewable energy consumption, and trade openness all degrade environmental quality, renewable energy use and technological innovation both lower carbon emissions. Furthermore, the moderating effect of economic policy uncertainty on the nexus of economic complexity and carbon emissions enhances environmental quality. However, the pollution-augmenting impacts of energy intensity, renewable energy consumption, and non-renewable energy consumption are amplified by high economic policy uncertainty.

The following policy recommendations are suggested based on our findings: First, South Africa should encourage economic policies that promote innovation and capital investment in energy-efficient appliances and machineries to improve environmental quality, as economic policy uncertainty exacerbates environmental deterioration by deterring capital investment in energy-efficient technologies and discouraging the use of hydroelectricity, solar, water, wind, and other clean energy sources. To give full aid to economic growth, South Africa should implement measures to minimise energy use and boost renewable energy resources, which would reduce economic policy uncertainty. More importantly, South Africa's environmental policy should constantly take economic policy uncertainties into account in order to get more reliable data for environmental degradation mitigation.

Second, when it comes to improving the environment, the government should tighten its trade policies. Meanwhile, because of some benefits on South Africa's economy, the long-term harmful effect of trade openness on the country's environment does not justify persistent measures to close the borders. Rather, appropriate steps should be taken to guarantee that foreign trade makes a significant contribution to the reduction of South Africa's rising carbon emissions. In this regard, South Africa's policymakers should increase measures to embrace modern, eco-friendly, and pollution-free technologies that have the potential to transition from non-renewable to sustainable and less carbon-intensive energy sources and assure manufacturing process competence. Meanwhile, non-renewable energy sources, which contribute almost 90% of the country’s energy supply, will be replaced with alternate ones such as solar electricity. Furthermore, the global collaboration towards mitigating climate change is necessary for addressing escalating transnational environmental degradation as well as other knock-on effects. In this regard, the South African government should work to establish important connections with the world especially in order to share technologies and reduce pollution. More importantly, South African authorities should include pollution prevention chapters in their trade deal strategies to facilitate a transition to environmentally friendly sectors and a low-carbon economy, which support sustainable goods and services development. Furthermore, trade policy might be reinforced with other measures to encourage long-term value for GHG emission reductions and continuously support the development of new technologies that enhance South Africa's environmental situation and protect the global environment.

Third, to achieve the environmental development goals, South Africa's economic complexity needs be increased further. In this regard, the country should include some items in its export baskets, especially those that are less resource-intensive and can be produced using cleaner resources. Simultaneously, the degree of R&D should be increased since it will not only improve the country's economic complexity but, more crucially, will lower energy intensity and encourage clean energy transition. Furthermore, recent research has recognised the need of investment in technological innovations for the clean energy transition. As a result, increasing R&D is likely to increase the usage of renewable and nuclear energy in the country, which might be beneficial in combating climate change.

Fourth, renewable sources may be utilised as an attractive option to minimise CO2 emissions in South Africa's energy plans. Renewable energy consumption has been heavily promoted in South Africa's economy in recent years. However, the country's utilisation of renewable energy is still insufficient. Fossil fuel energy provides for more than 80% of total primary energy supply in South Africa. Despite the fact that fossil fuel usage is declining, this percentage remains significant. As a result, a 1% rise in NREC worsened environmental deterioration by 0.42 percent, whereas REC reduced emissions by 0.35 percent, according to the study's findings. Growing human impact on the environment is a result of increased energy use in South Africa. This demonstrates the importance of replacing NREC with renewable sources of energy and encouraging sustainable energy sources through green technologies. Although South Africa has lately provided significant financial supports for the use of alternative energy sources, overall energy usage continues to pollute the environment. Given this, the government should improve its natural resource management by increasing the amount of renewable energy in the overall energy mix. Furthermore, the country should strengthen low-carbon energy usage incentives, grant extra tax exemptions to enterprises that use clean energy, improve energy efficiency, and lower energy intensity. To minimise the cost of adopting renewable energy sources, South Africa should offer further supports to enterprises involved in research and development.

Lastly, South Africa’s authorities should enable enterprises to employ energy-saving techniques in their manufacturing processes by providing low-interest financing and enhancing the growth of businesses that make energy-saving equipment as a supplementary measure. Tax benefits or non-price measures that do not have an influence on fossil energy costs can be used to encourage energy efficiency. To shift the energy structure away from fossil fuels, additional incentives, tax relief, and supports should be offered to environmentally friendly energy sources. Alternative sources of energy should be given more attention so that they can compete with non-renewable sources. Energy storage technology advancements should be viewed as a key policy instrument, and they should be handled alongside renewable energy initiatives. Moreover, it is vital to bring awareness to the potential significance of energy technologies in tackling greenhouse gas emissions. Energy policy should focus on energy innovations to lower the societal costs of fossil energy usage.

Although this study provides important empirical findings and policy recommendations for South Africa, one of the study's major flaws is that it only considers one nation. As a result, future research should look at the moderating influence of economic policy uncertainty on environmental quality through energy intensity, renewable and non-renewable energy consumption, and economic complexity in Sub-Saharan Africa.