1 Introduction

Climate change has gained a great deal of attention among environmental economists around the world as a result of its impact on sustainable growth (He et al., 2020). Rafique et al. (2020) posit that investment is debated as key to a country’s development, particularly foreign direct investment (FDI) inflows. Consequently, Abdouli and Omri (2021) posit that the drastic environmental changes in recent decades have been triggered by excess FDI, economic growth, and its associated energy use. Hongxing et al. (2021b) articulated that FDI inflows provide direct financing resources to promote economic growth through technology transfer and the development of new processes and management skills. However, with FDI inflows’ positive impact on economic growth, theoretically, there are two competing schools of thought about the relationship between the FDI inflows and environmental pollution. Scholars such as (Mukhtarov et al., 2020; Wu et al., 2020) regard FDI inflows as one of the key factors that contribute to environmental degradation, whereas others, such as (Munir & Ameer, 2020; Sabir et al., 2020), argue that FDI inflows increase the quality of the environment. A closely linked variable with environmental degradation is urbanization with its associated industrialization and agricultural modernization (Odugbesan & Rjoub, 2020). The United Nations Urbanization Statistics (2019) revealed that cities like Tokyo have become the world’s largest city with an agglomeration of 37 million inhabitants, followed by New Delhi with 29 million, Shanghai with 26 million, and Mexico City and São Paulo, each with about 22 million inhabitants. According to Ahmad et al. (2021), URB results in the use of more energy due to the diversification of operations from low to high energy demand sources. The resultant upsurge in energy consumption results in high CO2 emissions. A contrasting finding was obtained by Mahmood et al. (2020), who unveiled evidence that showed URB has an inverse predictor of CO2 emissions in Saudi Arabia.

This relationship between FDI inflows, urbanization, and environmental quality is puzzling. It is still unclear for developing countries, especially the Economic Community of West African States (ECOWAS), whether the effect of FDI and URB is positive or negative on the environment. The net inflows FDI in ECOWAS grew from US $1.91 billion in 2000 to US $13.5 billion in 2009 with a net inflow reaching an all-time high of US $18.8 billion in 2011. In 2016, ECOWAS share of total inflows to Africa’s FDI amounted to US $10.1 billion (19.14%), whereas in 2017 it grew to US $12.69 billion (30.39%) (UNCTAD, 2018). The World urbanization prospects (2016), revealed that the number of urban dwellers within ECOWAS rose from 4 million in 1950 to 165 million urban dwellers in 2015. The increase in urban dwellers may have led to an increase in energy consumption, although its effect on CO2 emissions is a dilemma. Whereas studies such as (Gbatu et al., 2019; OMOJOLAIBI et al., 2020) revealed that URB is a determinant of CO2 emissions in ECOWAS, studies such as (Ameyaw et al., 2020; Omotor, 2017) posit that URB is not a key determinant of CO2 emissions in ECOWAS. ECOWAS experienced remarkable economic growth which is evident from their GDP’s reaching a promising level of US$ 6.36 trillion in 2017, at an increasing rate of 3.7% from previous years. Economic growth in the community was peaked at 3.9% in 2019 before the outbreak of coronavirus (UNCTAD, 2018). ECOWAS’s total regional greenhouse gas emissions as in 2014 were 994.70 million metric tons equivalent (MtCO2e) and rose in 2019 to 1.043 billion metric tons. Thus, the question of the sustainability of growth in ECOWAS has become an issue of interest since many academic discourses have shown evidence of conflicting effect of FDI and URB on CO2 emissions.

