Introduction

Food instability and hunger are on the rise worldwide, with over 30% of the world’s population currently experiencing food insecurity (Sibanda and Mwamakamba 2021). The research by the State of Food Security and Nutrition in the World (2021) showed that 927.6 million people experienced food insecurity in various stages in 2020. Out of this, 346.6 million people are food insecure representing 37.3% in Africa (Xie et al. 2021). Although the coronavirus (COVID-19) pandemic has been the dominant source of food insecurity in the previous year, climate change, economic instability, and population expansion are still causing severe hunger in the majority of countries (FSIN and Global Network Against Food Crises 2020). According to Schilling et al. (2020), due to population growth, climate change, and economic instability, the prevalence of undernourishment has increased across Africa between 2017 and 2019. Food insecure nations are usually sensitive to climate change, and their ability to adapt is restricted (International Food Policy Research Institute 2020).

Climate change is having a substantial influence on food security and regional stability in West Africa, where over 115 million people experience severe food insecurity. Ghana’s food insecurity has been increased by climate change due to prolonged dry seasons, rising temperatures across all ecological zones, and low rainfall (Forum 2020). Ghana is attempting to cut emissions and increase climate resilience by 2030 under a business-as-usual scenario; however, efforts to implement Ghana’s Nationally Determined Contributions (NDCs) are inadequate (Zakaria et al. 2020b). As a result of the delay, high temperatures and a lack of irrigation infrastructure are lowering crop yields and raising food safety concerns. Modelling climate change’s implications on food security are crucial for reducing the agriculture sector’s vulnerability to climate change and mitigating its negative consequences (Atanga and Tankpa 2021). This study looked at the effects of carbon dioxide emissions, domestic credit, average precipitation, and fertilizer application on Ghana’s principal food (maize and soybean) production.

Agriculture, directly and indirectly, employs more than half of Ghana’s workforce and has a substantial impact on food security, economic growth, and the balance of payments (Fianko and Korankye 2020). Despite the achievements, Ghana’s heavy reliance on rain-fed agriculture and sensitivity to drought, as well as changing climatic conditions, constitute a serious threat to the agricultural sector’s growth, especially because only around 2% of the country’s agricultural land is irrigated (Antwi-Agyei and Nyantakyi-Frimpong 2021). Climate extremes are already affecting Ghana in a variety of ways, according to risk assessments, and the rise in temperature and decrease in precipitation will continue to have a direct impact on natural ecosystems and food production (Etwire 2020). Due to a loss in soil fertility, crop yields in Ghana’s sub-humid region, which is one of the country’s most important food-producing regions, are declining (Ampofo et al. 2020; Zubairu 2021). Understanding the threats of climate change to Ghana’s agriculture industry is crucial for building resilience. Similarly, an integrated analysis that uncovers the effects of climate change on a variety of crops is required to provide a full picture of the ramifications. This is because the country’s agriculture business is dominated by smallholder family farms that grow certain crops that are mostly rain-fed and consequently climate-sensitive.

The main staple crop in Ghana is maize (Zea mays L.), which is grown and consumed by the majority of farming households (Tachie-Obeng et al. 2013; Wongnaa et al. 2019). Maize is grown on about one million hectares, accounting for the majority of the national annual cereal production (Appiah-Twumasi et al. 2020). It is planted in all agro-ecological zones and is mostly produced by smallholder resource-poor farmers under rain-fed circumstances (Danquah et al. 2020; Cudjoe et al. 2021). The Eastern, Ashanti, Bono, and Ahafo regions of Ghana produce the majority of the country’s maize, accounting for more than 70% of total production (Sadiq et al. 2019). Maize production is the main staple for most Ghanaians, making it essential for the country’s food security (Tetteh Anang et al. 2020). Maize is as well used as a feed for poultry and livestock, as well as a brewing alternative (Scheiterle and Birner 2018). Despite the detrimental effects of climate change on crop yields, Ghana’s maize production has surged during the last 5 years as a result of the government’s Planting for Food and Jobs (PFJ) initiative (Ali et al. 2021).

Figure 1 depicts the area and maize production trends. Maize production and the area harvested have on average been on the rise since 1990; however, since 2016, maize production and the area harvested experienced a sharp increase as compared to the previous years. This is not surprising since, in 2016, Ghana’s government implemented the Planting for Food and Jobs policy. This policy is a program aimed at enhancing on-farm productivity by increasing fertilizer rebates and adopting hybrid seeds of specific crops, resulting in the development of jobs in agriculture and allied businesses. By promoting efficient and sustainable agriculture intensification and climate-proofing, the PFJ program, which is implemented by the Ministry of Food and Agriculture (MoFA), collaborates with other existing agricultural initiatives and policies to fulfill the global goal of eliminating hunger, achieving food security, and improving nutrition by 2030 (Dawuni et al. 2021; Ismaila and Tanko 2021). This might account for this sharp increase.

