1 Introduction

With the evolving global changes, energy resources have remained important to human existence, especially in the increasingly competitive twenty-first century. Importantly, access to energy is crucial to human development (in education and health development) and unlocks economic fortunes by providing business and employment opportunities. In spite of these associated benefits of energy resources, access to energy across Africa has remained a long-lasting challenge. Notably, the African Development Bank Group (AFDB) motioned that only about 40% of the African population (the lowest among the world regions), corresponding to about 640 million people, have access to electricity (AFDB, 2021). The significantly low access to energy sources will reportedly continue to account for the relatively small share of electricity consumption in Africa against the global total of electricity consumption by 2050 (International Energy Agency, 2021a).

Given this relatively low consumption, arising from lack of or unreliable access to central grid power in rural areas (urban areas), more attention is increasingly shifting away from the traditional energy sources (mainly oil, coal, and probably natural gas) to renewable energy sources such as biofuels (David et al., 2020, 2021). Although the renewable energy resources across Africa that include a wealth of wind, biomass, and solar resources have been least explored, these environmentally desirable forms of energy are available in abundance across the continent (Adedoyin et al, 2020; Ibrahim et al., 2021). Specifically, the endowment of renewable energy resources is a spread of 1.1+ million Gigawatts per hour (GWh) in capacity of hydro capacity and 9000+ Megawatts (MW) in capacity of geothermal (Johansson, 1993; Musa, 1993). Given the capacities mentioned above, for hydropower, for instance, less than a tenth of the total capacity of the source is being utilized. At the same time, a similar situation is associated with solar, biomass, wind, and geothermal sources (AFDB, 2021).

Moreover, while there is increasing development of renewable energy sources across the continent, which is directed at closing the region's energy deficit (Adewale et al., 2021), a counter effect is extremely possible because of its unchecked population increase. Currently, Africa's youngest population is coincidentally one of the world's fastest growing. Specifically, the International Energy Agency (IEA) hinted at Africa's energy outlook by noting that over 500 million Africans will be added to the continent's urban population by 2040 (IEA, 2021b). Given that one African in every two people in the world is added to the global population by 2040, such that the continent's population overshoot China and India as the most populous region by 2023, the IEA (IEA, 2021b) projects a huge drawback to the African’s energy supply. Consequently, the increase in the continent’s population creates no choice than heighten the demand for traditional (fossil fuel) energy utilization, thus expectedly limiting the chance to mitigate environmental hazards (Asongu et al., 2021). Although not to be compared with the United States, China, India (largely Asia, southern and Northern America), carbon emission and largely greenhouse gas emission are increasingly hampering the continent's environmental sustainability drive. For instance, reporting that South Africa ranks as the world’s 12th largest emitter of greenhouse gases (Bloomberg, 2021) and that the atmospheric carbon dioxide emission is second largest in the African tropics according to Palmer et al., (2019), raises a severe concern vis-à-vis the trilemma of carbon neutrality drive, renewable energy development, and cutting down fossil fuel energy utilization.

Considering this aforementioned African trilemma, the current study sampled selected African countries, especially those with the highest profile for non-renewable energy utilization, for a contextual investigation. While considering the panel of South Africa, Egypt, Algeria, Libya, Nigeria, and Tunisia, the study's objective offers a clear understanding of the connectedness of carbon emission, real output, renewable and non-renewable energy dimensions. As such, a novel perspective is presented in the study through (i) the methodology where the time-varying (TV) causality approach is being utilized to provide time inference of the associated relationship, and (ii) the case of the panel countries has rarely been considered together in the literature. The approach does not only offer the associated causality among the concerned variables, but it provides a time-specific inference or information about the variables' connectivity given the peculiarity and age-long energy security challenge confronting many of the African states. Given the energy and economic profiles of the selected countries, this study differs from several other studies exploring the African cases. Thus, the current study exhibits the potential to add significant knowledge to the existing strand of literature.

Besides, the followed sections of the study are arranged such that the next part (Sect. 2) presents the literature (theoretical and empirical) segments while Sect. 3 captures the data description and model specification. The employed methodology and the results of the estimation are presented in Sects. 4 and 5, respectively. Lastly, the study is summarized with a projection of policy relevance in Sect. 6.

2 Literature review

2.1 Theoretical literature