Literature regarding CO2 emissions–FDI–growth can be grouped into three hypotheses; the unidirectional hypothesis, the feedback hypothesis, and the hypothesis of neutrality. In regards to the unidirectional hypothesis, Odugbesan and Rjoub (2020) examined the nexus between economic growth and CO2 emissions in MINT countries within the period 1990–2017 ARDL Bounds test approach. The empirical findings support the unidirectional causal effect from economic growth to CO2 emissions. Rahman et al. (2020) similarly but different variables and methodological focus investigated the relationship between trade openness and CO2 emissions using the Granger causality from 1990 to 2017. Their empirical finding supports the unidirectional causation from trade openness to CO2 emissions. Other studies revealed a bidirectional Hypothesis contrary to the unidirectional causation effect. Thus, some studies obtained a two-way causation relationship. Abban and Hongxing (2021a) delved into the determinants of economic growth in Africa from 1990 to 2018. They grouped the main panel into sub-groups of economic classification and employed the D–H causality test. They discovered that a bidirectional affiliation exists between FDI and CO2 in the main panel and lower-middle-income panel. Wu et al. (2020) explored the relationship between CO2 emissions and urbanization from 1990 to 2018 using the D–H causality, taking into account income grouping along the BRI. Empirical evidence showed that a bidirectional association was found between urbanization and CO2 emissions in low- and lower-middle-income countries. Yet again other studies reported the neutrality hypothesis, these studies obtained no causal effect on the employed variable and CO2 emissions, which validates the neutrality hypothesis. Saidi and Omri (2020) also investigated the impact of economic growth and CO2 emissions in 15 major renewable energy-consuming countries. They employ a panel data set from 1990 to 2014 and the vector error correction model (VECM) to unveil the effect of energy consumption on CO2 emissions. They revealed that no causation effect exists between energy consumption and CO2 emissions. In a similar vein, Zeren and Akkuş (2020) investigated the relationship between energy consumption and CO2 emissions in emerging countries from 1980 to 2015. The empirical result from the D–H causality test revealed that no causal effect between energy consumption and CO2 emissions exists. The diversity reports by researchers on CO2 and its determinants are indicative of the need for further study of the relationship of CO2 and its determinants.

A handful of studies on CO2 emissions and other variables have been conducted in the ECOWAS community, nevertheless, there are limitations to these previous ECOWAS studies relating to CO2 emissions and its determinants. This study resolves and to the extant literature in two ways. First, as a priority made on determining the epitope of CO2 emissions in the ECOWAS community, most studies only considered the lump sum of countries without considering sub-panels. This study, however, clustered the countries into energy exporters and energy importers. Theoretically, there is a differential impact between energy exporters and energy importers and warrant an empirical study to test this assumption. Lastly, in addition to the few studies that exist based on our knowledge of CO2 emissions and their initiators in the ECOWAS community, they pre-arrogate the existence of slope heterogeneity and cross-sectional independence residual, which to some extent is likely to produce inaccurate estimation results. This research probed into cross-sectional dependency and heterogeneity, thus, the analysis in this study used recently established econometric methods that take the above problems into account.

2 Methodology

This section constitutes the model formulation and econometric processes employed during the study. The section also describes the Source of Data and Descriptive Statistics.

2.1 Model formulation

Examining the causal relationship among CO2, ENR, FDI, GDP, TRD, and URB, the study employed (Abban & Hongxing, 2021b; Gao & Zhang, 2021) and others’ model, therefore the CO2 emissions estimate function was written as:

$$ {\text{CO}}_{{2}} = \, ({\text{ENR}},{\text{ FDI}},{\text{ GDP}},{\text{ TRD}},{\text{ URB}}). $$
(1)

To address the problem of absence of homoscedasticity, hence, the transformed multivariate CO2 model was written as;

$$ {\text{LnCO}}_{{\text{2, it}}} = \beta_{0} + \beta_{1} {\text{LnENR}}_{{{\text{it}}}} + \beta_{2} {\text{LnFDI}}_{{{\text{it}}}} + \beta_{3} {\text{LnGDP}}_{{{\text{it}}}} + \beta_{4} {\text{ LnTRD}}_{{{\text{it}}}} + \beta_{5} {\text{LnURB}}_{{{\text{it}}}} + \varepsilon_{{{\text{it}}}} $$
(2)

where \({\upbeta }_{0}\) is the coefficient of the slope, \(\mathrm{i}\) represents each selected countries in the study (1, 2… N), \(\mathrm{t}\) for the period of study and error term giving by \({\upvarepsilon }_{\mathrm{it}}\). \({\upbeta }_{1}-{\upbeta }_{5}\) are the coefficients for ENR, FDI, GDP, TRD, and URB, respectively.

2.2 CCEMG and AMG estimators