Fig. 1
figure 1

Trend of maize production and area harvested

Soybean (Glycine max L.) is another significant crop grown in both industrialized and developing countries (Siamabele 2021). In Ghana, soybean growing is a moderately new practice (Avea et al. 2016; Asodina et al. 2020). In the country, there is a rising market for soya beans, with domestic demand continuously outstripping supply (Asodina et al. 2021). Soya bean meal, a vital element in animal feed, is consumed heavily in Ghana’s agriculture and aquaculture sectors. Its economic relevance is gaining traction and acceptance among farmers in the country. Soya is mostly grown in Ghana’s northern regions and brought to the country’s southern regions for processing. Soybean grains are in high demand not just for household use, but also for manufacturing into cooking oil and animal feed, especially in the poultry industry, which consumes approximately 75% of all soya beans annually (Amoakoah Twum et al. 2021). Domestic demand for soybean grains exceeds 300,000 MTs per year, with 91% of that going to Ghana’s industrial sector. Meanwhile, domestic supply is at 144,926 MTs, with a shortfall of over 150,000 MTs, which is frequently supplemented by imports from Brazil and China. According to Asodina et al. (2021), and Anang et al. (2021), high temperatures, poor rainfall, and drought in most farming communities impede Ghana’s poor productivity of 1.8 mt/ha, compared to 4.26 mt/ha, 3.49 mt/ha, 3.47 mt/ha, and 3.39 mt/ha for Turkey, Italy, the USA, and Brazil, respectively (Leng and Hall 2019; Piccoli et al. 2021). Figure 2 depicts the area and soybean production trends. Soybean production and the area harvested have on average seen an increase over the study period; however, Ghana saw a sharp increase in soybean production in 2007 and in 2016. However, the increase in 2016 is larger than that in 2007. This can also be ascribed to the Planting for Food and Jobs policy.

Fig. 2
figure 2

Trend of soybean production and area harvested

Climate change has affected major crops such as maize and soybeans, according to previous studies (Basche et al. 2016; Dumortier et al. 2021). An investigation by Wang et al. (2020) looked at the effects of drought on maize and soybean output in China and found that drought frequency and intensity were negatively affecting the two crops. Hampf et al. (2020) studied the implications of climate change and technological advancement on double-cropping systems in Brazil. Lower precipitation and higher temperatures continue to reduce maize and soybean production, according to the study. However, innovations in genetics and crop management are expected to mitigate the negative effects of climate change by raising soybean yields by 40% and maize productivity by 68%, according to the study. Management measures that buffer against short-term water stress, according to Zipper et al. (2016), may be the most effective at supporting long-term agricultural yield. In contrast to Ghana, which is dependent on rain-fed agriculture and is subject to environmental shocks, all of these studies were undertaken in countries with the capacity to counteract bad climatic conditions. Crop management and other methods that can lessen the negative challenges of climate change on Ghana’s main food crops are required for the agricultural sector to produce food sustainably. As a result, a study on climatic variables and their impact on major crops such as maize and soybeans, which is currently lacking in Ghana’s setting, can enhance food production and contribute to SDG 2 of Zero Hunger.

Although warmer temperatures increase crop yields in some regions Montoya et al. (2021), Ghana’s agricultural industry is subject to climatic variation and change since it depends on rainfall (Yiran and Stringer 2016). As a result, the industry is known for its low productivity. Only 2% of Ghana’s irrigation capacity is used, and the majority of the country’s agriculture is still dependent on rain-fed cultivation (Abdul-Rahaman et al. 2021). Erratic precipitation patterns have serious effects on productivity (Arshad et al. 2018). Temperature rises are expected to reduce the production of major main crops (Boonwichai et al. 2018). Therefore, this research aims to examine the long- and short-term linkages between carbon dioxide emissions, domestic credit, precipitation, fertilizer application, and maize and soybean productivity.

This study makes the following contributions to the literature: First, this is a nationwide investigation that looks into the significant long- and short-term implications of carbon dioxide emissions, domestic credit, precipitation, and fertilizer application on maize and soybean. Despite several studies on climate change and food production, there is a paucity of studies on the two major crops indicated above. The study makes use of time-series data from the Food and Agriculture Organization and World Development Indicators (WDI 2021). Second, unlike previous studies, this study used the recently developed dynamic simulated autoregressive distributed lag (ARDL) technique of Jordan and Philips (2018). This study differs from previous research because this technique simulates, estimates, and automatically plots the predictions of one independent variable on the dependent variable without interfering with the outcomes of the other variables (Jordan and Philips 2018). Furthermore, this study estimated the causality relationship among the variables using the frequency domain causality of Breitung and Candelon (2006). The technique captures short-, medium-, and long-term causation links between the variables. Finally, this research offers an important policy for improving climate change mitigation and adaptation techniques, as well as improving crop yields and working towards food sustainability. The findings of this study are particularly important for policymakers, as they highlight how climate-smart agriculture can boost agricultural productivity (e.g., maize and soybean production), and how, in the face of climatic change, governments and policymakers should develop effective and efficient policies to combat climate change and boost agricultural productivity.