2.1.1 Economic growth and energy consumption

Since the study of Kraft and Kraft (1978), four hypotheses have been put forward to explain the pattern of association between economic growth and energy utilization: growth, conservation, feedback, and neutrality. The growth hypothesis asserts that there is a unidirectional causality from energy use to growth (Azam et al., 2021). The conservation hypothesis is the inverse of the former, alleging unidirectional causality from economic growth to energy consumption. The feedback hypothesis combines the two and suggests a bidirectional causality. Finally, the neutral hypothesis finds no causality between energy consumption and economic growth (Maji et al., 2019). Until today, the nexus of economic growth and utilization of varying energy forms have been extensively covered (Adedoyin et al., 2021; Alola & Saint Akadiri, 2021).

2.1.2 Carbon emission and economic growth

The nexus between CO2 emission and economic growth is derived from the Environment Kuznets Curve (EKC) hypothesis (Kuznets, 1955). The EKC hypothesis asserts that during earlier stages of economic growth, environmental degradation, commonly measured by CO2 emissions, rises to a maximum point, beyond which it falls (Espoir & Sunge, 2021). This leads to an inverted U-shaped relationship between the two. This relationship exists because, during early periods of growth, production processes depend on more polluting non-renewable energy sources (Lu, 2017). As growth continues, higher incomes make it possible to invest in low polluting production processes such that emissions per output will fall. In this scenario, economic growth is expected to Granger cause emissions. The relationship has since been upturned, with several studies including (Acheampong, 2018; Espoir et al., 2021; Spagnolo, 2012; Zaidi & Ferhi, 2019) showing that CO2 emissions can also Granger cause economic growth. As in the energy consumption-economic growth relationship, it is also possible to have bidirectional causality and even a no causality relationship.

2.1.3 Energy consumption and carbon emissions

There is no established theory or hypothesis relating energy consumption to CO2 emissions. However, statistics and empirical evidence logically suggest that energy consumption causes CO2 emissions. Data from the Intergovernmental Panel on Climate Change (IPCC, 2018) show that energy consumption, particularly non-renewable, accounts for approximately 70% GHGs across the globe. In addition, several studies, including (Adebayo et al., 2020; Adebayo & Kirikkaleli, 2021; Balogh & Jámbor, 2017; Khobai & Roux, 2017; Nuryartono & Rifai, 2017)) have shown a causality association between energy consumption and CO2 emissions. The following section reviews empirical literature related to the three strands of literature.

2.2 Empirical literature

Literature on the causality relationship among energy consumption, economic growth, and CO2 emissions continue to evolve. The literature can be classified into three strands; (1) CO2 and economic growth (Amarante et al., 2021; Odhiambo, 2017; Vo et al., 2019; Zaidi & Ferhi, 2019), (2) energy consumption and economic growth (Chontanawat, 2020; Mutascu, 2016; Pao & Fu, 2013; Shahbaz et al., 2013) and (3) energy consumption and CO2 emissions (Adebayo & Akinsola, 2021; Khobai & Roux, 2017; Nuryartono & Rifai, 2017). It is noteworthy that in each strand, results tend to be sensitive to geographical space, econometric approaches, and periods. In line with our scientific contribution, we focus on results heterogeneities emanating from different periods. Accordingly, our review is carefully chosen to demonstrate our thesis that causality among the variables under investigation is time-varying. Hence, we review studies in the same geographical scope over different periods.

The possibility that causality among these variables is time-varying can be seen from studies covering Brazil. A study by Amarante et al., (2021) assessed the causality relationship between CO2 emission and renewable energy consumption (REC), non- renewable energy consumption (NREC), and economic growth for 27 Brazilian states over the period 1997–2016. The study utilized the generalized methods of moment and autoregressive vector model for analysis. The results established (1) a negative, bidirectional causality between economic growth and CO2 emission (2) NREC positively caused CO2 emissions and economic growth, (3) REC negatively causes CO2 emissions, and positively causes economic growth, and (4) no causality between CO2 emission and energy use. In an earlier study on Brazil (Pao & Fu, 2013), for the period 1980 to 2010 for the aggregate economy, the causality was investigated between economic growth and four forms of energy consumption; non-hydroelectric renewable energy consumption (NHREC), total renewable energy consumption (TREC), nonrenewable energy consumption (NREC), and the total primary energy consumption (TEC).

