RECS ToolBox

Long Name
A Matlab solver for nonlinear, dynamic, stochastic, rational expectations equilibrium models
Primary Contact

Given recent events on world food markets, many countries are contemplating or have introduced policies to achieve greater independence from the world market and to protect their vulnerable populations from global food price spikes. Although these policies play a role in the development of many countries (see Rashid et al., 2008, for the case of Asian countries), they often prove quite costly and difficult to manage (Gilbert, 1996, Jayne and Jones, 1997). Because these policies are designed to affect the whole market, they are not amenable to assessment by randomized trials as in the case of policies targeting households. These price policies affect the whole economy and every policy experiment can be very costly. In this situation, it is useful to be able to test and analyze stabilization policies without entailing any human or fiscal costs, using simulated economies that represent most of the important facts related to commodity price behavior.

Variants of rational expectations storage models are central to neoclassical studies of the behavior of markets for storable commodities (Williams and Wright, 1991, Wright, 2001). Simple versions are tested econometrically, for example in Deaton and Laroque (1992) and Cafiero et al. (2011). More complex models are used to analyze the effects of public interventions in commodity markets (Miranda and Helmberger, 1988, Gouel and Jean, 2012).

Like most dynamic stochastic problems, this model cannot be solved analytically. But contrary to most stochastic problems studied, it presents specific numerical difficulties related to the non-negativity constraint on storage. This feature prevents this model from being solved with popular software, such as Dynare, which rely on perturbation methods and cannot handle occasionally binding constraints. The lack of user-friendly softwares to solve storage models in the past may have represented a serious barrier to entry for research on these issues. The RECS toolbox provides a modeling environment allowing economists to focus on the economic problem at hand, while abstracting from various issues related to the numerical implementation.

The paper describes the Rational Expectations Complementarity Solver (RECS) toolbox and also several applications of this modeling framework to commodity markets related issues. This document assumes basic knowledge of Matlab and of dynamic economic models (see Adda and Cooper, 2003, for an introduction). Storage models are presented in brief; for more information please refer to the original papers or to Williams and Wright (1991), which provide detailed descriptions of many of these models.

This points to the role of the RECS toolbox, which provides a simple environment in which policy can be designed (for applications, see Gouel, 2011, 2013, Gouel and Jean, 2012). It can be used to compare the costs and effectiveness of stabilization policies with other forms of interventions. For  example, using RECS, Larson et al. (2012) compare the cost of a storage policy designed to protect consumers from high prices in Middle East and North African countries with safety nets that provide an equivalent protection. The documentation presents two examples of public storage policies that illustrate how RECS can be used to analyze them.

The RECS toolbox can be useful to analyze international spillovers from domestic policies and the interactions among different markets. Most domestic agricultural price stabilization policies have an effect on partner countries. Historically, this was the case with the European CAP, which stabilized the European market for several products (e.g., dairy, wheat) through storage and trade interventions, and, in so doing, forced the rest of the world to shoulder more important adjustments. The recent turmoil in the rice market is a good example of what can happen when many countries, at the same moment, attempt to insulate their markets from events on the world market (Slayton, 2009). In this context, African countries are not innocent bystanders: they also implement policies that affect their and their partners’ markets (Porteous, 2012). All these situations can be analyzed using RECS, for example, by reproducing the framework of Makki et al. (1996, 2001). The storage-trade model presented in Section 12.2 can be a starting point for this analysis, and extensions of it.

The rational expectations modeling allowed by RECS can be used also to analyze how the market reacts to weather shocks, which might allow better calibration of the information needed for public interventions. An analysis of reactions to news in a rational expectations storage model is provided for example in Osborne (2004) for the Ethiopian grain market.

The RECS toolbox is not limited to storage models. It is designed to solve small-scale rational expectations models, with a focus on models with occasionally binding constraints. This implies that it can be used also to understand household production, saving and storing behavior in the presence of transaction costs and market imperfections (see Park, 2006, for a model of Chinese rural households).

To summarize, RECS provides a user-friendly environment to develop small dynamic, stochastic models in which agents’ expectations of other agents’ behavior, markets and policies matter. These situations are pervasive in developing countries’ food markets, where the importance of food, and the risks implied by weather and price volatility, compel households to engage in sophisticated risk coping strategies (Fafchamps, 2003).

You need to have the Matlab software installed and licensed ( Matlab R2009b or later) and the CompEcon toolbox ( to be able to use the models provided.

The Matlab codes of RECS are available to AGRODEP members.

Download the Matlab codes.

The following additional resource is available to AGRODEP members:

First released on
Last version on
Version Number
Use Policy
Free to use, modify and distribute with due credits and citation.