The study’s remaining components are a literature review, data and methods, results and discussion, and conclusion and policy implications. The influence of climate change on agricultural productivity, particularly maize and soybean yields, is explained in the “Literature review” section. It also goes over the econometric models that were used to explore the influence of climate change on agricultural productivity. In the “Materials and methods” section, the research describes the data (variable definitions) and methodology (theoretical and economic models) that were used. The effects of using the dynamic simulated ARDL approach based on a data technique are shown in the “Results and discussion” section. We give the study’s main findings as well as policy scenarios for limiting climate change in maize and soybean in the section “Conclusion and policy implications.”

Literature review

Climate change has a variety of impacts on crop yields. Gul et al. (2022) investigated how climate change affects main yield crops and found a long-term relationship between climatic and non-climatic factors and major food crop yields. While cereal yields are more sensitive to temperature in certain areas according to Senapati and Goyari (2020), climate variability is also lowering crop growth and yields (Kim et al. 2018; Ozdemir 2022). Rehman et al. (2022) studied CO2 emissions and climate effects on major agricultural crop output, such as wheat, maize, sugarcane, cotton, and others, and showed that crop yields and CO2 emissions had a positive relationship. According to Mason-D’Croz et al. (2019), climate change is predicted to have a considerable influence on the agricultural sector of the world’s poorer countries, especially in Sub-Saharan Africa (SSA), where the majority of countries are climate change exposed. The entirety of crop production in SSA is low-tech and thus very vulnerable to environmental influences (Mbuli et al. 2021). Changes in temperature, precipitation intensity, windstorms, and the distribution and extreme weather events’ severity are the key climatic drivers in SSA, according to previous research (Ariga et al. 2019; Salahuddin et al. 2020). Crop yields in Ghana are being limited by several obstacles, including a lack of domestic capital for the private sector and a scarcity of fertilizer.

Climate change’s impact on agricultural yields, such as maize, has been extensively studied. According to Maïga et al. (2021), who studied the effects of climate change on maize output in Mali, precipitation and temperature had an adverse and highly significant impact on maize productivity in both short- and long-term assessments. Ureta et al. (2020) investigated the link between maize output and many climate variables in rain-fed and irrigated crop areas, finding that temperature was the most important component in rain-fed settings, whereas precipitation was the most important element in irrigated crop areas. Climate change and main crop yields in Pakistan were explored by Abbas (2022), who discovered that rising temperatures have a significant negative influence on chosen crop yield in the long run but had no effect in the short run. The impact of climate and carbon dioxide emissions on maize crop output in Pakistan was researched by Rehman et al. (2020), who discovered that maize crop production had a positive coefficient, indicating a long-term relationship with carbon dioxide emissions. In the long and short runs, explanatory variables like the acreage under production and fertilizer application have significant positive effects. Climatic conditions have a consequence on maize production, according to the following studies (Pickson et al. 2020; Khan et al. 2021; Rehman et al. 2022).

Several studies on the effect of climate change on soybean output have also been carried out (Coleman et al. 2021; Gong et al. 2022). Durodola and Mourad (2020) discovered that yearly soybean yields are influenced by the meteorological conditions of the agricultural season while estimating the influences of climate change on soybean output in Nigeria. The studies of He et al. (2020), and Liu and Dai (2020) in China concluded that mean temperature is the most important climatic element impacting soybean output. According to simulation research conducted by Mall et al. (2004), higher temperatures can reduce soybean yields by 10 to 20%. Changes in climatic factors have a variety of effects on soybean climate potential productivity, according to a recent study (Gong et al. 2022). Weather changes have already affected global food production, according to the study. Also, climate change has a negative impact on agricultural productivity (Chandio et al. 2020, 2022; Satari Yuzbashkandi and Khalilian 2020; Rehman et al. 2021a). All of these findings point to the soybean as one of the most important grains and oil crops, and any change in soybean production under future climatic projections will have a national and worldwide impact on food and edible oil security.

Although Ghana is aware of climate change and the consequent environmental and food production concerns, there is insufficient financing to adopt the essential mitigation and adaptation measures (Jayne et al. 2018). Furthermore, as a holistic response to climate change, Ghana’s National Climate Change Policy establishes a clear path for dealing with the danger within the country’s socioeconomic framework, even though it looks to be deficient in terms of execution, much alone sustainability. As a result, it’s critical to research the effects of climate change on developing countries like Ghana, where agriculture is the primary source of income (Firdaus et al. 2020; Luh and Chang 2021). For example, in a study on climate change and global food production by Ray et al. (2019), agricultural yields are predicted to fall under future climate conditions. That is, extreme weather has already had an impact on the global food supply, and global estimates for the future are mostly unfavorable. According to Wollenberg et al. (2016), climate change will have severe consequences on crops; thus, the focus should shift to an action-oriented research agenda, with four primary challenges: modernizing research culture; designing stakeholder-driven portfolios of solutions for farmers, localities, and countries; ensuring that adaptability initiatives are useful to people most at risk from climate change; and merging climate resilient efforts.