Vector error correction estimation revealed; (1) unidirectional causality from NHREC to economic growth and from economic growth to NREC or TEC, (2) bidirectional causality between economic growth and TREC. The interesting dimension here is that in Pao and Fu (2013), there is bidirectional causality between REC and economic growth, whereas in Amarante et al., (2021), only unidirectional causality from REC is confirmed. Barring the slight methodological disparities, time dynamics is more likely the primary factor in these different findings. Also, Chontanawat (2020) uses data spanning 1971–2017 to show unidirectional causality running from economic growth to energy consumption.

The same pattern is evident in Africa. For instance, we noted diverging evidence on energy consumption and economic growth from studies by Qudrat-ullah and Nevo (2021). In Qudrat-ullah and Nevo (2021), data for 37 African countries from a shorter period 2008–2014 supports the growth hypothesis. Again, sample size apart, the period under investigation cannot be ignored as a determining factor. In another study, Alabi et al., (2017) agrees with Qudrat-ullah and Nevo (2021) on the growth hypothesis for renewable energy in African OPEC countries. However, regarding non-renewable energy, Alabi et al., (2017) confirm the feedback hypothesis while Qudrat-ullah and Nevo (2021) sides with the conversation hypothesis. The trend is also alive in Europe, where results continue to contradict. For instance evidence by Pejović et al. (2021) find no causality between economic growth and renewable energy consumption in 28 European countries using data from 2008 to 2018. In another study spanning 1995 to 2014, Radmehr et al. (2021) reported that the relationship is bidirectional.

Turning to the CO2-economic growth nexus, results strongly suggest causality differences across time for the same geographical areas. Using a dynamic-panel Granger causality approach for 1986–2013 among 10 SSA countries, Odhiambo (2017) reports a unidirectional causality relationship stemming from economic growth to CO2 emissions for both the short-run and long-run. In contrast, Zaidi and Ferhi (2019) find evidence for bidirectional causality after applying a dynamic GMM simultaneous-equation estimator over a more recent and shorter period, 2000–2012. Also, we refer to conflicting studies by Vo et al. (2019) Chontanawat (2019), and Jauhari et al. (2018), from Indonesia covering different time horizons. In Africa, for example, Jacques & Keho (2016) and Attiaoui et al.(2017) for periods 1971–2010 and 1990 and 2011, respectively.

2.3 Significant contribution

The review above points to an exciting conclusion. The causal relationship is TV, where there is Granger causality among variables over a specific time-interval. In some cases, it is possible to observe bidirectional causality in some time intervals and not in others. However, our observation thus far is not based on any econometric process. This is because the conventional causality tests employed in these studies, such as Granger and even the increasingly popular Toda and Yamamoto (1995) assume static causality over the whole study period. Realistically, this is less likely due to change in global and local policy on climate-related issues and the significant changes in energy consumption and production process. Thus, the adopted method here follows Balcilar et al., (2010) considering a situation when there is instability in the causal relationship between two variables (also that the non-causality is not rejected), it becomes unclear to argue about what has been rejected. This ambiguity can be addressed by allowing for time-varying causality among the concerned relationships. Econometric approaches to handle this are still new and developing, and understandably, such evidence is still scant. Moreover, the aforementioned approach is applied alongside Emirmahmutoğlu et al., (2021) to close the research gap on the drivers of environmental sustainability for the case of Africa.

3 Data and model specification

We start by collecting annual data on GDP per capita (measured in billions of US dollars), CO2 emissions per capita (measured in metric tons per capita), REC and NREC (both measured in billion kilowatt-hours) from the World Bank and the US. Energy Information Administration (EIA)Footnote 1 databases from 1980 to 2017. We next construct a dataset of six African countries (South Africa, Egypt, Algeria, Libya, Nigeria, and Tunisia) based on their importance in terms of NREC (see Fig. 1). Additionally, we use NREC for sample country selection because it is the most dominant energy source for most African countries (Espoir et al., 2021). We employ quarterly data in implementing the time-varying causality procedure between REC and NREC, real output, and CO2 emissions. Specifically, we use the Deaton (1970) data transformation method to obtain the time series. Due to the high range of the data, all the time series variables are seasonally adjusted to account for business cycle movements and financial shocks.

