Applications

Data Envelopment Analysis (DEA) in MATLAB

Get the code
Comments

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

Illustration for Data Envelopment Analysis (DEA) in MATLAB
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 KK DMUs, each with mm inputs and nn outputs. Let xjkx_{jk} be input jj of DMU kk and yiky_{ik} be output ii of DMU kk. The efficiency of DMU kk is the ratio of its weighted outputs to its weighted inputs. DEA chooses the weights that are most favorable to DMU kk, 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 uiu_i and input weights vjv_j, the CCR model for DMU kk is:

max⁡u,v∑i=1nui yiksubject to∑j=1mvj xjk=1∑i=1nui yil−∑j=1mvj xjl≤0,l=1,…,Kui≥0,vj≥0\begin{aligned} \max_{u, v} \quad & \sum_{i=1}^{n} u_i \, y_{ik} \\ \text{subject to} \quad & \sum_{j=1}^{m} v_j \, x_{jk} = 1 \\ & \sum_{i=1}^{n} u_i \, y_{il} - \sum_{j=1}^{m} v_j \, x_{jl} \le 0, \qquad l = 1, \dots, K \\ & u_i \ge 0, \quad v_j \ge 0 \end{aligned}

The optimal value is the efficiency of DMU kk. 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 u0u_0 (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 kk is fixed to 1, the weighted input plus a free variable v0v_0 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 ∑jvjxjk−∑iuiyik+v0\sum_j v_j x_{jk} - \sum_i u_i y_{ik} + v_0, with all weights at least 1. It then reports the ratio ∑iuiyik/(∑jvjxjk+v0)\sum_i u_i y_{ik} / (\sum_j v_j x_{jk} + v_0) 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.m and GetAdditiveEfficiency.m compute the efficiency of all DMUs for each model.
  • GetSingleCCREfficiency.m, GetSingleIOBCCEfficiency.m, GetSingleOOBCCEfficiency.m and GetSingleAdditiveEfficiency.m compute the efficiency of one DMU for each model.
  • main.m is 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.

Downloads

How to cite

If you use this code or tutorial in your work, articles or publications, please cite it.

Plain text
Mostapha Kalami Heris, Data Envelopment Analysis (DEA) in MATLAB (YPAP114), Yarpiz, 2015. https://yarpiz.com/data-envelopment-analysis-ypap114
BibTeX
@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}
}

Comments

Sign in or create a free account to join the discussion. No password needed.