Data Envelopment Analysis (DEA) in MATLAB
Compare DEA implementations in MATLAB with CCR, input- and output-oriented BCC, and the package-specific ratio reported by its Additive routine.

On this page
This package is an open-source MATLAB implementation of Data Envelopment Analysis (DEA). DEA measures the relative efficiency of decision making units (DMUs) from their inputs and outputs. Each efficiency value is found by solving a linear program with linprog.
A DMU can be a bank branch, a hospital, a school or any unit that turns inputs (staff, budget, equipment) into outputs (services, products, graduates). DEA needs no price for the inputs and outputs, and no formula for how outputs depend on inputs. It compares each unit with the best practice found in the data. The radial efficiency scores described here use 1 for the frontier and smaller values for inefficient units, subject to the model and normalization. The Additive routine reports a separate ratio described below.
DEA was introduced by Charnes, Cooper and Rhodes in 1978 (paper (opens in a new tab)). Their model is now called the CCR model.
Models
- CCR
- Input-oriented BCC
- Output-oriented BCC
- Additive
The CCR model
Suppose there are DMUs, each with inputs and outputs. Let be input of DMU and be output of DMU . The efficiency of DMU is the ratio of its weighted outputs to its weighted inputs. DEA chooses the weights that are most favorable to DMU , with the condition that no DMU gets a ratio above 1 with the same weights.
This ratio problem can be written as a linear program. With output weights and input weights , the CCR model for DMU is:
The optimal value is the efficiency of DMU . This is exactly the linear program in GetSingleCCREfficiency.m. One linear program is solved for each DMU.
The CCR model assumes constant returns to scale: if a unit doubles all its inputs, it is expected to double all its outputs.
The other models
- Input-oriented BCC. Banker, Charnes and Cooper (1984, paper (opens in a new tab)) dropped the constant returns to scale assumption and allowed variable returns to scale. In the linear program above, this adds one free variable (positive or negative) to the objective and to every constraint. The input-oriented version asks how much the inputs could shrink while the outputs stay the same.
- Output-oriented BCC. The same frontier, but seen from the output side: how much the outputs could grow with the same inputs. Here the weighted output of DMU is fixed to 1, the weighted input plus a free variable is minimized, and the code reports the inverse of the optimal value as the efficiency.
- Additive. The additive model (Charnes, Cooper, Golany, Seiford and Stutz, 1985) uses the input and output slacks directly, with no input or output orientation. The code solves its multiplier form: it minimizes , with all weights at least 1. It then reports the ratio as the efficiency.
Under the same input orientation and data assumptions, the BCC score is at least as high as the CCR score. Comparing those consistently defined radial scores helps separate technical efficiency from scale effects. The package-specific Additive ratio should not be treated as the standard sum-of-slacks measure.
What is in the download
GetCCREfficiency.m,GetIOBCCEfficiency.m,GetOOBCCEfficiency.mandGetAdditiveEfficiency.mcompute the efficiency of all DMUs for each model.GetSingleCCREfficiency.m,GetSingleIOBCCEfficiency.m,GetSingleOOBCCEfficiency.mandGetSingleAdditiveEfficiency.mcompute the efficiency of one DMU for each model.main.mis an example. It defines input and output data for 12 DMUs, computes the efficiency with all four models and shows the results in a bar chart.
The single DMU functions also return the optimal weights (u and v, and u0 or v0 where the model has them) in a second output. The efficiencies are rounded to four decimals.
How to run
Open main.m in MATLAB and run it. To analyze your own data, replace the input matrix x and the output matrix y. In both matrices, each column is one DMU.
In the example, x has two inputs and y has two outputs, for 12 DMUs. Each row of a matrix is one input or one output. The bar chart shows the four efficiency values of each DMU side by side.
The code calls linprog and optimoptions, which come from MATLAB’s Optimization Toolbox, so it probably needs that toolbox.
Check the result
Check input and output units, missing values, and the direction of each measure before comparing DMUs. Inspect the linear-program solver status as well as the returned score. DEA measures performance relative to the supplied comparison set, not an absolute standard or a causal explanation. The routine labeled Additive converts its solution into a ratio, which differs from the conventional additive slack score. Report that distinction explicitly rather than comparing all four outputs as interchangeable measures.
Applications
DEA is widely used to compare the performance of similar units, for example:
- bank branches,
- hospitals and other health care units,
- schools and universities,
- power plants and other utilities.
The results show which units are efficient. The optimal weights also show which inputs and outputs make each unit look best. Full DEA studies often add the envelopment form of the models, which names the efficient peers of each inefficient unit. This package reports the efficiencies and the weights.
Related posts
Downloads
How to cite
If you use this code or tutorial in your work, articles or publications, please cite it.
Mostapha Kalami Heris, Data Envelopment Analysis (DEA) in MATLAB (YPAP114), Yarpiz, 2015. https://yarpiz.com/data-envelopment-analysis-ypap114@misc{yarpiz-ypap114,
author = {{Mostapha Kalami Heris}},
title = {{Data Envelopment Analysis (DEA) in MATLAB}},
howpublished = {Yarpiz},
year = {2015},
note = {Code YPAP114},
url = {https://yarpiz.com/data-envelopment-analysis-ypap114}
}Published Updated
Comments