Fig. 1
figure 1

Period average value of non-renewable electricity consumption (billion kWh) across African countries, 1980–2017

In Fig. 2, we present the dynamics of the REC, NREC, and GDP per capita relative to carbon dioxide emissions (CO2 emissions) of the six selected countries starting from 1980 to 2017. In addition, the basic descriptive statistics of the variables for each of the six countries are illustrated in Table 1.

Fig. 2
figure 2

Source: Authors own computation

Pattern and relative magnitude of lnREC, lnNREC, lnGDP, and lnCO2. Note: This figure shows the dynamics of GDP per capita, renewable and non-renewable electricity consumption, and CO2 emissions in a South Africa, b Egypt, c Algeria, d Libya, e Nigeria, and f Tunisia.

Table 1 Descriptive statistics

To be consistent with the pollution-growth and the pollution-energy literature, this study adopts a model specification presented as:

$${\text{CO}}_{2t} = f\left( {REC_{t}^{\alpha } NREC_{t}^{\beta } GDP_{t}^{\vartheta } } \right)$$
(1)

where \({\text{CO}}_{2t}\) denotes CO2 emissions per capita, \(REC_{t} (NREC_{t} )\) is renewable (non-renewable electricity consumption), respectively. \(GDP_{t}\) is GDP per capita (a proxy for real output), \(\alpha\), \(\beta\), and \(\vartheta\) are the coefficients of the variables to be estimated.

By logging both sides of Eq. (1), we get:

$$ln{\text{CO}}_{2t} = \varphi + \alpha lnREC_{t} + \beta lnNREC_{t} + \vartheta lnGDP_{t} + v_{t}$$
(2)

where \(ln\), \(\varphi\), and \(v_{t}\) represent the natural logarithm, regression intercept, and stochastic error term.

4 Estimation strategy

In empirical studies, the causality test developed by Toda and Yamamoto (1995) (now regarded as TY) is among the most popular methods to examine the causal relationships between two variables. TY have developed a LA-VAR (Lag Augmented VAR) causality approach as an alternative to the vector autoregressive (VAR) model. They show that the VAR could not be used when the variables are non-stationary or co-integrated. Furthermore, they indicate that if the variables are non-stationary, the traditional asymptotic theory from the Granger (1969) causality approach is not valid for hypothesis testing in the level VAR specification. Given the difficulty of utilizing the VAR model in the presence of non-stationary series, TY (1995) suggest a Wald test statistic that asymptotically follows a chi-square distribution even in different order of integration of the variables. Following Hacker and Hatemi-J (2006) description, in this study, the TY VAR(p + d) model can be presented in a more compact was as:

$$R = FQ + \emptyset$$
(3)

where

R = (\(x_{1}\),…, \(x_{T}\))(\(n x T\)) matrix, F = (\(v\), \(H_{1}\),…, \(H_{p}\),…, \(H_{p + d}\))(\(n x \left( {1 + n\left( {p + d} \right)} \right)\)) matrix, \(Q_{t}\) = \(\left[ {\begin{array}{*{20}c} 1 \\ {x_{t} } \\ {x_{t - 1} } \\ . \\ . \\ . \\ {x_{t - p - d + 1} } \\ \end{array} } \right]\left( {(1 + n\left( {p + d} \right)} \right) x 1)\) matrix, for \(t = 1, \ldots T,\) matrix, Q = \(\left( {Q_{0} , \ldots Q_{T - 1} } \right) \left( {(1 + n\left( {p + d} \right)} \right) x T)\) matrix, \(\emptyset\) =  = \(\left( {\varepsilon_{1} , \ldots \varepsilon_{T} } \right)\left( {n x T} \right)\) matrix.

However, a modified Wald (MWALD) test statistic was introduced by TY (1995) to test the null hypothesis of non-Granger causality as:

$$MWALD = (Y{\Phi })^{^{\prime}} \left[ {Y((Q^{\prime}Q)^{ - 1} \otimes Z_{U} } \right]^{ - 1} Y^{\prime}H^{ - 1} \left( {Y{\Phi }} \right) \sim \chi_{P}^{2}$$
(4)

where \(Y = bp x n\left( {1 + n\left( {p + d} \right)} \right),\) \(\otimes =\) the Kronecker product, \(Z_{U}\) = the estimated variance–covariance matrix of residuals in Eq. (3), \({\Phi }\) = vec \(\left( F \right)\), where vec represents the column stacking operator.

Under the null hypothesis, the MWALD statistic has the usual \(\chi_{P}^{2}\) property, conditional on the assumption that the error terms are normally distributed, with the number of degrees of freedom (p) equal to the number of restrictions to be tested. Nevertheless, Hacker and Hatemi-J (2006) indicates that the MWALD test statistic usually rejects the null hypothesis, specifically when the error term is not normally distributed and characterized by autoregressive conditional heteroscedasticity (ARCH).

To avoid spurious results and wrong policy prescription, we consider and rely on the time-varying causality tests. We particularly and briefly review three time-varying causality tests such as the rolling window (RW) approach of Balcilar et al., (2010), the forward expanding window (FEW) approach of Thomas (1994), and the recursive evolving window (REW) approach (Emirmahmutoglu et al., 2021; Shi et al., 2017). A crucial point to be mentioned here is that all the three time-varying causality tests as listed above fundamentally uses VAR model, which gives a possibility for calculation of a MWALD test statistic.

Let us consider \(g\) to be the (fractional) observation of the estimated regression and \(g_{1}\) and \(g_{2}\) the (fractional) starting and ending points of the estimated regression (\(g\)), respectively. Let us also assume \(\varphi_{1} = \left[ {g_{1} T} \right]\), \(\varphi_{2} = \left[ {g_{2} T} \right]\), where \(\left[ . \right]\) is the integer part with interest fractional of the time dimension, T. Similarly, \(\varphi_{w} = \left[ {g_{w} T} \right]\), where \(\varphi_{w}\) is equal to the minimum number of observations required to estimate the LA-VAR model. To begin with the FEW test, the procedure considers a fixed starting point of the regression (\(\varphi_{1}\)) on the first available observation. Then the regression window size expends from \(\varphi_{w}\) to \(T\). In other words, the movement of the ending point of the regression goes forward from \(\varphi_{w}\) to \(T\). Similar to the FEW test, the RW approach has also the ending point of regression \(\varphi_{2}\) going from \(\varphi_{w}\) to \(T\). The only difference is that the regression window size (\(\varphi_{w}\)) is fixed and thus the starting regression point \(\varphi_{1} = \varphi_{2} - \varphi_{w} + 1\).

For the REW approach, the procedure is to combine the procedure of both the FEW and the RW approaches. The REW approach allows the starting and ending regression points and the window size of the regression to vary in the recursive evolving window approach. This flexibility provides the REW approach a net advantage over the FEW and REW approach. Moreover, the REW approach has an additional advantage over the other two approaches in finite samples for both non-stationary and stationary time series (Emirmahmutoglu et al., 2021; Shi et al., 2017). Thus, in this study, we follow the REW approach to obtain the MWALD statistic for each subsample regression as follows:

$$\begin{aligned} & SW_{g} \left( {g_{0} } \right) = sup\quad W_{{g_{1} }}^{{g_{2} }} \\ & g_{2} = g,g_{1} \in \left[ {0, g_{2} - g_{0} } \right] \\ \end{aligned}$$
(5)

where \(W_{{g_{1} }}^{{g_{2} }}\) denotes the sample size fraction of \(g_{w} = g_{2} - 1 \ge g_{0}\).

Then, the time-varying causal relationships are obtained by the origination (\(g_{e}\)) and termination (\(g_{f}\)) periods. The computation of these two periods is as follows:

$$\hat{g}_{e} = \mathop {inf}\limits_{{g \in \left[ {g_{1} ,1} \right]}} \quad \left\{ {g: SW_{g} \left( {g_{0} } \right) > scv} \right\}$$
(6)
$$\hat{g}_{f} = \mathop {inf}\limits_{{g \in \left[ {\hat{g}_{e} ,1} \right]}} \quad \left\{ {g: SW_{g} \left( {g_{0} } \right) < scv} \right\}$$
(7)

where \(scv\) is the corresponding subsample critical value of the \(SW_{g}\). Figure 3 below provides the Schematic flow and pseudo-code of the research methodology as described in this section.

Fig. 3
figure 3

Schematic flow and pseudo-code of the research methodology using. Source: Authors’ own presentation using YeD

5 Empirical results and discussion

To investigate the dynamic causal relationship between REC, NREC, GDP, and CO2 emissions, we first test for a unit root in all the time series of the six selected countries using the well-known \({Z}_{(t)}\) test of Dickey and Fuller (1979) and Phillips and Perron (1988). This procedure allows us to determine the order of integration of all the variables. Table 2 presents the unit root test results for the model with an intercept and an intercept and trend. The results of this table clearly indicate that all the variables are stationary at the first difference, thus integrated order of one, I(1).

Table 2 Variable order of integration summary

After determining stationarity and order of integration among the variables, we now proceed and present the results of the Toda-Yamamoto causality test between REC, NREC, GDP, and CO2 emissions for each country in Table 3. We employ the Schwarz Bayesian Information Criterion (SBIC) in selecting the optimal lag length for the regressions of the VAR models. As shown in Table 3, REC Granger causes CO2 emissions at the 10% percent significance level in Egypt. Next, we observe a unidirectional causality running from CO2 emissions to REC at the 5% significance level and from CO2 emissions to GDP at the 10% significance level in Libya. Moreover, there is a bidirectional causal relationship between NREC and CO2 emissions at the 1% significance level in Tunisia, respectively. Finally, there is no causal relationship between REC, NREC, GDP, and CO2 emissions in the rest of the sample countries (South Africa, Algeria, and Nigeria), suggesting the validity of the neutrality hypothesis in those countries.

Table 3 Results of TY causality test for the entire sample period

Despite these exciting findings, in this study, we consider the Toda-Yamamoto causality results inaccurate and inconsistent because all our variables in all the six countries are subject to several exogenous and endogenous financial, political and economic dynamisms and shocks. In addition, it is well acknowledged that most African economies have structurally changed over the past three decades Diao (2017). It is possible that those dynamisms, shocks, and structural changes that happened in the recent past will have positively or negatively affected the time series variables' behavior. Hence, the assumption of a time-invariant causal relationship between REC, NREC, GDP, and CO2 emissions over a sample period spanning 1980Q1 and 2017Q4 may provide incorrect results and lead to a wrong policy prescription.

To avoid spurious results, we conduct the time-varying Granger causality test as described in the methodology section. We believe that this approach provides consistent and robust results as it considers any structural change in the relationship between REC, NREC, GDP, and CO2 emissions. We present the results for the time-varying Granger causality tests in Figs. 4 and 5. It is important to mention that we employ the SBIC with a maximum lag order of 10 in selecting the optimal lag length in the LA-VAR model for all subsample regressions. In time-varying analysis, the results rely heavily on the size of the window. In rolling window regression for example, there is no strict criterion for selecting the window size. Pesaran and Timmermann (2005) studied the window size in terms of root-mean-square error (RMSE) under structural change assumption. These authors found that optimal window size depends on the size of the break and the persistence. Their Monte Carlo simulations disclosed that a window size around 10–20 was enough to minimize the bias in autoregressive (AR) parameters especially when there are frequent breaks. Given the length of our time series and based on the simulation results in Pesaran and Timmermann (2005), we set the minimum window size to 40 observations. Additionally, note that the empirical size is 5% and we obtain the bootstrap critical values (the test statistic sequences) with 999 replications.

Fig. 4
figure 4

Time-varying Granger causal relationship between REC, NREC, GDP, and CO2 emissions for Nigeria

Figures 4, 5, 6, 7, 8 and 9 present the plots of the recursive evolving window (REW) test statistics and the 5% critical value sequence for Nigeria, South Africa, Egypt, Libya, Tunisia, and Algeria, respectively. Figure 4 shows the time-varying Granger causality results for Nigeria. The plots show the test statistics testing the null hypothesis that (non)renewable electricity consumption does not Granger-cause GDP and CO2 emission and the opposite case, respectively. At a glance, it can be seen that the direction and strength of causality across all three relationships are time-varying. When the test static sequence is greater than the 5% critical value, the null hypothesis of no causality is rejected. Taking the REC to CO2 emission relationship into perspective (upper panel of Fig. 4), we observe that the null hypothesis that REC does not Granger-cause CO2 emission is not rejected at the 10% level of significance during the 1980Q1 to 1997Q2 period. In addition, we observe that REC Granger-cause CO2 emissions in different time sequences: (1) causality from 1997Q3 to 2001Q4, (3) oscillating causality from 2002Q1 to 2002Q4, (4) no causality from 2003Q1 to 2008Q3, and (5) causality from 2008Q4 to 2017Q4.

Fig. 5
figure 5

Time-varying Granger causal relationship between REC, NREC, GDP, and CO2 emissions for South Africa

Fig. 6
figure 6

Time-varying Granger causal relationship between REC, NREC, GDP, and CO2 emissions for Egypt

Fig. 7
figure 7

Time-varying Granger causal relationship between REC, NREC, GDP, and CO2 emissions for Libya

Fig. 8
figure 8

Time-varying Granger causal relationship between REC, NREC, GDP, and CO2 emissions for Tunisia

Considering the reverse causality from CO2 to REC, we observe a more unstable trend. Causality is evident for the periods 1999Q1–2001Q1, 2002Q1–2005Q2, 2010Q3–2012Q3, and 2012Q3–2017Q4. Otherwise, there is no causality for all other periods, except 2008Q4–2009Q2, which experienced inflection causality. Looking at both directions, we also observe bidirectional causality for the period 1999Q1–2001Q1 and 2012Q3–2017Q4 and unidirectional causality from REC to CO2 for the period 1997Q4–1998Q4 and CO2-REC for the period 2002Q1 to 2005Q2. The results of NREC-CO2 relationship (middle panel) and GDP-CO2 (lower panel) follow the same interpretation and conclusion: (non)causality is not static but varies with time.

It is important to recall the Toda-Yamamoto causality results for comparison. Previously, results for Nigeria have pointed to the neutrality hypothesis across the three relationships for the entire period, 1980Q1–2017Q4. As we have shown through the time-varying Granger causality results, the conclusion is not proper. Indeed, (non)causality is dynamic. It changes direction and strength over time. Our findings are in tandem with recent evidence by Emirmahmutoglu et al., (2021), who confirm time-varying causality for four energy sectors in the US. The results for Nigeria are more or less mirrored for Egypt (Fig. 6), Libya (Fig. 7), and Algeria (Fig. 5). For these countries, the existence/non-existence and direction of causality changes with time across all three relationships. However, in Figs. 4 and 7, respectively, results for South Africa and Tunisia tell an interesting story.

For South Africa as is in Fig. 8, the absence of causality is observed from REC to CO2, CO2 to NREC, and CO2 to GDP. These results are like those of the Toda-Yamamoto test. However, when we consider reverse causality for these relationships, the Toda-Yamamoto tests are rejected. For example, while Toda-Yamamoto results suggest a neutral hypothesis across all the three relationships in South Africa, the time-varying causality results imply unidirectional causality for some periods. For instance, in the upper right panel in Fig. 8, there is clear causality from CO2 emission to REC for the period 2004Q1–2006Q3. The same can be said for directional causality from GDP-CO2 during 2013Q2–2015Q3. For Tunisia, as the upper panel of Fig. 9 shows, the REC-CO2 emission relationship is distinct. Throughout, the test statistics are clearly drifting away from the 5% critical values, suggesting the absence of causal relationship between REC and CO2 emission. It is the only case across all the countries where the neutrality hypothesis is confirmed for the entire period from 1980Q1 to 2017Q4. The results for NREC-CO2 emission and GDP-CO2 compares very well with Nigeria, Libya, and Algeria.

The existence of time-varying causality among the three relationships is important for policy. If anything, it implies that policy meant to promote environmentally friendly and sustainable economic growth should not be static. In other words, our empirical findings imply that specific policy designed to promote growth and mitigate the global warming through carbon dioxide abatement must be dynamic in relation to countries structural changes. Otherwise, wrong decisions are made. Comparing the Toda-Yamamoto and time-varying causality results for Nigeria helps to elaborate on this.

However, closely examining the estimated results, we witness a bidirectional time-varying causality between GDP and CO2 emissions in all six African countries. The only exception is South Africa, where we observe a unidirectional causality running from GDP to CO2 emission. The causality effect from GDP to CO2 emission means that industrial productions in all six African countries promote economic growth. Meanwhile, the structural economic dynamics accelerate carbon dioxide emissions. Moreso, the causality effect from CO2 emission to GDP implies that economic structural changes from energy and carbon-intensive economies to decarbonised economies could be an important factor to the global efforts to mitigate climate change and its impacts as well as attaining the SDG 13 (Bekun et al., 2019; Sarkodie & Strezov, 2018).

Fig. 9
figure 9

Time-varying Granger causal relationship between REC, NREC, GDP, and CO2 emissions for Algeria

Furthermore, we observe a bidirectional causality between REC and CO2 emission at different time sequences in countries such as Nigeria, Egypt, Libya, and Algeria. In addition, a unidirectional time-varying causality from CO2 emission to REC is observed for South Africa, while no causality effect is depicted between REC and CO2 emission for Tunisia. Also, we detect a bidirectional causality between NREC and CO2 emission at different time sequences in all countries, except South Africa where a unidirectional time-varying causality running from NREC to CO2 emission is evident. These findings indicate that both REC and NREC trigger CO2 emissions in these countries and vice versa. Nevertheless, we maintain two key observations from these findings. First, fossil fuel energy utilization accelerates carbon dioxide emissions leading to extreme climate change-related events. Second, countries increase their clean energy technologies penetration in their energy mix to reduce energy imports and diversify supply options. They also diminish their economic vulnerability to price volatility and increase energy security. These two observations show that at some point, environmental and growth actors need to balance energy consumption and CO2 emissions. When REC causes CO2 emission there is an impetus to increase investment in renewable energy sources relative to nonrenewable sources. Therefore, we recommend a progressive shift from nonrenewable to renewable energy technologies as more intermittency, energy stability, sustainable growth, and pollution abatement can be achieved.

6 Conclusion

Many studies examine the relatively important role of renewable and nonrenewable energy consumption and economic growth in driving carbon dioxide and greenhouse gas emissions. Most of those studies focus their interest on industrialized countries such as the United States and the EU countries, but little is known for African countries. The ultimate aim of such studies is to produce evidence-based policy that can help to mitigate climate change and its impact. Thus, Africa as part of the World regions seems to remain behind on this important front.

Furthermore, the existing studies that examine the association between REC, NREC, GDP, and CO2 emissions through causality hypothesis framework consider a strong assumption of homogeneity over the entire study period and overlook the presence of a possible time-varying relationship. Given this drawback, the current study investigates the causality relationship between REC, NREC, GDP, and CO2 emissions in six selected African countries over the period spanning 1980Q1–2017Q4. To achieve the research objective, we utilize two different causality tests. First, we employ the conventional Toda-Yamamoto causality technique. The results of this approach indicate a unidirectional causality from REC to CO2 emission in Egypt, a unidirectional causality from CO2 emission to REC and CO2 emission to GDP in Libya, and a bidirectional causality between NREC and CO2 emission in Tunisia. Second, we utilize a recursive evolving window (REW) test to consider time-varying causality mainly due to several dynamisms that characterize time series over the years. The results of this approach indicate the presence of causality among the three relationships for all six African countries over different time sequences.

Contrary to the Toda-Yamamoto causality results that indicate static no(causality) among the three relationships, the REW causality results show that the associations vary significantly across the time periods. In other words, the causality relationship between REC, NREC, GDP, and CO2 emissions is dynamic. These findings have implications for research and policy. For research, the results suggest that causality relationships could vary significantly across the techniques employed by the researcher. For policy implication, the results of REW causality approach suggest that policy formulated to promote environmentally friendly and sustainable economic growth in Africa and in the world at large should not be static. Those policy should be dynamic by considering countries economic structural changes.

Our findings is a case for speeding the NREC to REC transmission. Given that REC causes CO2 emission and economic growth, African governments are supposed to escalate investment in RE sources. Such investments should be anchored on the abundance of renewable energies in Africa vis-a-vie low exploitation. In addition, reports have shown that the cost of renewable energy projects are declining and continued to be competitive and lower than that of fossil fuel projects. For instance, it is reported that close to two-thirds or 163 gigawatts (GW) of greenfield renewable power investments in 2021 were cheaper compared to the world’s cheapest coal-fired alternatives in G20 (International Renewable Energy Agency, 2021). This shows the sustainability of renewable energy in Africa, and therefore an impetus to increase investment in the sector. This can go a long way to address energy poverty in Africa, and has a potential to be the foundation for environmentally friendly sustainable economic growth in the region.