The augmented mean group (AMG) and common correlated effects mean group (CCEMG) were used to obtain the effects of the independent variables on the dependent variable. The method framework is as follows;

Taking a model such as;

$$ y_{{{\text{it}}}} = \beta_{{\text{i}}} x_{{{\text{it}}}} + \varepsilon_{{{\text{it}}}} $$
(3)
$$ {\text{where }}\;\;\varepsilon_{{{\text{it}}}} = \theta_{{1{\text{i}}}} + \delta_{{\text{i}}} f_{{\text{t}}} + u_{{{\text{it}}}} $$
(4)
$$ {\text{x}}_{{{\text{it}}}} = {\uptheta }_{{2{\text{i}}}} + {\updelta }_{{\text{i}}} {\text{f}}_{{\text{t}}} + \vartheta_{{\text{i}}} {\text{g}}_{{\text{t}}} + {\text{e}}_{{{\text{it}}}} . $$
(5)

In the CCEMG as proposed by Pesaran (2006), \({y}_{it}\) is the response variable, \({x}_{it}\) is the explanatory variables where as \({\beta }_{i}\) is each specific country slope coefficient on the observed independent variable, while \({\varepsilon }_{it}\) is made up of the unobserved independent and the error terms \({u}_{it}\). Time invariant heterogeneity across groups is captured by \({\theta }_{1i}\), the group fixed effects, \({f}_{t}\) is an observed common factor, while \({\delta }_{i}\) captures time-variant cross-sectional correlation and heterogeneity. \({e}_{it}\) and \({u}_{it}\) are the error terms.

The Eberhardt and Teal (2010)’ AMG, was used along with the CCEMG estimator. Unlike the CCEMG estimation which considers \({f}_{t}\) as a nuisance, and its accountability was not of interest, the AMG accounts for \({f}_{t}\). The AMG follows three steps: (1) is the ordinary least square in Eq. 6 with T-1 year dummy (\({\mathrm{q}}_{\mathrm{t}}\)) in the first difference (\({\Delta \mathrm{D}}_{\mathrm{t}}\)). (2) \({\upomega }_{\mathrm{t}}\) was then included in Eq. 7. It is included to compensate for any special processes that may develop over time. The subtraction of \({\upomega }_{\mathrm{t}}\) from the response variable (Eq. 8), signifying that a mutual process has been inflicted on each set of unit coefficients. (3) Lastly, AMG estimates are obtained as averages from each country's estimates. The group-specific regression model is adjusted with variables of \({\upbeta }_{\mathrm{t}}\) first, and then the average group-specific parameters are calculated. In regards to Eq. (2), the model is written as;

$$ {\text{LnCO}}_{{\text{2, it}}} = \beta_{0} + \beta_{1} {\text{LnENR}}_{{{\text{it}}}} + \beta_{2} {\text{LnFDI}}_{{{\text{it}}}} + \beta_{3} {\text{LnGDP}}_{{{\text{it}}}} + \beta_{4} {\text{LnTRD}}_{{{\text{it}}}} + \beta_{5} {\text{LnURB}}_{{{\text{it}}}} + \mathop \sum \limits_{t = 2}^{T} q_{{\text{t}}} \left( {\Delta D_{{\text{t}}} } \right) + \mu_{{{\text{it}}}} $$
(6)
$$ {\text{LnCO}}_{{\text{2,it}}} { } = \beta_{0} + \beta_{1} {\text{LnENR}}_{{{\text{it}}}} + \beta_{2} {\text{LnFDI}}_{{{\text{it}}}} + \beta_{3} {\text{LnGDP}}_{{{\text{it}}}} + \beta_{4} {\text{LnTRD}}_{{{\text{it}}}} + \beta_{5} {\text{LnURB}}_{{{\text{it}}}} + d_{1} \left( {\omega_{{\text{t}}} } \right) + \mu_{{{\text{it}}}} $$
(7)
$$ {\text{LnCO}}_{{\text{2,it}}} - \omega_{{\text{t}}} = \beta_{0} + \beta_{1} {\text{LnENR}}_{{{\text{it}}}} + \beta_{2} {\text{LnFDI}}_{{{\text{it}}}} + \beta_{3} {\text{LnGDP}}_{{{\text{it}}}} + \beta_{4} {\text{LnTRD}}_{{{\text{it}}}} + \beta_{5} {\text{LnURB}}_{{{\text{it}}}} + \varepsilon_{{{\text{it}}}} . $$
(8)