The use of econometric models to investigate the impact of climate change on agricultural productivity is comparatively modern, with only a few studies on this subject. Chandio et al. (2021) studied the long- and short-run effects of climatic and non-climatic factors on wheat and rice output in Turkey using the ARDL technique and the Johansen and Juselius cointegration (JJC) model. Both climatic and non-climatic variables have a considerable impact on crop output, according to the research. To establish the link between carbon dioxide emissions (CO2 emissions) and food production, Rehman et al. (2021a, b) used the STIRPAT (stochastic impact by regression on population, affluence, and technology) model with the expansion of an ARDL approach. During long- and short-run interactions, food production had a negative impact on CO2 emissions, according to the study. Asumadu-Sarkodie and Owusu (2016) employed the vector error correction model (VECM) and the ARDL model to investigate the association between CO2 emissions and agriculture in Ghana. The models revealed that CO2 emissions and agriculture have a long-term equilibrium. An asymmetric technique was used to analyze the influence of CO2 emissions on agricultural fruit production (Hussain et al. 2022). The results of short- and long-run estimations showed that both positive and negative shocks to fruit output increase CO2 emissions significantly.

Using panel data methodologies, Etwire et al. (2019), Owusu and Asumadu-Sarkodie (2017), and Antwi-Agyei and Stringer (2021) confirmed the consequence of climate change on agricultural production. These studies suggest that climate change and agricultural productivity have a long- and short-run equilibrium relationship.

From the literature review, it is obvious that most of the studies focused on aggregate agriculture production with few or limited studies on maize and soybean production. Also, the existing studies omitted factors such as domestic lending to the private sector, fertilizer usage, and precipitation. Finally, most of the studies used the ordinary causality analysis which fails to capture the short-, medium-, and long-term impact of climate change on agriculture production. As a result, the goal of this study is to fill in the gaps in the literature.

Materials and methods

Data

The data for this study came from Ghana’s annual time-series data, which spanned 31 years from 1990 to 2020. Data on maize production and soybean production come from the Food and Agriculture Organization (FAO), while CO2 emissions, precipitation, domestic credit, and fertilizer consumption come from the World Development Indicators (WDI). To achieve efficient results and to portray the results as elasticities, all of the variables used in the study are converted to a logarithm form. The data variables, code, definition, sources, and summary of descriptive statistics are all shown in Table 1.

Table 1 The study variables in detail

Table 2 presents the descriptive analysis for the variables under investigation. The averages of maize production, soybeans production, carbon dioxide emissions, domestic credit, fertilizer consumption, and precipitation are 14.100%, 10.840%, 8.943%, 2.351%, 2.244%, and 7.056%, respectively. The standard deviations of the variables are below the mean suggesting that the variables are not volatile.

Table 2 Descriptive statistics

Table 3 shows the correlation matrix for maize production. The outcomes demonstrate that there exists a sturdy positive linear correlation between carbon dioxide emissions, domestic credit, fertilizer consumption, precipitation, and maize production. There also exists a strong positive direct correlation between domestic credit, fertilizer application, and carbon dioxide emissions. Fertilizer application has a robust positive linear correlation with domestic credit. The variance inflation factor of carbon dioxide emissions, domestic credit, fertilizer consumption, and precipitation is below 10 suggesting that the study does not suffer from multicollinearity problems.

Table 3 Correlation matrix for maize production

Table 4 also displays the correlation matrix for soybean production. It was found that there exists a strong positive linear correlation between carbon dioxide emissions, domestic credit, fertilizer consumption, and soybean production while there exists a weak positive linear correlation between precipitation and soybean production.

Table 4 Correlation matrix for soybean production

Figure 3 indicates the trend of maize production, soybean production, and carbon dioxide emissions over the study period. It can be seen that the variables are positively related over the study period. Thus, an increase in carbon dioxide emissions might increase maize and soya production.

Fig. 3
figure 3

Trend of maize production, soybean production, and carbon dioxide emissions

Model

ARDL bounds test

This research used the ARDL bounds testing model (Pesaran et al. 2001; Pesaran and Shin 1995) to look at the cointegration link among the variables.

The ARDL bounds testing models are specified in Eq. 1 and Eq. 2:

$$\begin{array}{*{20}c} {\Delta \ln maize_{t} = \alpha_{o} + \sum\limits_{i = 1}^{n} {\alpha_{1i} \Delta \ln maize_{t - i} + \sum\limits_{i = 0}^{n} {\alpha_{2i} \Delta \ln co2_{t - i} + } } \sum\limits_{i = 0}^{n} {\alpha_{3i} \Delta \ln dc_{t - i} + \sum\limits_{i = 0}^{n} {\alpha_{4i} \Delta \ln fert_{t - i} } } } \\ { + \sum\limits_{i = 0}^{n} {\alpha_{5i} \Delta \ln prec_{t - i} } + b_{0} \ln maize_{t - 1} + b_{1} \ln co2_{t - 1} + b_{2} \ln dc_{t - 1} + b_{3} \ln fert_{t - 1} + b_{5} \ln prec_{t - 1} + \varepsilon_{t} } \\ \end{array}$$
(1)
$$\begin{array}{*{20}c} {\Delta \ln soya_{t} = \alpha_{o} + \sum\limits_{i = 1}^{n} {\alpha_{1i} \Delta \ln soya_{t - i} + \sum\limits_{i = 0}^{n} {\alpha_{2i} \Delta \ln co2_{t - i} + } } \sum\limits_{i = 0}^{n} {\alpha_{3i} \Delta \ln dc_{t - i} + \sum\limits_{i = 0}^{n} {\alpha_{4i} \Delta \ln fert_{t - i} } } } \\ { + \sum\limits_{i = 0}^{n} {\alpha_{5i} \Delta \ln prec_{t - i} } + b_{0} \ln soya_{t - 1} + b_{1} \ln co2_{t - 1} + b_{2} \ln dc_{t - 1} + b_{3} \ln fert_{t - 1} + b_{5} \ln prec_{t - 1} + \varepsilon_{t} } \\ \end{array}$$
(2)

where \(\Delta\) is the first difference. lnmaize, lnsoya, lnco2, lndc, lnfert, and lnprec denote maize production, soybeans production, carbon dioxide emissions, domestic credit, fertilizer application, and precipitation. The error term is denoted by \(\varepsilon_{t}\). The bounds testing procedure relies on the Wald test (F-statistics). The null hypothesis of no cointegration and the alternative hypothesis of cointegration are shown below:

$$H_{o} :\,\;b_{0} = b_{1} = b_{2} = b_{3} = b_{4} = b_{5} = 0$$
$$H_{1} :\,\;b_{0} \ne b_{1} \ne b_{2} \ne b_{3} \ne b_{4} \ne b_{5} \ne 0$$

If the F-statistics value is above I(1), we infer that the variables have long-run cointegration. Also, if the F-statistics value is below I(0), then there is no cointegration between the variables. Finally, if the F-statistics value falls between I(0) and I(1), then the findings are questionable.

The ARDL error correction models underpinning this study are specified in Eqs. 3 and 4:

$$\begin{array}{*{20}c} {\Delta \ln maize_{t} = \alpha_{o} + \sum\limits_{i = 1}^{n} {\alpha_{1i} \Delta \ln maize_{t - i} + \sum\limits_{i = 0}^{n} {\alpha_{2i} \Delta \ln co2_{t - i} + } } \sum\limits_{i = 0}^{n} {\alpha_{3i} \Delta \ln dc_{t - i} + \sum\limits_{i = 0}^{n} {\alpha_{4i} \Delta \ln fert_{t - i} } } } \\ { + \sum\limits_{i = 0}^{n} {\alpha_{5i} \Delta \ln prec_{t - i} } + \lambda ect_{t - 1} + \mu_{t} } \\ \end{array}$$
(3)
$$\begin{array}{*{20}c} {\Delta \ln soya_{t} = \alpha_{o} + \sum\limits_{i = 1}^{n} {\alpha_{1i} \Delta \ln soya_{t - i} + \sum\limits_{i = 0}^{n} {\alpha_{2i} \Delta \ln co2_{t - i} + } } \sum\limits_{i = 0}^{n} {\alpha_{3i} \Delta \ln dc_{t - i} + \sum\limits_{i = 0}^{n} {\alpha_{4i} \Delta \ln fert_{t - i} } } } \\ { + \sum\limits_{i = 0}^{n} {\alpha_{5i} \Delta \ln prec_{t - i} } + \lambda ect_{t - 1} + \mu_{t} } \\ \end{array}$$
(4)

where λ denotes the speed of adjustment and \(ect\) is the error-correction term which ranges from − 1 to 0. The lag form of the variables was derived using the Schwarz information criterion (SC) (Pesaran et al. 2001; Pesaran and Shin 1995). The SC selected 1 as the optimal lag length of the variables (see Appendix Table 10 and Table 11); accordingly this study used lag 1 for all the variables.

Dynamic simulated ARDL

