Resumen Commodity price volatility and small variations in climate conditions may have an important impact on the creditworthiness of any agricultural project. The evolution of such risk factors is vital for the credit risk analysis of a rural bank. The purpose of this paper is to determine the importance of price volatility and climate factors within a default risk model. Design/methodology/approach – The authors estimate a generalized linear model (GLM) based on a structural default risk model. With the estimated factor loadings, the authors simulate the loss distribution of the portfolio and perform stress test to determine the impact of the relevant risk factors on economic capital. Findings – The results indicate that both the price volatility and climate factors are statistically significant; however, their economic significance is smaller compare to other factors that the authors control for: macroeconomic conditions for the agricultural sector and intermediate input prices. Research limitations/implications – The analysis of non-systemic risk factors such as price volatility and climate conditions requires statistical methods focussed on measuring causal effects at higher quantiles, not just at the conditional mean, this is, however, a current limitation of GLMs. Practical implications – The authors provide a design of a portfolio credit risk model, that is more suited to the special characteristics of a rural bank, than commercial credit risk models. Originality/value – The paper incorporates agricultural-specific risk factors in a default risk model and a portfolio credit risk model. © Emerald Group Publishing Limited.