2.3 Analytical processes

In order to specify the impact of the exploratory variables on the dependent variables, the following process was undertaken: (1) Various cross-sectional-dependency tests (Breusch–Pagan LM, bias-corrected scaled LM, Pesaran scaled LM, Pesaran CD, and Friedman) together with the Pesaran and Yamagata (2008) homogeneity test were performed to substantiate the existence of cross-sectional dependency and heterogeneous slopes in the panels. (2) The confirmation of cross-sectional reliance and slope heterogeneity led to the usage of the CIPS and CADF unit roots test proposed by Pesaran (2007) to determine the stationarity of the employed variables. (3) In order to determine the long-term connection among the variables, the Westerlund and Edgerton (2007) and the Pedroni (2004) test was carried out. (4) The long-term effects of the exploratory variables on the dependent variable were obtained with the AMG and the CCEMG estimators. (5) Lastly, the Dumitrescu and Hurlin (2012) were employed to ascertain the causal affiliation among the employed variables. The econometric processes are illustrated pictorially in Fig. 1.

Fig. 1
figure 1

Econometric processes employed during the study

2.4 Data source and descriptive statistics

It was necessary to divide these countries into energy importers and exporters because of the scarcity of conventional energy reserves and the rising reliance on energy imports. This provides a way of diversifying energy supply sources and maintaining energy protection for the ECOWAS group. These 14 countries obtained from the World Bank Development Indicators were divided into energy exporters and energy importers, according to the International Energy Agency (Table 1). The study span from 1990 to 2018 and this was due to data availability. The grouping is determined based on the ratio between net energy imports and energy usage, where energy imports are estimated to be energy use minus oil equivalent output. Net exporters are countries with negative net energy imports (Liu & Hao, 2018). Net energy imports are estimated as energy use less production, both measured in oil equivalents. A negative value indicates that the country is a net energy exporter. Using natural logarithms, the data were transformed to describe the estimates obtained as the elasticity of the response variable (CO2 emissions). The variables selected, their explanations, measurement units, and references are outlined in Table 2.

Table 1 List of selected countries
Table 2 Variable’s description and data source

In order to understand the coefficients of the employed variables as elasticities, the data in this analysis was transformed using the natural logarithm. The descriptive statistics of the study are displayed in Table 3. For the ECOWAS panel, CO2 (\(\mathrm{M}=9.741,\mathrm{ SD}=1.904\)), ENR (\(\mathrm{M}=8.317,\mathrm{ SD}=1.175\)), GDP (\(\mathrm{M}=9.883,\mathrm{ SD}=1.204\)), FDI (\(\mathrm{M}=13.254,\mathrm{ SD}=0.965\)), TRD (\(\mathrm{M}=16.403,\mathrm{ SD}=1.308\)) and URB (\(\mathrm{M}=8.634,\mathrm{ SD}=1.041\)). Comparing the descriptive statistics for the two energy groups, Table 4 reveals that CO2 in energy exporters (\(\mathrm{M}=10.653,\mathrm{ SD}=2.105\)) to importers countries (\(\mathrm{M}=9.201,\mathrm{ SD}=1.577\)). For ENR, energy exporters (\(\mathrm{M}=8.615,\mathrm{ SD}=0.751\)) to energy importers (\(\mathrm{M}=7.976,\mathrm{ SD}=1.289\)). FDI has (\(\mathrm{M}=13.401,\mathrm{ SD}=1.371\)) in energy exporters compared to energy importers (\(\mathrm{M}=13.432,\mathrm{ SD}=0.801\)). In regards to GDP, energy importers (\(\mathrm{M}=10.117,\mathrm{ SD}=1.386\)) compared to energy exporters (\(\mathrm{M}=9.713,\mathrm{ SD}=1.120\)). For TRD, energy exporters have (\(\mathrm{M}=16.789,\mathrm{ SD}=1.142\)) to (\(\mathrm{M}=16.154,\mathrm{ SD}=1.314\)) in energy importers. Lastly for URB energy exporters (\(\mathrm{M}=8.566,\mathrm{ SD}=0.987\)) compared to (\(\mathrm{M}=8.442,\mathrm{ SD}=1.106\)) in energy importers countries. The correlation effects among the variables employed are shown in Table 4. As shown below by the Pearson product correlation, a correlation coefficient less than 0.7 among all the variables was observed. Hence, no evidence of a strong relationship among the explanatory variables. Again the variance inflation factor (VIF) and tolerance values are employed to ascertain the multicollinearity between explanatory variables. Inferentially, since the value of VIF (\(<5\)) and the value of tolerance (\(>0.2\)), it can be reasoned that each explanatory variable has a unique effect on the response variable.

