Market prices include the price of hiring labor in and hiring labor out. Make sure that the price
of hiring in is greater than the price of hiring out otherwise the MP model might become
unconstrained. A higher price for hiring in is justified by transaction and monitoring costs.
A special type of prices are ‘future prices’, these are expected selling prices related to
investment activities such as livestock or trees. These, for instance, include milk and meat.
These products cannot be sold in the same year of investment and hence do not add to the
current revenues but only to the future income. Whereas the current prices always enter the
matrix in a pre-determined order as the first activities, the user can determine where the future
prices enter the matrix by specifying an activity index for each entry. Hence, the order in which
they appear in the matrix file does not matter. Activity indices are ideally linked to the matrix-
file so that they are automatically updated when adding activities or constraints to the matrix.
Two types of consumption models can currently be specified: one very basic and one very
complicated model. More intermediate consumption models will be included in the future. The
choice of consumption model should be included in BasicData.xls. If using the extended
consumption model then Matrix.xls needs to include the consumption model in the matrix.
The basic consumption model
When using the basic consumption model, then consumption is handled by simple heuristics
outside the MP model and after the income level has been determined. Buying activities for
food products do therefore not have to be specified in the market file. The basic consumption
model simply specifies how much of the income will be consumed. The remainder will be
added to the agent’s cash endowment and is available for investment in the next period. The
basic model requires specification of three parameters:
1. Extra consumption [proportion]: This is the proportion of each additional monetary unit that
is consumed and ranges between zero and one. If set to zero then no income is consumed
and all is saved; if set to one then all income is consumed and nothing is saved.
2. Minimum consumption per head/year [monetary value]: This value specifies the minimum
amount of income that is consumed by each member of an agent’s household. It must be set
to a positive value.
3. Foregone consumption [monetary value]: In case that income is too low to meet the
consumption specified by (1) and (2) then this value determines the proportion by which the
consumption level is to be reduced. If set to zero then the minimum consumption level is
reduced to zero. If set to one then the consumption is not adjusted downward.
The extended consumption model
If using the extended consumption model then the program uses a three-stage solving procedure
of investment, production, and consumption (the last stage is not needed if using the basic
consumption model). The assumption is that production and consumption decisions are
inseparable because of market imperfections as is typically the case in rural areas of low-income
countries (Sadoulet and de Janvry, 1995). Different from the basic consumption model, that
simply allocates part of the revenues to consumption and the rest to savings, the extended model
implements the consumption decision within the MP model so that production and consumption
decisions are simulated simultaneously. Because the parameters of the extended consumption
model are household-specific its implementation requires much additional input in both the
market- and the matrix-file.
The implemented consumption model itself has a three-step procedure of savings, food/non-
food expenditures, and expenditures on specific categories of food products. The model is
described in Schreinemachers (2006) and Schreinemachers and Berger (2006b). Including this
model requires the estimation of econometric models at each step. The advantage of this model
is that it allows a detailed simulation of food security dynamics. If food security is not much of
an issue and market imperfections are few then the basic consumption model is preferred.
In the first step of the system, agents decide how much of their income to expend and how
much to save. Let the variable SAV be the savings and INC the disposable income, H the
household size measured in an equivalence scale (joules), D the matrix of district dummies, and
a constant term. The amount of savings is specified as a quadratic function of disposable
in which the alfas are the parameters to be estimated. Micro-economic theory suggests that the
share of savings increases with income, which is the case if α2 is positive.
Total expenditure (TEX) is the income available to spend, which is derived from the income
In the second step, agents decide how much of this total expenditure to allocate to food (FEX)
and non-food items (NEX). A modified version of the Working-Leser model quantifies this
relationship (Hazell and Roell 1983):
v β β βln
in which v is the expenditure share on food and the betas are parameters to be estimated. It
follows that the value of food expenditures (FEX) equals TEX*v/100 while NEX can be derived
from the parameter estimates using the properties of symmetry and adding up.
Expenditures of food categories.
In the final step agents decide to spend their food budget on broad categories of food products.
The use of categories instead of individual items gives agents more scope for substitution. The
third step is quantified using a linear approximation of the Almost Ideal Demand System
(LA/AIDS) (Deaton and Muellbauer 1980):
) δ δ H
where the subscripts k and l denote individual food categories of a total of n categories
(k,l=1,2,..,n) and the gammas denote parameters to be estimated. The variable w
is the share of
category k in the total food budget; M is per capita food expenditures measured in an
equivalence scale for household size. P
is an index of prices, which in the original (non-linear)
version has a translog functional form but in its linear version can be replaced by the logarithm
of the Stone geometric price index (Deaton and Muellbauer 1980):
Demography.xls: Population dynamics and labor supply
The age of each household member naturally changes over time. Aging impacts on the
household labor supply and is therefore an important dynamic in the model. Demography.xls
specifies age-specific variables that optionally include, apart from labor supply, mortality,
fertility, and nutritional requirements. Table 15 shows an abstract of this file, for the labor
category of unskilled male labor for the first 4 years.
Labor supply can be estimated from farm household survey data. If the programming matrix
uses an agricultural production function that relates output to labor use, then it is important that
the labor supply is estimated from the same data source. Data on time allocation are typically
inaccurate and variable between surveys. The importance here is not so much to get an accurate
estimate but an estimate that is consistent with the production function used.
Mortality and fertility are specified in terms of the probabilities of dying and giving birth.
Mortality and fertility can be obtained from official statistical sources or demographic studies.
Make sure that the probability of dying at the maximum age is set to unity otherwise the
program might crash.
Table 15 Abstract of the demography file
Food nutrition, such as calories and protein, can be included to quantify food security. This is
only useful in case a detailed food consumption model is included that estimates food
consumption into detail. This consumption model, simulating the nutrient supply, would have to
be specified in Market.xls; while Demography.xls estimates the nutritional demand and the
balance of the two would be an indicator of food security. Food nutrition is location specific and
moreover depends on the intensity of physical activity performed. One possible source of
country-specific default values is James & Schofield (1990).
MPMAS includes additional features that assist the model builder in tracing back changes,
analyzing certain MP models, looking at the results, or solving the model in a stand-alone
version. Each of these options is detailed in the following.
This is a plain text file in which the model builder can keep a diary of changes made to the
model. We previously recommend that the modeler proceeds in a step-wise fashion in which
small changes are made one by one after which the model is solved, the complete file set is
saved, and a copy is used as a basis to make a subsequent change. In this way, the modeler
always has one running version of the model and if the MPMAS reports an error than one can
always go back to this latest running version and try to make the change again, but perhaps in
B. Unskilled male members
Number of different ages (lifespan)
Labor hours / year
Mortality (probability of dying)
Fertility (probability of giving birth)
Energy needs (billion joules/year)
Protein needs (kg/year)
smaller steps. If all changes are well documented in the file <XChanges.txt> then it will be
easier to detect the source of possible errors when these are encountered.
Check matrix files
If an MP model for a particular agent is infeasible then MPMAS saves it with the extension
“.mip” in the folder out/test. The name syntax of saved programming matrices is shown in
Figure 11. In ScenarioManger.xls users can also request MPMAS to save additional matrices,
either by either:
• Specifying the matrix (as a positive number) in the option “Save a matrix […]”
• Specifying the agent ID (as a negative number) in the option “Save a matrix […]”
• Including the flag “-M” in the MPMAS command line will save all matrices
Figure 11 Name syntax of saved MP matrices
The agentID is an integer value that identifies each agent. Note that the numbering does not
start at 0 but at 1. AgentID 0 is reserved for a ‘special agent’: it contains all land that is not
currently allocated to all other agents. This agent does not solve any MP model; it just acts as
storage for the village (or subcatchment). Hence, for each village (or subcatchment) the
remaining land is stored in a separate agent. Because of this procedure the agentID from the
map-file might be different from the agentID used internally by the program, which is only in
the case of multiple villages/subcatchments. It is therefore recommended to adjust the agentID
in the map-file by not assigning the first ID to an agent (for each village/subcatchment).
number of matrix loaded
If a matrix is infeasible then this can indicate one of the following:
(a) there is a problem with some of the input files that update the matrix;
(b) there is a problem in the design of the matrix; or
(c) there is a problem in the source code of the MPMAS.
Most frequently the first or the second option will be the case as the model has been tested
extensively. The produced error matrix has a format similar to the matrix input file in ASCII
format (MILP.dat), except that it has textual remarks for each block of information. It will be
difficult to study the matrix in this format, for which reason the macro “Check matrix files” was
developed. It is accessed through the MPMAS menu bar in ScenarioManager.xls or by using the
shortcut ALT+CTRL+M. It opens a Graphical User Interface that suggests which matrix files
are available from the last model run (Figure 12). The interface offers two options for analyzing
a matrix file. The first is “Solve again”, which takes the matrix file, removes all string values
from the file, saves it under a different name, and solves the file again using an executable
called “MilpCheck.exe”. Three different solving routines are available and if the matrix is
feasible then the solution vector is saved as a separate file.
The other option “Back to Excel” takes the matrix file and copies and pastes its values (matrix
coefficients, bounds, and right-hand-side values) to Matrix.xls saving it under its original name,
but with the extension “.xls”. If the matrix has first been analyzed using “Solve again” then the
solution vector is automatically imported into the file. This option is suitable for analyzing
matrices that were infeasible.
Figure 12 Screenshot of “Check matrix files”
A few tips for finding an error in a programming matrix
To find an error and what causes it can sometimes be a challenge. Here are some tips that could
Find out whether the matrix is an investment model or a production model. The investment
model has a value ‘1’ in the right-hand-side of the first activity (called the investment switch),
which allows investments in perennial crops. If no value ‘1’ appears then the matrix is a
• Check whether all right-hand-side values have positive values
• Check for strange combinations of right-hand-side values:
• Is male or female adult labor zero or very high?
• Is land zero or very high?
• Are livestock numbers very high?
• After finding a ‘suspicious’ value in the programming matrix then change it and try to
In addition, the IBM Solver can help to locate an error in the matrix. Often it is able to point to a
specific cell value (by row and constraint index) that makes the problem infeasible. For this, the
error matrix can be solved using the stand-alone-solver, which is the file MilpCheck.exe..
Model results can be analyzed using standard statistical packages such as STATA, SPSS, or
MATLAB. The file XResults.xls was developed for the default data set to get a quick look
into the results of the model. Figure 13 shows the interface of this file. The file contains VBA
code that imports two types of output files:
these contain the price and solution vector; and
these contain the right-hand-side values and left-hand-side values.
All output files are described in a following section of the manual. In addition to the VBA
importing routine, the file does some simple analyses of a few selected variables using database
functions in Excel. Users can add other types of analyses.
Documents you may be interested
Documents you may be interested