J. Dörr et al.: Digitale Infrastrukturen, Lecture Notes in Informatics (LNI), Gesellschaft für Informatik, Bonn 2025 321 Data-driven nitrogen management Leveraging historical data and machine learning for economic optima Custodio Matavel 1 and Andreas Meyer-Aurich 2 Abstract: Efficient nitrogen management is crucial for economic and environmental sustainability in agriculture. Excessive nitrogen use leads to pollution and higher costs, while insufficient application reduces crop yields and profitability. This study builds on existing nitrogen response models by using machine learning to optimize nitrogen use, leveraging data from long-term experiments. The dataset includes nitrogen treatment levels, crop yields, and weather data, enabling a comprehensive analysis of nitrogen management practices. By employing Support Vector Regression (SVR) and Random Forest (RF) models, this research captures non-linear relationships between weather variables and Economic Optimum Nitrogen Rate (EONR). Results show RF models to outperform SVR, with lower Root Mean Squared Error (RMSE) and higher R2, highlighting RF’s robustness in managing variability. The study also evaluates the effects of organic fertilization, emphasizing the potential of data-driven nitrogen management to support sustainable agriculture with localized, precise recommendations. Keywords: nitrogen management, machine learning, EONR, long-term field experiments, NUE 1 Introduction Efficient nitrogen management is essential for sustainable agriculture, balancing economic and environmental outcomes [Zh15]. Excessive nitrogen use increases costs and contributes to water pollution and greenhouse gas emissions, while insufficient application reduces crop yields, impacting profitability and food production [Ti02]. Optimizing nitrogen use, therefore, balances economic benefits with environmental stewardship. Traditional nitrogen management models, often generalized to maximize yields, may not adequately capture the complex interactions between nitrogen application, soil conditions, and environmental factors required for optimal profitability [Mo18; LS03]. The Economic 1 Leibniz Institute for Agricultural Engineering and Bioeconomy (ATB), Max-Eyth-Allee 100, 14469, Potsdam, Germany,
[email protected], https://orcid.org/0000-0002-3800-7887 2 Leibniz Institute for Agricultural Engineering and Bioeconomy (ATB), Max-Eyth-Allee 100, 14469, Potsdam, Germany,
[email protected], https://orcid.org/0000-0002-8235-0703
322 Custodio Matavel and Andreas Meyer-Aurich Optimum Nitrogen Rate (EONR) offers a more refined approach by determining the nitrogen rate that maximizes economic returns, providing farmers with tailored recommendations. This study uses machine learning to advance nitrogen management practices, capturing non-linear relationships between nitrogen use efficiency (NUE), weather patterns, and treatment levels [La23; We22]. Unlike conventional models, this approach emphasizes the interaction between nitrogen rates and weather variables, providing localized, precise recommendations for specific field conditions. Integrating historical and real-time data enables dynamic decision-making in precision agriculture, helping farmers optimize nitrogen use while minimizing environmental impacts. 2 Materials and methods 2.1 Data source This study used data from a long-term field experiment focused on winter wheat production at the Dahlem site in Berlin, Germany. Initiated in 1984, the experiment spanned multiple crop rotations until 1999, providing consistent data collection. The site, characterized by Albic Luvisol soil with a loamy sand texture, supported a two-factorial design combining organic and mineral nitrogen treatments. Details on soil characteristics, including pH, C/N ratio, and nutrient contents (P, K, N), can be found in [Ko00]. The design enabled the assessment of varying nitrogen rates with and without organic amendments, aiming to optimize nitrogen application for economic benefits. The fertilization regimes for crops, including winter wheat, are summarized below. Series A: No organic fertilization. Mineral nitrogen (N) rates: 0 (N0), 150 (N3 for Potato), 160 (N3 for Winter Wheat), 120 (N3 for Spring Barley). Series B: Organic fertilization with 300 dt/ha manure for Potato. Mineral N rates: 0 (N0), 60 (N1), 100 (N2), and 150 (N3) kg/ha for Potato, 60, 110, and 160 kg/ha for Winter Wheat, and 40, 80, and 120 kg/ha for Spring Barley. Series C: Organic fertilization includes 60 dt/ha Straw + Green Manure for Potato, 250 dt/ha Beet Leaves for Winter Wheat, and 60 dt/ha Straw for Spring Barley. Mineral N rates as in Series B. The experiment included detailed weather monitoring, focusing on key variables like temperature and precipitation. For this study, we used average temperature and total precipitation during the winter wheat growing season (September to July) from 1986 to 1999, along with annual yield data across different nitrogen treatment plots.
Data-driven nitrogen management 323 2.2 Analytical approach This study used a model-averaging approach to estimate the average EONR for each treatment year, combining multiple nitrogen response models to capture variability and enhance prediction robustness [MP22; MMP24]. This approach suits complex agricultural systems with non-linear interactions among soil, weather, and management factors. Four nitrogen response models – Mitscherlich, Quadratic, Quadratic Plateau, and Linear Plateau – were individually fitted to the yield data, grouped by year and fertilization type [Ly19]. Due to limited mineral N points, Series A data was excluded. The Akaike Information Criterion (AIC) determined model quality, with AIC weights guiding model contributions to the final average EONR. An ANOVA identified significant EONR differences across organic fertilizer types, and trends were visualized. To enhance predictions, Support Vector Machines (SVM) and Random Forest (RF) models analyzed non-linear relationships between EONR and weather variables, focusing on organic fertilizer types. SVR models were standardized to balance feature contributions, with a radial basis function kernel set at C=100 and epsilon=0.1 for accuracy. RF models, which required no standardization, identified key weather factors affecting EONR. Model performance was assessed via Root Mean Squared Error (RMSE) and R2 Score, where lower RMSE and higher R2 indicated better prediction. Combining SVM and RF models leveraged their strengths to produce robust, accurate EONR predictions. 3 Results and discussion 3.1 Average EONR across organic farming types The results in Figure 1 show significant differences in EONR dynamics between the two organic farming systems. ANOVA results indicate a notable difference between types B and C (p < 0.05), suggesting that nitrogen efficiency is influenced by the farming system, with type B showing greater variability and type C offering more stable nitrogen requirements. Tailoring nitrogen management strategies to each system can improve cost-effectiveness and environmental sustainability. Future research could explore the generalizability of these findings to other locations and agroecological conditions.
324 Custodio Matavel and Andreas Meyer-Aurich Fig. 1: Comparison of average EONR across organic fertilization types (left) and trends of average EONR over the years by organic fertilization type (right) 3.2 Machine learning results Machine learning model performance varied significantly by fertilizer type (Fig. 2). For type B, the Support Vector Regression (SVR) model showed a low R2 of 0.07 and high RMSE (75.47), while for type C, the R2 was better at 0.41. These results suggest that SVR may struggle with high variability in data [La23; Qi18]. The Random Forest (RF) models performed significantly better, reducing RMSE to 10.95 for type B and achieving 1.02 for type C, effectively capturing complex interactions. RF’s superior performance aligns with findings that it better handles variability, making it suitable for complex agricultural datasets [La23; Qi18]. This observation reinforces the trend of using flexible models like RF in precision agriculture, where dataset diversity demands robust handling [We22]. The findings highlight the importance of selecting models suited to dataset characteristics and prediction goals. While SVR may suit linear or well-structured data, RF offers a stronger solution for complex relationships, enhancing EONR prediction accuracy through advanced machine learning.
Data-driven nitrogen management 325 Fig. 2: Comparison of Actual vs. Predicted EONR Using SVM and Random Forest Models for Organic Fertilizer Types B and C. The top row shows the performance of SVM models, while the bottom row displays results from Random Forest models 4 Conclusion This study highlights the potential of machine learning models, especially Random Forests, to enhance EONR prediction for winter wheat. Leveraging historical data on weather and nitrogen treatments, Random Forest models delivered more accurate nitrogen recommendations than SVR, particularly for organic fertilizer type B. These results emphasize the value of robust, non-linear models like Random Forests, which can handle variability and support precise, localized nitrogen management. Future research should aim to expand the dataset and incorporate additional variables to further improve model accuracy and applicability for sustainable agriculture.
326 Custodio Matavel and Andreas Meyer-Aurich Bibliography [La23] de Lara, A. et al.: Predicting site-specific economic optimal nitrogen rate using machine learning methods and on-farm precision experimentation. Precision Agriculture, 24/5, S. 1792-1812, 2023. [Ko00] Köhn, W. et al.: Dauerdüngungsversuch (IOSDV) Berlin-Dahlem Deutschland. In: Körschens, M. (Hrsg.): IOSDV: Internationale organische Stickstoffdauerdüngungsversuche. Bericht der Internationalen Arbeitsgemeinschaft Bodenfruchtbarkeit in der Internationalen Bodenkundlichen Union (IUSS). Bd. 15, LEIPZIG-Halle: UFZ-Umweltforschungszentrum, 2000. [LS03] Lory, J. A.; Scharf, P. C.: Yield Goal versus Delta Yield for Predicting Fertilizer Nitrogen Need in Corn. Agronomy Journal, 95/4, S. 994-999, 2003. [Ly19] Lyons, S. E. et al.: Nitrogen response models for winter cereals grown for forage. Journal of Agronomy and Crop Science, 205/2, S. 248-261, 2019. [MMP24] Matavel, C. E.; Meyer-Aurich, A.; Piepho, H.-P.: Model-averaging as an accurate approach for ex-post economic optimum nitrogen rate estimation. Precision Agriculture, 25/3, S. 1324-1339, 2024. [MP22] Miguez, F. E.; Poffenbarger, H.: How can we estimate optimum fertilizer rates with accuracy and precision? Agricultural & Environmental Letters, 7/1, e20075, 2022. [Mo18] Morris, T. F. et al.: Strengths and Limitations of Nitrogen Rate Recommendations for Corn and Opportunities for Improvement. Agronomy Journal, 110/1, S. 1-37, 2018. [Qi18] Qin, Z. et al.: Application of Machine Learning Methodologies for Predicting Corn Economic Optimal Nitrogen Rate. Agronomy Journal, 110/6, S. 2596-2607, 2018. [Ti02] Tilman, D. et al.: Agricultural sustainability and intensive production practices. Nature, 418/6898, S. 671-677, 2002. [We22] Wen, G. et al.: Optimizing machine learning-based site-specific nitrogen application recommendations for canola production. Field Crops Research, 288, 108707, 2022. [Zh15] Zhang, X. et al.: Managing nitrogen for sustainable development. Nature, 528/7580, 5159, 2015.