Table 3 Descriptive statistics
Table 4 Multicolinearity test results

3 Empirical results

The empirical results obtained from the various econometrics approaches follow as; cross-sectional dependence results, slope heterogeneity results, unit root test results, panel co-integration test results, panel model estimation results, and causality test results.

3.1 Cross-sectional dependence and slope heterogeneity test results

The findings of the cross-section dependence test are shown in Table 5. The results from the various tests indicated that the null hypothesis of cross-sectional independence is dismissed. The inference was there are enough grounds of cross-section correlation in the error terms among the panels. Hence econometric estimations that consider cross-sectional dependence was employed. Again, ignoring heterogeneity of slope coefficients may lead to imprecise estimates and skewed inferences (Breitung & Das, 2005). Hence, the Pesaran and Yamagata (2008) test was utilized in making that accession. As revealed in Table 6, the alternative hypothesis of heterogeneity in the slope coefficient is accepted. On this basis, estimators which are robust to heterogeneous problems and cross-sectional reliance were employed.

Table 5 Cross-sectional dependence results
Table 6 Pesaran and Yamagata homogeneity test results

3.2 Unit root test results

Table 7 gives the results obtained from the panel unit root tests. From the results, it was inferred that the null hypothesis of the unit root at the variable level, regardless of whether the time trend is included or not should be accepted. However, after the first difference, the six variables were stable at significant levels of 1%, 5%, and 10%. Therefore, all variables in this study are of order 0, I (0) and then became of order 1, that is, I (1). This allows for further research on the long-term equilibrium association between CO2, GDP, ENR, URB, FDI, and TRD variables.

Table 7 Panel unit root test results

3.3 Panel co-integration test results

In using the Westerlund and Edgerton (2007)’ co-integration to determine the long-run association, the null hypothesis of non-existence of co-integration is rejected at the various significance levels with respect to the statistics Gτ, Gα, Pτ, and Pα. As a comparative analysis, Pedroni (2004) co-integration test was also employed. Tables 8 and 9 present the two co-integration test results. The robust p values, which provide robust evidence of co-integration as shown in Table 8, were the basis for decision. Table 9 presents a total of seven statistics to confirm the Pedroni's panel co-integration test. Four test statistics rejected the null hypothesis of non-existence of co-integration. Therefore, there was much proof of co-integration among variables in the dataset.

Table 8 Westerlund bootstrap co-integration test
Table 9 Pedroni co-integration test

3.4 Panel model estimation and validity test results

Estimations of the independent variables on CO2 emissions from the AMG and CCEMG estimations are depicted in Table 10. A percentage increase in ENR increases CO2 by 0.545%, 0.438%, and 0.186% in the main ECOWAS panel, energy exporters, and energy importers, respectively. A percentage increase in FDI heightens CO2 by 0.376%, 0.388%, and 0.452% in ECOWAS panel, energy exporters, and energy importers, whereas an increase in GDP rises the level of CO2 by 0.747%, 0.671%, and 0.477% and in energy importers, energy exporters, and ECOWAS panel, respectively. With regard to TRD, its one percentage increase is likewise associated with a 0.593%, 0.723%, and 0.463% increase in ECOWAS panel, energy exporters, and energy importers. Lastly, an increase in URB caused a rise of 0.662%, 0.442%, and 0.405% in the ECOWAS panel, energy exporters, and energy importers. The CCEMG was used as a robust check to the AMG. A closed look at the Common dynamic process (c.d.p) showed that they were all significant. Figure 2 depicts the elastic impacts of explanatory variables on CO2 in all three Panel groupings. The values of RMSE indicate the goodness of the response variables predicted by the model. Therefore, inferring from the RMSE value, we concluded that each model in the panel groups (ECOWAS panel, energy exporters, and energy exporters) are appropriate models in predicting the \({\mathrm{CO}}_{2}\) emissions. The elastic impacts (weights) of explanatory variables are illustrated pictorially in Fig. 2.

