Thông tin tài nguyên

Assessing the impact of climate variability on maize yields in the different regions of Ghana—A machine learning perspective

pmc-PMC11198792.pdf · Phiên bản 1 · 24 trang

18
Bản gốc
Trang 1 · Đoạn 1Vị trí nguồn

RESEARCH ARTICLE Assessing the impact of climate variability on maize yields in the different regions of Ghana —A machine learning perspective Samuel Asante GyamerahID1*, Clement Asare1, Henry Ofoe Agbi-Kaeser1, Frank Baffour- Ata2 1 Department of Statistics and Actuarial Science, Kwame Nkrumah University of Science and Technology, Kumasi, Ghana, 2 Department of Environmental Science, Kwame Nkrumah University of Science and Technology, Kumasi, Ghana * saasgyam@gmail.com, asante.gyamerah@knust.edu.gh Abstract Climate variability has become one of the most pressing issues of our time, affecting various aspects of the environment, including the agriculture sector. This study examines the impact of climate variability on Ghana’s maize yield for all agro-ecological zones and administrative regions in Ghana using annual data from 1992 to 2019. The study also employs the stacking ensemble learning model (SELM) in predicting the maize yield in the different regions taking random forest (RF), support vector machine (SVM), gradient boosting (GB), decision tree (DT), and linear regression (LR) as base models. The findings of the study reveal that maize production in the regions of Ghana is inconsistent, with some regions having high variability. All the climate variables considered have positive impact on maize yield, with a lesser vari- ability of temperature in the Guinea savanna zones and a higher temperature variability in the Volta Region. Carbon dioxide (CO2) also plays a significant role in predicting maize yield

Trang 1 · Đoạn 2Vị trí nguồn

across all regions of Ghana. Among the machine learning models utilized, the stacking ensemble model consistently performed better in many regions such as in the Western, Upper East, Upper West, and Greater Accra regions. These findings are important in under- standing the impact of climate variability on the yield of maize in Ghana, highlighting regional disparities in maize yield in the country, and highlighting the need for advanced techniques for forecasting, which are important for further investigation and interventions for agricultural planning and decision-making on food security in Ghana. Introduction Background of the study The variability of the climate has emerged as a critical concern in our era, impacting different facets of our surroundings, such as the agricultural industry. According to Porter et al. [1], cli- mate variability has a greater impact on agricultural production as compared to other factors due to their interaction. The extent of these effects is determined by different climate variables PLOS ONE PLOS ONE | https://doi.org/10.1371/journal.pone.0305762 June 25, 2024 1 / 24 a1111111111 a1111111111 a1111111111 a1111111111 a1111111111 OPEN ACCESS Citation: Gyamerah SA, Asare C, Agbi-Kaeser HO, Baffour-Ata F (2024) Assessing the impact of climate variability on maize yields in the different regions of Ghana—A machine learning perspective. PLoS ONE 19(6): e0305762. https:// doi.org/10.1371/journal.pone.0305762 Editor: Zakari Ali, MRC Unit The Gambia at LSHTM, GAMBIA Received: June 14, 2023 Accepted: June 4, 2024 Published: June 25, 2024

Trang 1 · Đoạn 3Vị trí nguồn