The ARDL model is mostly associated with the problem of complex lag structure with lags, first differences, lagged first differences of the independent variables and sometimes the dependent variable, and contemporaneous values appearing in the specification of the model (Jordan and Philips 2018). This impedes the comprehension of the short-, medium-, and long-term effects (Jordan and Philips 2018). Accordingly, Jordan and Philips (2018) introduced the dynamic simulated ARDL technique to cure these challenges. This technique simulates, estimates, and automatically plots the predictions of one independent variable on the dependent variable without interfering with the outcomes of the other variables (Jordan and Philips 2018). The dynamic simulated ARDL models are presented in Eq. 5 and Eq. 6.

$$\begin{array}{*{20}c} \begin{gathered} \Delta \ln maize_{t} = \alpha_{o} + \sigma_{0} \ln maize_{t - 1} + \phi_{1} \Delta \ln co2_{t} + \sigma_{1} \ln co2_{t - 1} + \phi_{2} \Delta \ln dc_{t} + \sigma_{2} \ln dc_{t - 1} + \phi_{3} \Delta \ln fert_{t} + \hfill \\ \sigma_{3} \ln fert_{t - 1} + \phi_{4} \Delta \ln prec_{t} + \sigma_{4} \ln prec_{t - 1} + \mu_{t} \hfill \\ \end{gathered} \\ {} \\ \end{array}$$
(5)
$$\begin{array}{*{20}c} \begin{gathered} \Delta \ln soya_{t} = \alpha_{o} + \sigma_{0} \ln soya_{t - 1} + \phi_{1} \Delta \ln co2_{t} + \sigma_{1} \ln co2_{t - 1} + \phi_{2} \Delta \ln dc_{t} + \sigma_{2} \ln dc_{t - 1} + \phi_{3} \Delta \ln fert_{t} + \hfill \\ \sigma_{3} \ln fert_{t - 1} + \phi_{4} \Delta \ln prec_{t} + \sigma_{4} \ln prec_{t - 1} + \mu_{t} \hfill \\ \end{gathered} \\ {} \\ \end{array}$$
(6)

where \(\phi\) denotes long-run coefficients while \(\sigma\) is the short-run coefficients.

Frequency domain causality

This study further used the frequency domain causality of Breitung and Candelon (2006) to gauge the causality relationship among the variables. The frequency domain causality has the advantage of capturing the short-, medium-, and long-term causality relationships between the variables which the ordinary Granger causality test of Dumitrescu and Hurlin (2012) fails to account for.

Results and discussion

Unit root analysis

This study used the augmented Dickey-Fuller (ADF) (Dickey and Fuller (1979)) and the Phillips and Perron (1988) unit root tests to look at the stationarity properties of the variables. Table 5 displays the unit root results. The outcomes show that maize production, fertilizer application, and precipitation are stationary at both levels and the first difference of the ADF and the PP tests. Also, soybean production is stationary at the first difference of the ADF test, and the level and first difference of the PP test, respectively. Furthermore, carbon emission is stationary at the level and first difference of the ADF test. The PP test also confirmed that carbon emission is stationary at the first difference. Finally, domestic credit is stationary at both the first difference of the ADF and PP tests.

Table 5 Unit root test of variables

Bounds test results

Table 6 demonstrates the bounds test results. The findings show that the F-statistics value of model 1 is above I(1) at the 2.5%, 5%, and 10% significance levels, respectively, while it is lower than the I(1) at the 1% significance level. We reject the null hypothesis of no cointegration using the 5% significance level, indicating that maize production, carbon dioxide emissions, domestic credit, fertilizer usage, and precipitation are all long-run cointegrated. Also, the value of the F-statistics value of model 2 is above the I(1) at all the significance levels. Thus, we argue that soybean production, carbon dioxide emissions, domestic credit, fertilizer usage, and precipitation are all long-run cointegrated.

Table 6 Bounds test results

Dynamic simulated ARDL results

The dynamic simulated ARDL findings are shown in Table 7. The findings reveal that past maize and soybean production values have a statistically detrimental effect on current maize and soybean production values. As a result, poor maize and soybean production the previous year will lead to increased maize and soybean production this year, and vice versa.

Table 7 Dynamic simulated ARDL results

Using maize production as an example, the findings show that carbon dioxide emissions have a statistically significant positive effect on maize yield in both the short run and long run. In both the short run and long run, a 1% increase in carbon dioxide emissions increases maize production by 0.599% and 0.611%. The findings here are similar to those of Kucharik and Serbin (2008), and Jiang et al. (2020) that a warmer climate can help support higher corn and soybean yields. These findings are also consistent with those of Rehman et al. (2020), Rehman et al. (2021a), Warsame et al. (2021), and Zhang et al. (2021), all of whom found that carbon dioxide emissions have a considerable positive impact on maize output. Carbon dioxide emissions, on the other hand, have a detrimental influence on maize output (Chen et al. 2020; Feng et al. 2020; Liu et al. 2022). Because irrigation is a potential remedy for ensuring a consistent water supply and mitigating heat stress, it is critical to expand the use of groundwater irrigation in measuring the carbon dioxide emissions of agricultural production and underpinning the prospects for their reduction to sustainably develop farming strategies that increase yield with a minimal environmental cost. Furthermore, no-tillage intercropping with plastic film mulching and straw covering is the most practical and efficient cropping production method that needs to be researched, as intercropping has been found to increase crop yield and make better use of land.