Table 10 AMG and CCEMG test results
Fig. 2
figure 2

The elastic impacts of explanatory variables on CO2 in all three Panel groupings

While the contribution weight (order of importance) varied across panel groupings, the employed variables ENR, FDI, GDP, TRD, and URB were found to have a statistically significant and positive impact on CO2 emissions across all panels. This means that the increase in each of the above variables rises the CO2 emissions in all three clusters and is thus considered to be a possible contributor to CO2 emissions. After the estimation of the parameters, the validity of the model is carefully checked. The White heteroskedasticity test and the Wooldridge serial correlation test were used to assess the efficacy of the model. The results shown in Table 11 do not show any definite heteroscedasticity and serial correlation between the model residuals.

Table 11 Diagnostics test results

3.5 Causality test results

The Dumitrescu and Hurlin (2012) were used to specify the direction of the causalities among the variables. The significance of the causality in the D–H test is determined by two types of test statistics: w-bar statistics (mean statistics for testing) and z-bar information (using standard normal distribution). The D–H causality test results are shown in Appendix Tables A, B, and C for the different income levels with Table 12 providing the summary of the test. For the ECOWAS panel, the results depicted in Table 12 revealed for CO2 emissions, a bidirectional causal affiliation amid (CO2 and URB), (CO2 and ENR), (CO2 and GDP), (CO2 and TRD), and (CO2 and FDI). With respect to energy exporters, a unidirectional causal affiliation was depicted from ENR to CO2, from FDI and CO2, from TRD to CO2, whereas a two-way causal affiliation was depicted among (CO2 and URB) and (CO2 and GDP). With respect to energy importers, a two-way causal association existed among (CO2 and ENR), (FDI and CO2), and (CO2 and URB), whereas a unidirectional causal effect from GDP to CO2, from TRD to CO2. Figure 3 illustrates the results obtained from the D–H granger causality.

Table 12 Summary results from D–H granger causality test
Fig. 3
figure 3

Causalities among variables across panel groupings

4 Discussion of results

A disparate panel of 14 ECOWAS countries was grouped into energy importers and exporters for the period 1990 to 2018 to investigate the relationship amid foreign direct investment, urbanization, and CO2 emissions. Given the empirical findings in the primary step of the cross-sectional dependence test, all panel groupings firmly confirmed the existence of cross-sectional independence. Thus, this suggests that a shock that occurs in any country within any of the panels employed appears to be transmitted or, in other words, may spill over to other countries within the same area due to strong economic relations between countries within each panel. The homogeneity test also showed all country groups give strong evidence of the rejection of the null hypothesis of homogeneity. Thus, revealing that country-specific heterogeneity occurs across the different country groupings within the individual coefficients. Consequently, from an econometric perspective, the second-generation econometric techniques were employed to ascertain accurate and consistent results as a result of the confirmed cross-sectional reliability and heterogeneity residual across all panel groups. This is in accordance with the study done by Ibrahim and Ajide (2021) who ensure that cross-sectional dependency and heterogeneity exist among the variables when exploring the linkage between non-renewable and renewable energy consumption, trade openness, and environmental quality in G-7 countries. However, this contradicts the study done by Zhang et al. (2019) who showed no evidence of cross-sectional dependency and heterogeneity between economic growth, CO2 emissions, and energy consumption in developing countries. Once more working with time-series panel models, the stationarity of the employed variables is vital. Thus, this study ensured that the stationarity of the employed variables was obtained. In accordance with Le and Bao (2020), who ensured no unit roots among variables so prevent the transmission of erroneous results in Latin America and the Caribbean Emerging market. The CADF and CIPS panel unit root test results showed that all employed variables were I (0), thus became I (1) after the first difference. Consequently, this gives the assurance that the variables used would be able to produce efficacious results. Regarding the long-run association, the Westerlund–Edgerton bootstrap co-integration employed revealed that there exists a long-run association among the employed variables. This result is inconsonant with Wu et al. (2020)’s work in assessing the nexus between CO2 emissions, energy consumption, urbanization, economic structure, and economic growth in Belt and Road economies. On the contrary, these results differ from the work of Ozturk and Acaravci (2010). They did not find a long-term relationship between economic growth and electricity consumption in the 15 emerging countries.