Copyright: © 2024 Gyamerah et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited. Data Availability Statement: We confirm that the data used was obtained from a third-party organization (Ghana Meteorological Agency and the Statistics, Research, and Information Directorate (SRID) of Ghana’s Ministry of Food and Agriculture) and hence data is only available upon request. The data underlying the results presented in the study are available from Ministry of Food and Agriculture info@meteo.gov.gh, Ghana and Ghana Meteorological Agency, info@mofa.gov.gh. We confirm that the data used was purchased from a third-party organization (Ghana Meteorological

Trang 2 · Đoạn 4Vị trí nguồn

such as temperature, precipitation, sunshine, humidity, carbon dioxide (CO2), water vapor, rainfall, and greenhouse gases. Although crop yield can be impacted by climatic variables including rainfall, solar radiation, and wind speed [2, 3], precipitation, temperature, and car- bon dioxide (CO2) are seen as the most influential climatic variables on crop yield [4, 5]. Crop production is hampered by low temperatures [6] and crop yields are significantly affected by high temperatures [7]. Similarly, high precipitation, which leads to flooding, damages crops [8], and low precipitation, which leads to drought, damages crop as well [9]. Therefore, any variations on these climate variables may also have a major impact on the agricultural sector [10]. Agriculture is significant to Ghana’s economy and livelihoods, hence understanding the influence of climate variability on agricultural production is critical. Maize production is one of the most significant agricultural products, ranking third place behind rice and wheat in terms of production of cereal crops in the world [11]. In Ghana, maize is a staple crop and con- tributes to most of the agricultural production and consumption in the country. According to research, Ghana produced more than 2.9 million metric tons of maize in 2019, the most since 2010, and 3 million metric tons of maize in 2020, continuing a rising trend that has been evi- dent since 2016 [10]. Maize is grown in all the country’s agro-ecological zones, and it is fre- quently grown by smallholder farmers in rain-fed conditions [12]. As a result, any aggravation

Trang 2 · Đoạn 5Vị trí nguồn

of climate-related factors, such as drought, altered precipitation patterns, and heat stress, is accountable for some of the major issues with maize production in Ghana. The results, how- ever, vary by zone. Ghana has six main agro-ecological zones, which are the Guinea savannah zone, Sudan savannah zone, transitional zone, deciduous forest zone, coastal savannah zone, Rain Forest zone [12]. These agro-ecological zones can be grouped into four subgroups [13] based on maize yield in Ghana (i.e., Transitional Zone, Rain Forest Zone, Guinea Savannah Zone, and Coastal Savanna Zone). Temperature and sunshine are likely to have major impact on maize yield in the Guinea savanna zone since they are the hottest zones in the country [14], and precipitation is also likely to have a major impact in the rain forest zone and the coastal savanna zone [10, 15]. Moreover, average temperature is likely to have a major impact in the transitional zone [10]. The impact of climate change on cereal harvests, such as wheat, rice, and maize, has been extensively studied in Asia [16–20] and North America [21–23]. However, there are limited studies in sub-Saharan Africa, especially considering their regional differences, which is of great concern given the region’s high dependence on agriculture for food security and eco- nomic development. Given the dependency of maize yield on rainfall in many parts of the African continent, Gachene et al. [24] emphasized the vulnerability of cereal yields in the sub- Saharan regions. They reviewed numerous elements, such as extreme weather events,

Trang 2 · Đoạn 6Vị trí nguồn

increased CO2, weed competition, and insect pests, that may lead to a probable decline in crop production. According to their findings, crop yields in Sub-Saharan Africa (SSA) are projected to decline by more than 10% by 2055. This decline was attributed primarily to the increased occurrence of extreme weather events and the interaction of elevated CO2 levels with tempera- ture and rainfall. According to the findings from studies in [4, 7, 25], even though temperature is a significant factor influencing maize production, rainfall and water availability are more restrictive elements. Nevertheless, rising temperatures can make some regions crop yield more vulnerable [7]. An interesting study is the one by Acquah and Kyei [26], who discovered in their paper that, an increase in temperature in Ghana is probably going to make maize output variability worse, whereas an increase in rainfall is probably going to address the problem. A study by Adjei and Kyerematen [27] also found that over the previous five years, rainfall in Ghana’s transitional zone (Nkoranza South Municipality) had significantly decreased, which had a detrimental effect on maize agricultural operations. Even though the study by Atiah et al. PLOS ONE Impact of climate variability on maize yields in Ghana PLOS ONE | https://doi.org/10.1371/journal.pone.0305762 June 25, 2024 2 / 24 Agency and the Statistics, Research, and Information Directorate (SRID) of Ghana’s Ministry of Food and Agriculture) which makes the data confidential. The data can be accessed from these institutions the same manner as the authors

Trang 2 · Đoạn 7Vị trí nguồn

accessed them and that the authors do not have any special privileges in obtaining the data used for these studies. Funding: The first author is grateful for the support from the Kwame Nkrumah University of Science and Technology Research Fund award number KReF 2022/23. The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript. Competing interests: The authors have declared that no competing interests exist. Abbreviations: CO2, Carbon dioxide; ˚C, Degree Celsius; DT, Decision Tree; GB, Gradient Boosting; KNN, K-Nearest Neighbor; LR, Linear Regression; MAE, Mean Absolute Error; MLP, Multi-Layer Perceptron; mm, millimeters; MSE, Mean Squared Error; mt/ha, Metric tons per hectare; rbf, Radial Basis function; RF, Random Forest; SELM, Stacking Ensemble Learning Model; SSA, Sub- Saharan Africa; SVM, Support Vector Machine; XGB, XGBoost.

Trang 3 · Đoạn 8Vị trí nguồn

[25] highlighted that climate factors, such as rainfall, only contribute to a minor portion (about 4.2% of the fluctuations in annual maize output in Ghana). Their findings do indicate that climate factors account for 40.8% of maize yield under drier-than-normal rainfall condi- tions, indicating that rainfall does have a significant impact on crop productivity in Ghana. The effect of specific climate factors (temperature and rainfall) on maize production in the Ejura-Sekyedumase Municipality, Ghana, was examined by Cudjoe et al. [12] utilizing trend analysis, regression analysis, and chi-square analysis. The research’s conclusions show that there is clear climate variability in the study area and that it significantly affects crop produc- tivity. Another study by Baffour-Ata et al. [28] investigated how climate factors, such as yearly rainfall, its onset and cessation, the number of dry days, and temperature, affect the growth of a few different crops, including millet, sorghum, rice, groundnuts, and maize in northern Ghana. They discovered that number of dry days, temperature, onset, yearly precipitation, and cessation explained about 25% of the variation in maize production using the Mann-Kendall trend test and multiple regression analysis. Evidently, there is a lack of research addressing the impact of climate variables on maize yield across all agro-ecological zones and administrative regions in Ghana. Consequently, it is essential to fill this gap, and this study aims to do so.

Trang 3 · Đoạn 9Vị trí nguồn

Given the necessity of assessing the impact of climate variability on crop yield, various tech- niques have been developed that enable the analysis of complex interactions between climate variables and crop yield. These techniques involve the use of statistical models, machine learn- ing algorithms, and remote sensing data, among others. Lobell and Burke [29] predicted the possible impacts of climate variabilities on crop yield using three statistical models (time series, panel, and cross-sectional models). They discovered that depending on the climate variable and spatial scale being considered, the performance of statistical models differs. The responses to temperature change were more accurately predicted by panel and cross-sectional models than the responses to precipitation change, which only used data from a single site. The histor- ical period utilized for training was less important for the models based on numerous sites, and performance improved when individual sites were averaged across countries. However, according to Gyamerah et al. [30], it can be difficult to precisely quantify and estimate the impact of climate variability on crop output using statistical techniques because of the com- plexity and non-linear relationship between crop yield and climate variables. Crane-Droesch [31] utilized a semiparametric deep neural network variant, employed as a machine learning technique to account for the nonlinear interactions in high-dimensional datasets as well as known parametric structure and undiscovered cross-sectional variability. According to their

Trang 3 · Đoạn 10Vị trí nguồn

study, the machine learning technique outperforms the classical statistical methods in forecast- ing the yields of years withheld during model training, according to data on maize yields from the US Midwest, which they used to demonstrate the efficacy of their methodology. In addi- tion, their findings revealed significant adverse impact of climate variability on maize yield, while these effects are less severe than those predicted using conventional statistical techniques. They did this by employing scenarios from a variety of climate models. Appiah-Badu et al. [32] used a methodical and exacting approach to evaluate the effectiveness of several classification algorithms in predicting rainfall in various ecological zones of Ghana. The study employed five well-known machine learning techniques for classification: multilayer perceptron, deci- sion tree, extreme gradient boosting, random forest, and K-nearest neighbor. In their investi- gation, MLP, XGB, and RF all performed well at the three training-to-testing ratios of 90:10, 80:20, and 70:30 whereas KNN did poorly in all zones. Cedric et al. [33] also suggested a machine learning-based prediction method to forecast the yield of six crops at the national level in West African countries throughout the course of the year. The prediction system was developed using a decision tree, k-nearest neighbor, and multivariate logistic regression mod- els. They combine agricultural yields, chemical data, climate, and weather data in their PLOS ONE Impact of climate variability on maize yields in Ghana

Trang 3 · Đoạn 11Vị trí nguồn

PLOS ONE | https://doi.org/10.1371/journal.pone.0305762 June 25, 2024 3 / 24

Trang 4 · Đoạn 12Vị trí nguồn

analysis. According to the study, all three machine learning models produced favorable accu- racy, with the decision tree model performing best with 95.3% accuracy. To prevent overfitting during cross-validation, they additionally used a hyper-parameter tuning strategy. The predic- tion of the K-Nearest Neighbor model and the decision tree model were shown to relate to the expected data when the authors examine the relationship between the predicted results and the expected outcomes, suggesting that the models function as expected. However, using clus- ters for small datasets may result in overfitting when using forecasting models [34]. To over- come this issue, they used the stacking ensemble learning method (SELM), which helped them increase their generalization capacity. Li et al. [35] also used the Stacking Ensemble Learning framework to integrate three effective machine learning algorithms: support vector machine, random forest, and K-nearest neighbors as base-models. Over the course of 34 years, the study collected daily weather information as well as information on soybean output from 173 county-level administrative districts and meteorological stations in China’s two primary soy- bean-growing regions. Their findings suggested that the stacking model provides more accu- racy and versatility. They also discovered that the stacking prediction model of soybean meteorological yield provides a novel method for successfully predicting soybean production with a MAPE of less than 5%. Based on the findings presented above, the stacking ensemble

Trang 4 · Đoạn 13Vị trí nguồn

learning model has demonstrated promising results for reliably predicting maize yield using meteorological data and machine learning techniques. With our data spanning 27 years, the stacking ensemble model can be used to develop a high-precision and reliable model to analyze the impact of climate variabilities on maize yield prediction. This study considers all the regions in Ghana. This fills a large information void by includ- ing all the four ecological zones in Ghana, which encompass all the regions in the country, as opposed to prior studies that only focused on only one region [12, 28, 36], only one zone [27, 37], or selected zones [38, 39]. The study provides a more thorough assessment of the effect of climate change on maize yields in Ghana by considering all ecological zones and all the regions within each zone, making its conclusions reliable and applicable to the entire nation. Even though Atiah et al. [25] found that weather variables significantly influence maize yield vari- ability, the effects of climatic variability on crop production are complex and poorly under- stood. Machine learning algorithms have the capacity to examine intricate connections between climatic and weather variables and crop productivity. Machine learning algorithms for predicting agricultural output based on numerous meteorological and climatic elements have a better level of accuracy than the current time-consuming statistical procedures since cli- mate variables are nonlinear [33]. Even though machine learning (ML) approaches have a

Trang 4 · Đoạn 14Vị trí nguồn

high level of accuracy, their potential applications in agricultural yield prediction have not been realized due to a lack of more reliable methods [40]. By including different model types and architectural characteristics across the models, ensemble learning model forecasts can increase generalization and prediction accuracy [41]. To address the problem of agricultural yield prediction, it is advantageous to introduce an ensemble learning method [35]. Based on the review of related literature, SSA nations, including Ghana, have paucity of ensemble-based ML algorithms in analyzing the impact of climate variability on crop yields. Additionally, due to its superior prediction accuracy, the stacking ensemble model algorithm is suggested in this paper to combine the algorithms of the LR, SVM, DT, RF, and GB to assess the impact of cli- mate variables on maize yield and to fill the previously mentioned study gap. Our study aims at achieving the following goals: (i) to identify the key climatic variables that have the most significant impact on maize yield in each region; (ii) to assess the impacts of climate variability on the yield of maize in each region of Ghana; (iii) to develop a reliable pre- dictive model using machine learning algorithms that can capture the volatile, non-stationary, and non-linear nature of the climate variables and accurately forecast maize yield under PLOS ONE Impact of climate variability on maize yields in Ghana PLOS ONE | https://doi.org/10.1371/journal.pone.0305762 June 25, 2024 4 / 24

Trang 5 · Đoạn 15Vị trí nguồn

different climatic conditions; (iv) to provide policymakers in Ghana with evidence-based rec- ommendations on how to address the challenges posed by climate change and ensure food security for the country’s growing population; and finally, (v) to add to the growing literature of the predictive power of stacking ensemble machine learning model to agricultural and cli- mate change studies. Paper structure This study is divided into five primary sections. Aside from the study’s background, the paper is arranged in the following manner. The second section outlines the empirical data, the data preprocessing techniques applied, the machine learning models suggested for maize yield pre- dictions, and the methods used for empirical evaluation. After that, the main results of the study are presented in the third section. We then present a discussion of key findings in section four. Finally, we conclude the study and present some recommendations for future studies in section five. Materials and methods Areas under study Table 1 shows the districts under each region in Ghana, and the agro-ecological zones are pre- sented in Table 2. Data collection Monthly data for the climate variables (average temperature, minimum temperature, maxi- mum temperature, precipitation, and CO2) were obtained from the Ghana Meteorological Agency for all the regions in Ghana from 1992 to 2019. The reason for incorporating average, minimum, and maximum temperatures as predictors in the same model stemmed from the Table 1. The regions in Ghana and major districts where there is maize production.

Trang 5 · Đoạn 16Vị trí nguồn

Region Major Districts Western Wassa Amanfi, Aowin-Suaman, Wassa East, Shama Ahanta East, Sefwi-Wiaso, West Ahanta, Mporhor, Wassa West, Bibiani-Anhwiaso-Bekwai, Juabeso-Bea, East Nzema, Jomoro Central Awutu-Efutu-Senya, Upper Denkyira, Twifo-Herman/L.Den, Komenda-Edina-Equafo, Assin-Fosu, Gomoa, Mfantsiman, Ajumako-Essiam-Enyana, Cape Coast, Agona, Asikuma-Odoben-Brakwa, Abura-Asebu-Kwamankese Volta Kpando, Adidome, Sogakope, Akatsi, Keta, Denu/Dzodze (Ketu), Hohoe, Jasikan, Nkwanta, Kadjebi, Keta-Krachi Northern Tonlon/Kumbugu, Gushiegu/Karaga, Damango, Zabzugu/Tatale, Yendi, Bimbila, Walewale, Gambaga, Tamale, Sevelugu/Nanton, Salaga, Bole, Saboba/Chereponi Ashanti Adansi-North, Amansie East, Amansie West, Ahafo Ano North, Asante Akim North, Ejura Sekyeredumase, Sekyere West, Kumasi Metropolitan Assembly, Sekyere East, Adansi West, Ahafo Ano South, Atwima, Ejisu Juaben, Bosumtwe Kwanwoma, Kwabre Sekyere, Offinso, Adansi East, Asante Akim South, Afigya Sekyere Eastern Kwahu North, Birim South, Fanteakwa, Birim North, West Akim, Akwapim North, Suhum/Kraboa/ Coalta, Akwapim South, New Juabeng, East Akim, Kwahu South, Manya Krobo, Yilo Krobo, Kwaebibirim/Kade, Asuogyaman Greater Accra Tema, Ga, West Dangbe, East Dangbe Brong Ahafo Dorma Ahenkro, Sunyani, Asutifi, Wenchi, Berekum, Tano, Kintampo, Sene, Nkoranza, Jaman, Atebubu, Techiman, Asunafo Upper West Wa, Lawra, Tumu, Jirapa, Nadowli Upper East Builsa, Kasina/Nankani, Bongo, Bolgatanga, Bawku East, Bawku West https://doi.org/10.1371/journal.pone.0305762.t001 PLOS ONE

Trang 5 · Đoạn 17Vị trí nguồn

Impact of climate variability on maize yields in Ghana PLOS ONE | https://doi.org/10.1371/journal.pone.0305762 June 25, 2024 5 / 24

Trang 6 · Đoạn 18Vị trí nguồn

intention to encompass a thorough depiction of temperature dynamics and their potential influence on the response variable, motivated by existing studies [10, 25, 42]. For this study, the ten (10) administrative regions that existed between 1992 and 2019 were used. The Statis- tics, Research, and Information Directorate (SRID) of Ghana’s Ministry of Food and Agricul- ture provided the yearly average maize yield in metric tons per hectare (MT/ha) for each district from 1992 to 2019. The average maize yield for each district corresponds to the ratio of the district’s estimated production to the district’s estimated cropped area. Motivated by Preety et al. [43], the LINEST function in Excel is used to handle missing values in the original data before aggregating it further. The specific software used for this interpolation task was Excel because of its user-friendly interface and built-in features for linear interpolation. It is worth noting that although Excel was used for interpolation, the subsequent analysis and modeling were carried out using Python with pandas and scikit-learn. Data preprocessing The data from May to September were aggregated to create the annual data for each climatic variable in the major regions in the Guinea Savannah zone since that is the cropping season for maize in the Upper West, Upper East, and Northern parts of Ghana. From Table 2, the Transitional, Rain Forest, and Coastal Savannah zones have two major cropping seasons for maize (March–August/September and July–December); therefore, the data from March to

Trang 6 · Đoạn 19Vị trí nguồn

December is aggregated to obtain the annual cropping season climate data. To perform this aggregation, the values of the pertinent variables for each month during the time were added up, and the mean value for the entire period was then determined. As a result, each variable for every year of the study had a single value. In addressing the temporal structure of the data, we conducted an Augmented Dickey-Fuller (ADF) test to evaluate the stationarity of the ’maize yield’ time series. Based on the ADF test, it was determined that the series from all regions exhibited nonstationarity, as indicated by p-values exceeding 0.05. Subsequently, detrending was performed using the ‘detrend’ function from ‘scipy.signal’ library in Python, and the detrended variable was further deseasonalized by subtracting its lagged value, assum- ing a yearly seasonality. To achieve stationarity, differencing was applied to the deseasonalized data. This comprehensive approach aimed to mitigate temporal patterns, trends, and seasonal- ity in the ’maize yield’ time series, ensuring that the data is suitable for subsequent analysis and modeling using the fixed-effect regression models. We utilized both the MinMaxScaler and the StandardScaler from the sklearn library in Python to scale the input variables. It became evident that the StandardScaler yielded superior results compared to the MinMaxScaler. Consequently, we opted to standardize the input Table 2. The agro-ecological zones and their maize cultivation calendar in Ghana. Agro-Ecological Zone Administrative Seasons for cultivation of Maize

Trang 6 · Đoạn 20Vị trí nguồn

Planting period-onset length of the cropping cycle Harvesting period-end Coverage areas Guinea Savannah zone Northern region, Upper west Region, Upper East region One season 20-May 90–120 days 10-September Transitional Zone Major part of Brong Ahafo, northern part of Ashanti Region, part of Volta region First season 20-March 90–120 days 20-August Second season 20-July 90–120 days 10-December Rain Forest Zone Eastern region, southern part of Ashanti, and Western region, parts of Volta, Brong Ahafo, Greater Accra, and Central region First season 10-March 90–120 days 10-August Second season 20-July 90–120 days 20-December Coastal zone Parts of Central region, Greater Accra region, Eastern and Volta region First season 20-March 90–120 days 20-September Second season 20-July 90–120 days 20-December https://doi.org/10.1371/journal.pone.0305762.t002 PLOS ONE Impact of climate variability on maize yields in Ghana PLOS ONE | https://doi.org/10.1371/journal.pone.0305762 June 25, 2024 6 / 24

Trang 7 · Đoạn 21Vị trí nguồn

variables using the standard scaler. Besides, since the climate variables have different units, the standard scaler become the appropriate choice. The decision for standardization was made to ensure that all variables were aligned on a consistent scale, aiming to fit them within a stan- dardized range. Subsequent to making predictions, an inverse scaling procedure was employed to transform the standardized predictions back to their original scales, maintaining the interpretability of the results in the context of the original data units. The datasets were arbi- trary divided into two subsets, one comprising the test set (20%) for validating and the other containing the training set (80%) for modeling. The entire analysis was conducted using the Python programming language. Model establishment Assessing the impact of climate variability on crop yield is an important task in agricultural research because it provides useful insights into how climate variability affects food security. The goal of this study is to develop a model for measuring the impact of climate variability on maize yield. To accomplish this, we employed a variety of machine learning algorithms, including multiple linear regression, random forest, support vector machines, decision trees, and gradient boosting. These algorithms were used to construct a single model (the stacking ensemble model) that offers high accuracy in assessing the impact of the climate variables on maize. Previous research [35, 40, 44–47] have shown that ensemble learning can perform bet-

Trang 7 · Đoạn 22Vị trí nguồn

ter than individual machine learning methods. The machine learning models under consider- ation are established in this section. The base models establishment Multiple linear regression. A supervised learning strategy designed specifically for regression is linear regression. A linear function is used to depict the relationship between the input and output variables. By minimizing the sum of the squared deviations between the expected and actual output values, a straight line is found. In this study, since our independent variables are more than one, we use the multiple linear regression model. The general equation of a multiple linear regression is given in Eq (1). Yt ¼ β0 þ Xn i¼1 βi � xi;t þ εt ð1Þ Where, Yt is the response variable at time t xi,t is the predictor variable i at time t, βi is the regression coefficients that determines the impact of each climate variables, β0 is the intercept, and εt is the error term at time t. For this studies, Eq (1) can be reformulated as shown in Eq (2) Yt ¼ b0 þ b1x1;t þ b2x2;t þ b3x3;t þ b4x4;t þ b5x5;t þ εt ð2Þ where Yt is the maize yield; x1,t = average temperature; x2,t = maximum temperature; x3,t = minimum temperature; x4,t = precipitation; x5,t = CO2 at time t, εt is the error term at time t or residual representing the difference between the predicted value and the actual value of Yt also known as the unobservable factors affecting Yt; β1, β2, β3, β4, β5 captures respectively the effect of x1,t, x2,t, x3,t, x4,t, x5,t on Yt, and β0 is the intercept of the equation.

Trang 7 · Đoạn 23Vị trí nguồn

Decision trees. A decision tree is a supervised learning method that may be applied to both classification and regression problems. The tree is created by recursively dividing the data according to the values of the input variables. Each leaf node of the tree represents a class label (in the case of classification) or a prediction (in the case of regression), and each internal node of the tree represents a test on an input variable. We formulated the decision tree regression PLOS ONE Impact of climate variability on maize yields in Ghana PLOS ONE | https://doi.org/10.1371/journal.pone.0305762 June 25, 2024 7 / 24

Trang 8 · Đoạn 24Vị trí nguồn

for this model given the dependent variable Y as: Y ¼ XK j¼1 Cj � 1Rj X ð Þ ð3Þ Where Y is the predicted value which is maize in this case, K is the number of terminal nodes or leaves in the decision tree, Cj is the constant value assigned to the jth leaf node, representing the predicted value of Y for that region, 1Rj X ð Þ represent an indicator function that takes the value 1 if the output vector X falls within the rectangular region Rj and 0 otherwise. Random forest. The ensemble learning method known as a random forest produces numer- ous decision trees during training and outputs the mean prediction (regression) or mode of the classes (classification) of the individual trees. Each tree in a random forest is trained using a different subset of the characteristics and a different portion of the training data. By averag- ing all the trees’ projections, the final prediction is produced. In this study, the Random Forest regression was considered. Mathematically, given an input vector X (Climate variables), the random forest model predicts the output ^y (maize yield) as: ^y ¼ 1 T XT t¼1 ft X ð Þ þ ε ð4Þ In this study, Eq 4 can be written as: Yt ¼ 1 T XT t¼1 ft x1;t ; x2;t ; x3;t ; x4;t ; x5;t � þ εt ð5Þ Where T represents the number of decision trees in the ensemble, ft is the function that maps the independent variables (climate variables) to the dependent variable Y(maize yield). Yt is the maize yield; x1,t = average temperature; x2,t = maximum temperature; x3,t = minimum tem-

Trang 8 · Đoạn 25Vị trí nguồn

perature; x4,t = precipitation; x5,t = CO2, εt is the error term or residual that represents the dif- ference between the predicted value and the actual value of the dependent variable and ft(x) is the prediction of the tth tree. In a random forest model, the function is a combination of multi- ple decision trees that each provide a prediction for the dependent variable. Support vector machine. A support vector machine is a type of supervised learning tech- nique that can be used for classification as well as regression. The SVM finds a hyperplane that optimally separates the input into various groups (in classification) or predicts the output val- ues (in regression). The hyperplane is chosen in such a way that the margin between the differ- ent classes is maximized. Mathematically, the hyperplane is defined by the equation: w � x þ b ¼ 0 ð6Þ Where w is the weight vector, x is the input vector, and b is the bias term. The prediction ^y for a new input vector x is given by: ^y ¼ sign w � x þ b ð Þ ð7Þ The "sign" refers to the sign of the output of the decision tree model. The output of a deci- sion tree is a discrete set of values based on the rules and splits that the tree has learned from the training data. The sign function is used to map these discrete values to either +1 or -1. The positive sign (+1) indicates that the sample is predicted to belong to the positive class (or have a positive target value), while the negative sign (-1) indicates that the sample is predicted to belong to the negative class (or have a negative target value).

Trang 8 · Đoạn 26Vị trí nguồn

Gradient boosting. Gradient Boosting is an ensemble technique that combines predictions generated by different weak models to produce a powerful forecasting model. The "gradient" in the term "gradient boosting" refers to the fact that the technique iteratively adds new models PLOS ONE Impact of climate variability on maize yields in Ghana PLOS ONE | https://doi.org/10.1371/journal.pone.0305762 June 25, 2024 8 / 24

Trang 9 · Đoạn 27Vị trí nguồn

to the ensemble to minimize a loss function. Each new model is taught to fix the errors com- mitted by the existing ensemble. The direction and size of the ensemble updates are chosen by the algorithm using gradient descent optimization. Given a training dataset with input features (Climate variables) represented by X and corresponding target values (maize yield) repre- sented by y, where X = {(xm, ym), for m = 1, 2, . . .n}, gradient boosting aims to construct an ensemble model say F(x) that approximates the true target values of y. With an initial model F0(x), the training for each iteration m = 1 to M is represented in Eq 8 which computes the negative gradient of the loss function with respect to the current ensemble model’s prediction. With a weak model say, wm(x), the updated ensemble model can be represented in Eq 8, where wm(x) approximates the negative gradients and corrects the errors made by the current ensem- ble model, ρm is the optimal learning rate or step size which controls the contribution of the weak model to the ensemble. The final ensemble model in the gradient boosting is shown in Eq 10. gm ¼ rgLðy; Fm 1 x ð ÞÞ ð8Þ Fm x ð Þ ¼ Fm 1 x ð Þ þ rm � wmðxÞ ð9Þ F x ð Þ ¼ F0 x ð Þ þ r1 � w1 x ð Þ þ r2 � w2 x ð Þ þ � � � þ rm � wm x ð Þ ð10Þ The stacking ensemble learning model establishment. Stacking is a type of ensemble learning technique that combines multiple base models to improve the overall performance of the model. The predictions from various base models are used as input in the stacking ensem-

Trang 9 · Đoạn 28Vị trí nguồn

ble learning model, which learns how to combine the predictions to make the final prediction through a secondary learning process known as meta-learning, which improves the accuracy and stability of the prediction [48]. The predictive performance of models in the available input subsets is estimated and evaluated in this work using cross-validation techniques. This technique is effective in avoiding overfitting and would be helpful in handling small datasets [34]. Motivated by studies in [40, 47, 49], this study employs a 5-fold cross-validation. This is a well-known cross-validation strategy for optimizing model hyperparameters and evaluating model performance [47]. Each model is trained on ’k-1’ folds of the k-folded input training dataset before being validated on the fold that was not used in training. The technique is applied k times, with the validation fold being changed each time. The forecasts are then stored in train-meta so that they can be utilized as features or inputs for the stacking model. We defined parameter grids for the base models’ hyperparameter tuning. For the linear regression model, we kept the default values for its parameters, setting "fit intercept" to true and "normalize" to false. In the case of the decision tree model, we specified the options for the maximum depth, which could be none, 5, 10, or 15. The minimum sample split had choices of 2, 5, or 10, and the minimum sample leaf could be 1, 2, or 4. Regarding the random forest model, we provided options for the number of estimators: 100, 200, or 500. We also set the

Trang 9 · Đoạn 29Vị trí nguồn

maximum depth to none, 5, 10, or 15, and the minimum sample split and minimum sample leaf had the same choices as the decision tree model. For the support vector machine model, we set the degree parameter to select from 2, 3, or 4. The kernel had options of linear, poly, rbf, or sigmoid. Additionally, the ’C’ parameter, representing the size of the margin value for the support vector regression model to select from either 0.1, 1, or 10. In the gradient boosting model, we defined the learning rate to select from 0.1, 0.05, or 0.01, and the number of estima- tors could be 100, 200, or 500. To fine-tune each base model’s hyperparameters, we utilized GridSearchCV with 5-fold cross-validation and evaluated them using the negative mean PLOS ONE Impact of climate variability on maize yields in Ghana PLOS ONE | https://doi.org/10.1371/journal.pone.0305762 June 25, 2024 9 / 24

Trang 10 · Đoạn 30Vị trí nguồn

squared error scoring parameter. GridSearchCV is an approach in machine learning that focuses on tuning hyperparameters to identify the most effective combination for a given model systematically. This method necessitates the definition of a parameter grid, which out- lines the potential values for each hyperparameter to be explored. In our investigation, the selection of the parameter grid is influenced by the recommendations outlined in [35, 42, 47]. We also employed the linear kernel support vector regression method as the meta regressor motivated by Panigrahi et al. [50]. The basic idea behind stacking is to use the strengths of multiple base models to compen- sate for their weaknesses. Each base model is trained on the training data using a different algorithm and generates predictions for the validation or test data. The predictions from the base models are then combined using a meta-model, which is trained on the predictions gen- erated by the base models. The meta-model learns how to weigh the contributions of the base models based on their past performance, and generates the final prediction as shown in Fig 1. The evaluation metrics of the model performances. In this study, statistical measures were utilized as metrics to assess the performance of the proposed stacking ensemble predic- tion model. To evaluate the model’s ability to fit the data, performance evaluation metrics were employed. The proposed stacking ensemble model and the base models were evaluated based on the mean square error (MSE) and the mean absolute error (MAE). The formulas for

Trang 10 · Đoạn 31Vị trí nguồn

MSE and MAE can be found in Eqs 11 and 12, respectively. Hence, the preference is for smaller values as they signify improved model performance in minimizing the discrepancies between predicted and actual values. MSE ¼ Pn i¼1 yi ^yi ð Þ2 n ð11Þ MAE ¼ Pn i¼1 jyi ^yij2 n ð12Þ Fig 1. The model framework of stacking ensemble learning model. https://doi.org/10.1371/journal.pone.0305762.g001 PLOS ONE Impact of climate variability on maize yields in Ghana PLOS ONE | https://doi.org/10.1371/journal.pone.0305762 June 25, 2024 10 / 24

Trang 11 · Đoạn 32Vị trí nguồn

Empirical evaluation The descriptive statistics of maize yield are shown in Table 3. From the Table, the yield of maize ranged from 0.33 MT/Ha in 1992 in the Upper West Region to a maximum of 5.57 mt/ ha in 2019 in the Greater Accra Region. The average yield of maize varied across all the regions. The highest (2.01 MT/Ha) and lowest (1.17 mt/ha) average maize yields were detected in the Eastern and Greater-Accra regions, respectively. This indicates that the production of maize was more stable in the Eastern Region than in the Greater Accra Region. To compare the variability of maize yield in all the Regions in Ghana, the coefficient of variation (CVar) is employed. From the coefficient of variation as shown in Table 3, Around the mean maize yield of 1.17 mt/ha, the Greater Accra region has the largest coefficient of variation (CVar), at 77%. This implies that the yield of maize in this region is subject to significant variability over time. In comparison to other regions, the yield of maize in the Greater Accra region exhibits a more annual uneven performance. The Western region, on the other hand, exhibits the lowest coef- ficient of variation (CVar), which is 8% around the mean yield of 1.40 mt/ha. This suggests that compared to other regions, maize output in the Western Region is more consistent and has lesser variability over time. This means that a more dependable and predictable production pattern is shown by the constancy of maize yield in this region. Although there is a lot of variability in the Greater Accra region, it is vital to remember that

Trang 11 · Đoạn 33Vị trí nguồn

its mean yield (1.17 mt/ha) is lower than that of all the regions in Ghana (see Table 3). This indicates that, on average, the Greater Accra region produces less maize than the other nine (9) regions. Low average yield and high variability indicates that there may be difficulties or variables affecting maize cultivation in the Greater Accra region that cause both low average yield and high yield variability. Therefore, future research should analyze the variables affect- ing maize yield in this region (Greater Accra Region). Analysis of the climate variables. Climate variables are essential for understanding and appreciating the dynamics of climate patterns and environmental conditions in different regions. Analyses of climate variables such as average temperature, maximum temperature, minimum temperature, precipitation, and CO2 levels, provide vital insights into the changes and trends that influence Ghana’s maize yield. We can quantify the central tendency and rela- tive variability of these climate variables using key statistical measures such as the coefficient of variation and mean. The extent of fluctuations in temperature, precipitation, and carbon diox- ide levels is analyzed by looking at the coefficient of variation and mean as shown in Table 4. Table 4 shows the mean and coefficient of variation for each climate variable across Ghana’s regions. Table 3. Descriptive statistics of the maize yield for each of the regions in Ghana. Region Count Min Max Mean CVar (%) Ashanti 28.00 1.13 3.02 1.57 26.0 Northern 28.00 0.60 1.97 1.34 26.0

Trang 11 · Đoạn 34Vị trí nguồn

Eastern 28.00 1.36 2.98 2.01 22.0 Volta 28.00 0.99 2.36 1.65 18.0 Central 28.00 0.80 2.82 1.73 30.0 Upper East 28.00 0.50 2.98 1.36 37.0 Upper West 28.00 0.33 2.69 1.53 29.0 Brong Ahafo 28.00 1.41 2.45 1.88 12.0 Greater Accra 28.00 0.62 5.57 1.17 77.0 Western 28.00 1.03 1.55 1.40 8.0 https://doi.org/10.1371/journal.pone.0305762.t003 PLOS ONE Impact of climate variability on maize yields in Ghana PLOS ONE | https://doi.org/10.1371/journal.pone.0305762 June 25, 2024 11 / 24

Trang 12 · Đoạn 35Vị trí nguồn

According to the analysis in Table 4, with a mean temperature of 27.42˚C, the Volta region has the highest coefficient of variation (CVar) of 1.19%, while the Upper East region has the highest mean temperature (28.95˚C) of all the regions with a coefficient of variation of 1.03%. This signifies that the temperature in the Volta region experiences more significant fluctua- tions over time compared to other regions. The Upper East region, on the other hand, has the highest mean temperature, indicating that it experiences greater temperature on average than the other regions. However, the coefficient of variation in the Upper East region (1.03%) is lower than in the Volta region (1.19%), indicating that the temperature in the Upper East region is less variable than in the Volta region. In comparison to the other regions, the North- ern, Upper East, and Upper West regions are noted to have higher average temperatures. This is since these areas are in the Guinea Savannah Zone, which is regarded as the warmest region in the nation and does not have frequent rainfall. With a mean precipitation of 950.9 mm, the Greater Accra region has the highest coefficient of variation (CV) of 13.17%, whereas the Western region has the highest mean precipitation of all regions with 1491.63 and a coefficient of variation of 11.39%. That is, the precipitation in the Greater Accra region is more volatile than in the other regions. This means that precipita- tion in the Greater Accra region varies more significantly over time. The Western region, on

Trang 12 · Đoạn 36Vị trí nguồn

the other hand, has the greatest mean precipitation of all the regions, suggesting that it receives more rainfall on average than the other regions. However, the coefficient of variation in the Western region (11.39%) is lower than in the Greater Accra region (13.17%), indicating that precipitation in the Western region is less variable than in the Greater Accra region. The aver- age CO2 level across all regions is 0.39, with a coefficient of variation (CV) of 35.06%. The Table 4. Mean and coefficient of variation analysis of the climate variables. Regions Measures Climate Variables Avg Temp Min Temp Max Temp Precip CO2 Ashanti mean 26.98 22.34 31.67 1316.83 0.39 CVar (%) 0.99 1.18 0.96 10.33 35.06 Volta mean 27.42 22.67 32.22 1238.68 0.39 CVar (%) 1.19 1.57 0.99 12.17 35.06 Eastern mean 27.01 22.39 31.67 1236.59 0.39 CVar (%) 1.08 1.34 0.99 12.34 35.06 Northern mean 28.28 22.69 33.92 1133.44 0.39 CVar (%) 1.01 1.31 0.92 8.52 35.06 Upper East mean 28.95 23.02 34.94 997.57 0.39 CVar (%) 1.03 1.41 0.92 8.92 35.06 Upper West mean 28.61 22.92 34.35 1010.48 0.39 CVar (%) 1.04 1.29 1.00 9.04 35.06 Central mean 26.82 22.98 30.7 1230.02 0.39 CVar (%) 1.00 1.15 0.97 11.93 35.06 Western mean 26.92 22.89 31.01 1491.63 0.39 CVar (%) 0.92 1.07 0.92 11.39 35.06 Brong Ahafo mean 27.39 22.45 32.36 1209.11 0.39 CVar (%) 0.98 1.20 0.94 8.53 35.06 Greater Accra mean 27.34 23.50 31.23 950.9 0.39 CVar (%) 1.08 1.35 0.98 13.17 35.06

Trang 12 · Đoạn 37Vị trí nguồn

Note: The bold values represent the highest and precip represents precipitation. https://doi.org/10.1371/journal.pone.0305762.t004 PLOS ONE Impact of climate variability on maize yields in Ghana PLOS ONE | https://doi.org/10.1371/journal.pone.0305762 June 25, 2024 12 / 24

Trang 13 · Đoạn 38Vị trí nguồn

mean value of 0.39 represents the average carbon dioxide concentration throughout the regions under consideration. Carbon dioxide is a greenhouse gas that contributes significantly to climate change. This mean number indicates that the regions have a given level of carbon dioxide in the atmosphere on average. The coefficient of variation of 35.06% shows the regional variability in carbon dioxide levels. The comparatively high coefficient of variation of 35.06% suggests that carbon dioxide concentrations in Ghana’s various regions vary signifi- cantly over time. Results Trends of maize yield for each region in Ghana In this section, we investigate the variation and trends in maize yield for each region over the period under study in Ghana. Fig 2 clearly show that the yield of maize has increased signifi- cantly across all the regions in Ghana. In Fig 2, the maximum maize yield in all the regions we observed in 2019 except for the Upper East and the Western region which recorded the maxi- mum maize yield in 2003 and 2012 respectively. However, it is observed that it started rising after the year 2015. This increasing trend of maize yield in the regions can be attributed to sev- eral factors which are discussed subsequently. Impact of climate variables on maize yield Although there are numerous climate factors that affect maize output, temperature and precip- itation have the greatest effects on crop productivity [4]. Fig 3 shows how average temperature and precipitation affect maize yield in each region. We fixed the threshold for maximum

Trang 13 · Đoạn 39Vị trí nguồn

maize yield (see Fig 3) at 2.0 mt/ha for all the regions apart from the Northern and Western regions, where the thresholds for maximum maize yield were set at 1.8 mt/ha and 1.5 mt/ha, respectively. This is because the maximum yields of maize in either of these two regions never exceeded 2.0 mt/ha. In the Ashanti region of Ghana, the maize yield is influenced by specific temperature and precipitation conditions. Based on the data presented in Fig 3a, it is observed that higher maize yields are obtained when the average temperature ranges between 27.10˚C and 27.30˚C, and the precipitation amounts fall between 1388.80 mm and 1593.53 mm. The optimal combi- nation is found at an average temperature of 27.15˚C and a precipitation total of 1593.53 mm, which leads to the maximum maize yield. In the Central region as shown in Fig 3d, it is evident that higher maize yields are obtained when the average temperature ranges between 26.60˚C and 27.50˚C, and the precipitation amounts fall between 1217 mm and 1495.00 mm. The opti- mal combination is found at an average temperature of 26.98˚C and a precipitation total of 1489.66 mm, which leads to the maximum maize yield. In the Eastern region as depicted in Fig 3b, the production of higher maize yields is associated with average temperatures between 26.86˚C and 27.61˚C and precipitation amounts ranging from 1168.53 mm to 1615.79 mm. The maximum maize yield occurs at an average temperature of 27.19˚C and a precipitation total of 1615.79 mm. In Volta region as shown in Fig 3c, it is observed that higher maize yields

Trang 13 · Đoạn 40Vị trí nguồn

are obtained when the average temperature ranges between 27.64˚C and 27.76˚C, and the pre- cipitation amounts fall between 1314.30 mm and 1600.11 mm. The optimal combination is found at an average temperature of 27.64˚C and a precipitation total of 1600.11 mm, which leads to the maximum maize yield. In the Brong Ahafo region as shown in Fig 3e, higher maize yields are obtained when average temperatures range from 27.16˚C to 27.81˚C and pre- cipitation amounts fall between 1204.32 mm and 1437.83 mm. The maximum maize yield occurs at an average temperature of 27.53˚C and a precipitation total of 1437.83 mm. In the Greater Accra region (Fig 3f), a maximum maize yield is produced with an average PLOS ONE Impact of climate variability on maize yields in Ghana PLOS ONE | https://doi.org/10.1371/journal.pone.0305762 June 25, 2024 13 / 24