Lending domestically has a statistically significant adverse effect on maize output in both the short and long runs. In the short and long runs, a 1% increase in domestic credit reduces maize output by 0.287% and 0.479%, respectively. These findings are in agreement with those of Brandt et al. (2018), Diallo et al. (2020), Aye and Mungatana (2011), and Bai et al. (2015), who found that domestic credit reduces maize yields due to high lending rates and funding unavailability. However, the research contradicts the findings of prior studies (Awunyo-Vitor 2017; Belete 2020; Melkani et al. 2021). They concluded that domestic finance facilitates the timely purchase and effective distribution of agricultural inputs, resulting in the highest possible production. Domestic lending to maize farmers should enhance productivity; but, due to high lending rates, most farmers are unable to reap these gains. Farmers who have access to little or moderate agricultural credit, according to Siaw et al. (2021), have an 8% higher probability of boosting technical efficiency, which influences maize output, than those who do not have access to credit. Farmers should create cooperatives to form better partnerships with financial institutions to boost production, and governmental initiatives aimed at expanding smallholder farmers’ access to domestic financing should be pushed aggressively. Above all, interested parties should make it easier to get better seedlings and fertilizer, financing, farm technology, and short-term training.

Fertilizer application has a minor adverse impact on maize output in the short term, but a considerable negative impact on maize production in the long term. A 1% increase in fertilizer application reduces maize output by 0.030% in the short run and 0.085% in the long run, respectively. This research backs up the findings of Pelletier et al. (2020) and Epper et al. (2020), who claim that fertilizer use is only weakly linked to deforestation and food insecurity. However, according to Diamoutene and Jatoe (2020), Sajadinia et al. (2021), and Jena et al. (2021), fertilizer use has a positive effect on maize yield. To improve fertilizer use for sustainable food production, we propose that, based on our findings, focused outreach of extension services be explored to promote fertilizer use and yields in less-productive regions, as well as regulations that integrate provisions for weather shocks. Furthermore, precipitation has a statistically significant positive impact on maize yields in both the short run and long run. A 1% increase in precipitation boosts maize production by 1.297% in the short term and 0.885% in the long run. These observations back up these conclusions (WU et al. 2021; Arunrat et al. 2022). Nonetheless, Rowhani et al. (2011) found that a 20% increase in intra-seasonal precipitation irregularity affects maize, sorghum, and rice yields by 4.2, 7.2, and 7.6%, respectively. To increase farmer knowledge and future yields in Ghana, it is necessary to invest in improving climatic data. The ordinary least squares (OLS) results in Appendix Table 12 support the long-run results of carbon dioxide emissions, domestic credit, fertilizer application, and precipitation on maize production.

In terms of soybean production, the data show that carbon dioxide emissions and lending domestically have insignificant stimulus on yield in both the short and long ranges; however, fertilizer application and precipitation have a statistically favorable impact on yield in the short run. According to the research, a 1% rise in carbon dioxide emissions enhances soybean output by 0.035% in the short term and 0.028% in the long term. This finding lends credence to the study of Dumortier et al. (2020) and Branco et al. (2021). A 1% increase in domestic credit boosts soybean production by 0.048% in the short run, while in the long run, it decreases soybean production by 0.241%. This is consistent with Ali and Awade (2019) study, which found a link between credit and soybean production. Again, the study found that increasing fertilizer application by 1% enhances soybean yield by 0.115% and 0.022% in the short run and long run, respectively. This study supports the findings of Roobroeck et al. (2021) and Yan et al. (2020), who found that fertilizer use boosts soybean output. Furthermore, a 1% increase in precipitation boosts soybean yields by 0.969% in the short term and 0.351% in the long run, according to the study. This research backs up previous findings (Arrieta et al. 2018; Kukal and Irmak 2018). The OLS results in Appendix Table 13 also support the long-run results of carbon dioxide emissions, domestic credit, fertilizer application, and precipitation on soybean production.

The coefficients of the error-correction term for both maize and soybean production were negative and statistically significant implying that there is a long-term link between the variables. The R-squared coefficient also suggested that the explanatory variables explained almost 70% of the variation in the dependent variables. The F-statistics’ probability value further revealed that dynamically simulated ARDL models are well described.

Impulse response analysis