The results obtained for the long-run estimates from the AMG showed that FDI and URB in all panel groupings have a significant incremental effect on CO2 emissions. However, the incremental effect of URB in energy exporters is much higher than that of energy importers, whereas the incremental effects of FDI in energy importers are higher than that of energy- exporters. One of the explanations for the incremental effect of URB on CO2 emissions in energy-exporters countries is that, at the economic growth stage, these countries ignore other factors’ effects on environmental pollution but concentrate only on economic growth. Again, due to economic expansion, citizens turn to increase their income, so does the energy demand increased, which then worsening the quality of the environment. The positive effect of URB on CO2 in all panel groups harmonized with the studies done by Musa et al. (2021) in Nigeria, where they stated that URB has a significant positive impact on CO2 emissions. Their empirical findings suggested that URB has a positive effect on CO2 emissions. However, the study done by Nuţă et al. (2021) contradicts the positive effect of URB on CO2 emissions in EU countries. In their study, URB has a negative effect on CO2 emissions, thus indicating that URB increases CO2 emissions. The incremental effect of FDI inflows in energy importers can be associated with multinational company who flew extremely difficult environmental policies in developed countries to these countries where there are no or less environmental regulations. Thus, the results point that building of more foreign and local companies in this economic group has contributed to the creation of more jobs for the local residents which has led to the movement of individuals from the rural areas to the urban areas. The positive impact of FDI on CO2 emissions in all panel clusters is in accordance with the output obtained by Halliru et al. (2021) for the same ECOWAS community. Their empirical findings unveiled that FDI increases CO2 emissions within the ECOWAS community. Likewise, Awodumi (2021) also encountered a positive significant effect of FDI on CO2 emissions in his time-series analysis on ECOWAS countries. Again, GDP in all panel groups indicated a positive significant effect on CO2 emissions. This output is in line with the work done by Hdom and Fuinhas (2020). They posit that GDP has a positive significant effect on CO2 emissions when they investigated the relationship between energy production, economic growth, and CO2 emissions in Brazil. Lastly, it was evidenced that ENR also has a positive significant impact on CO2 emissions in all panel groups. This positive impact is in accordance with the study done by Wu et al. (2020), who obtained a positive impact of ENR in all panels in their study along the BRI economies.

Regarding the causal association among the variables, the two-way of the causality’s affiliation between CO2 and FDI in the ECOWAS community and energy importers. This depicts that more FDI and emissions of CO2 are interrelated, such that a fall or rise in FDI turns to decrease or increase CO2 and the other way around. Thus, this points to policymakers in these groupings to allow more investment that will turn to reduce the emissions of CO2. These results are similar to the work done by Abban et al. (2020) along the BRI countries where they obtained a bidirectional affiliation between CO2 and FDI. With regard to the nexus between CO2–URB, the two-way causal affiliation evidenced in all panel groupings indicates that the two variables are closely related such that a rise in one variable turns to increase the other. These results agree with work done in Anser et al. (2020) in SAARC countries. Their findings stated that a bidirectional affiliation exists between CO2–URB. Considering the CO2–GDP nexus, a two-way causality was evidenced in the main panel and energy exporters but a one-way causal effect was seen in energy importers. The two-way causality indicates that a decrease or increase in GDP turns to decrease or increase CO2 in the main panel and energy exporters. The two-causal affiliation obtained in the main panel and energy exporters is similar to the work done by Hongxing et al. (2021a) in 81 BRI countries, where they confirmed the presence of a bidirectional causation between CO2–GDP, whereas the unidirectional from GDP to CO2 in energy importers is in line with the study done by Ummalla and Goyari (2021) in BRICS countries. In their study, they posit that a one-way causal effect exists from GDP to CO2 emissions. Regarding the nexus between CO2–TRD, a one-way affiliation from TRD to CO2 was observed in both energies grouping but a bidirectional effect in the main panel. The results obtained in the main are in line with studies done by Chen et al. (2021) in top BRI countries, where they also observed a bidirectional causal effect between CO2–TRD, whereas the one-way affiliation observed in energy groups is consistent with work done by Rahman et al. (2020) in South Asia, where they also confirmed the way directional causal effect from TRD to CO2 emissions. Lastly, the two-way causation effects between CO2 and ENR in the ECOWAS community and energy importers showed that CO2 and ENR are interrelated. The interconnection points that an increment in ENR leads to a corresponding step-up in CO2 emissions. This effect is in line to the studies done by Onuoha et al. (2021) in West Africa community, respectively. Therefore, the ECOWAS community must consider the changeover of ENR (fossil fuel) to clean energy and in other to achieve zero emissions growth. Thus, increasing economic growth with the increased use of clean energy while leading to zero emissions of CO2 along ECOWAS.

5 Conclusion and policy recommendations

The study investigates the dynamic nexus between CO2 emissions, FDI, GDP, ENR, TRD, and URB in the ECOWAS community from 1990 to 2018. The study applied a number of analytical procedures including panel unit root tests, panel co-integration test, panel long-run elasticity, and panel D–H causality approach to ensure more reliable and reasonable results among the variables. A variety of conclusions was drawn accordingly. Estimates from the AMG affirmed that FDI accelerates CO2 emissions in all panel groups, likewise URB stimulates an increase in CO2 emissions in the ECOWAS panel and two-panel groups. A percentage rise in GDP corresponds to different significant weights in all panel groupings, whereas trade openness in all panel grouping indicated a significant weight on CO2 emissions. The white heteroscedasticity test and the Wooldridge serial correlation test employed to validate the model indicated that the model is statistically fit in predicting CO2 emissions. To grasp the causal relationship among the employed variables, it was discovered that a quick distinct relationship exists, as FDI has a unidirectional liaison to CO2 in energy exporters, whereas a bidirectional liaison between FDI and CO2 in ECOWAS and energy importers panels. URB exhibited a bilateral causal effect with CO2 in all panel groups. ENR exhibited a bilateral causal effect with CO2 in energy importers and ECOWAS panels.

In ripple effect out the finding obtained, the following implications were deduced for this study;

  1. 1.

    Because an increase in FDI correspondingly raises CO2 emissions through an increase in energy consumption, stringent environmental legislation needs to be extended to both international and local companies to curtail CO2 emissions. Since multimillionaire’s companies turn to flee from developing countries where stringent environmental policies have been established to reduce pollution. Again, the awareness of spillover from FDI companies to local businesses must be promoted.

  2. 2.

    In the long run, an increase in energy usage would also lead to high emissions of CO2 in the economy. Although energy resources are essential for higher economic growth, it as well contributes to environmental degradation. Therefore, the government should increase the share of renewable energy sources in the economy's overall energy mix to increase energy availability.

  3. 3.

    The bidirectional causality affiliation between energy consumption and CO2 emissions asserts that ensuring energy availability is necessary for achieving long-run economic growth. Since ECOWAS and that matter, Africa is already suffering from extreme energy/electricity shortages, the government of various energy groups in ECOWAS should concentrate on building resources to ensure that the economy has sufficient energy supplies. Thence, in the presence of bidirectional causality, energy shortages have clear consequences for economic growth in the economy.

  4. 4.

    Economic growth and the CO2 emissions in the long-run feedback in the ECOWAS panel. This suggests that higher economic growth could occur at the cost of a cleaner environment, which will undermine the quality of economic growth. Thus, to address this feedback, it is recommended that the abatement of CO2 emissions activities be included in ECOWAS’s central energy and environmental policy to abridge impairments related to CO2 emissions.