This section presents the impulse response analysis of carbon dioxide emissions, domestic credit, fertilizer application, and precipitation on maize production.Footnote 1 The average projection value is indicated by the black dots in the middle, while the blue dark line represents the 75%, 90%, and 95% confidence intervals. Figure 4 shows the response of maize production to (\(\pm 10\%\)) change in carbon dioxide emissions. The outcomes show that both 10% positive and negative shocks in carbon dioxide emissions have a positive influence on maize output in both the short and long runs. Figure 5 shows (\(\pm 10\%\)) actual change in domestic credit on maize production. The results also showed that both 10% positive and negative shocks in domestic credit have a positive impact on maize yields in the short and long runs. Figure 6 shows (\(\pm 10\%\)) actual change in fertilizer application on maize production. The results showed that both 10% positive and negative shocks in fertilizer application increase maize output in the short and long runs. Figure 7 shows (\(\pm 10\%\)) actual change in precipitation on maize yields. The findings revealed that a 10% increase in precipitation enhances maize output in both the short and long runs, while a 10% decrease in precipitation boosts maize output in the short run but decreases it in the long run.

Fig. 4
figure 4

Maize production and carbon dioxide emissions

Fig. 5
figure 5

Maize production and domestic credit

Fig. 6
figure 6

Maize production and fertilizer application

Fig. 7
figure 7

Maize production and precipitation

Diagnostic testing

Table 8 shows the diagnostics tests of the dynamic simulated ARDL models. Serial correlation, heteroscedasticity, model specification, and normality were tested using the Breusch-Godfrey LM test, Breusch-Pagan-Godfrey test, Ramsey RESET test, and the Jarque–Bera test. Since the chi-squared p-values of the various test statistics are above the 5% significance level, we suggest that the study is free of serial correlation, heteroscedasticity, and misspecification and that the residuals for maize and soybean production are normally distributed.

Table 8 Diagnostic tests

The models’ stability was also tested using the cumulative sum of recursive residuals (CUSUM) and cumulative sum of squares of recursive residuals (CUSUM of squares) tests. The results in Fig. 8 and Fig. 9 show that the models are stable since both CUSUM and CUSUM of squares for maize and soybean production are within the 5% threshold.

Fig. 8
figure 8

CUSUM and CUSUM of square test for maize production

Fig. 9
figure 9

CUSUM and CUSUM of square test for soybean production

Frequency domain causality

Table 9 displays the frequency domain causality results. The results indicate that carbon dioxide emissions cause maize and soybean production only in the long run while domestic credit, fertilizer application, and precipitation do not cause maize and soybean production.

Table 9 Frequency domain causality results

Conclusion and policy implications

Farmers and the wider communities who rely on farmers for food face a plethora of issues due to climate change. According to research, food supply and security will be seriously harmed if little or no action is taken to combat climate change and the food system’s susceptibility to climatic changes. As a result, this study examined the effects of CO2 emissions, domestic credit, average precipitation, and fertilizer use on Ghana’s principal food (maize and soybean) production using annual data for the period 1990 to 2020. The stationarity of the variables was confirmed using the ADF and P-P unit root tests. The findings indicated that climate change enhances maize and soybean yields in Ghana in both the short and long runs. The findings also showed that precipitation has a positive influence on maize and soybean production. The results further revealed that domestic credit negatively and positively affects maize and soybean production respectively in the long term, while fertilizer consumption negatively affects both maize and soybean production in the long term. The findings of the diagnostic testing of the dynamic simulated ARDL models showed that the study is devoid of serial correlation, heteroscedasticity, and misspecification and that the error terms follow a normal distribution for maize and soybean production. The models were stable, according to the CUSUM and CUSUM of squares tests, because they both fell under the 5% limit for maize and soybean production.

Although the findings of this study showed that CO2 emissions enhance maize and soybean production, it is still important for policymakers to promote climate-resistant maize and soybean varieties in Ghana. Domestic credit has an important role in increasing maize and soybean production; consequently, this research advises that financial institutions should provide low-interest financing to agricultural communities with easy installments so that farmers may reap the benefits of climate change adaptation. This study discovered that fertilizer application has an impact on maize and soybean production; as a result, fertilizer use should be increased; nevertheless, the type of soil is also a major factor in deciding the kind and timing of fertilizer application. Crop and water management strategies, as well as information availability, should be considered in food production to improve resistance to climate change and adverse climatic circumstances.

This study has the following limitations that can be extended by future studies: First, this research focused on maize and soybean output; thus, the results cannot be applied to other major food crops. As a result, more studies may be done in Ghana and other African countries to assess the influence of climate change on other agricultural goods, allowing for more effective policy decisions to be made. Also, this study used the dynamically simulated ARDL technique for the empirical analysis; thus, other techniques such as the quantile regression and the non-linear ARDL technique can be applied. Finally, this study used only CO2 emissions to proxy climate change; thus, future studies should use other greenhouse gas measures such as nitrous oxide and methane emissions.