dealib.dea.core package

dealib.dea.core._dea.dea

dealib.dea.core._dea.dea(x: Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], y: Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], *, rts: Union[int, str, dealib.dea.utils.options.RTS] = RTS.vrs, orientation: Union[int, str, dealib.dea.utils.options.Orientation] = Orientation.input, xref: Optional[Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]]] = None, yref: Optional[Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]]] = None, direct: Optional[Union[str, float, List[float], List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]]] = None, two_phase: bool = False, transpose: bool = False) dealib.dea.utils.wrappers.Efficiency

Estimates a DEA frontier and calculates Farrell efficiency measures.

Parameters
  • x (2-d array) – Inputs of firm to be evaluated. (k, m) matrix of observations of k firms with m inputs. In case transpose=True the input matrix is transposed.

  • y (2-d array) – Outputs of firm to be evaluated. (k, n) matrix of observations of k firms with n outputs. In case transpose=True the output matrix is transposed.

  • rts (int, str, RTS) –

    Returns to scale assumption.

    0 vrs - Variable returns to scale

    1 crs - Constant returns to scale

    2 drs - Decreasing returns to scale

    3 irs - Increasing returns to scale

  • orientation (int, str, Orientation) –

    Efficiency orientation.

    0 input - Input efficiency

    1 output - Output efficiency

  • xref (2-d array) – Inputs of the firms determining the technology, defaults to x.

  • yref (2-d array) – Outputs of the firms determining the technology, defaults to y.

  • direct (float, 1-d array, 2-d array) – Directional efficiency, direct is either a scalar, an array, or a matrix with nonnegative elements.

  • two_phase (bool) – Flag determining slack optimization either one or two phase.

  • transpose (bool) – Flag determining if input and output matrix are transposed. See x, y.

Returns

Result efficiency object.

Return type

Efficiency

Example

>>> x = [[20], [40], [40], [40], [60], [70], [50]]
>>> y = [[20], [30], [50], [40], [60], [20]]
>>> eff = dea(x, y, rts="vrs", orientation="input")
>>> print(eff.eff)
[1.         0.66666667 1.         0.55555556 1.         0.4       ]

dealib.dea.core._add.add

dealib.dea.core._add.add(x: Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], y: Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], *, rts: Union[int, str, dealib.dea.utils.options.RTS] = RTS.vrs, xref: Optional[Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]]] = None, yref: Optional[Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]]] = None, transpose: Optional[bool] = False) dealib.dea.utils.wrappers.Efficiency

Calculates additive efficiency as sum of input and output slacks.

Parameters
  • x (2-d array) – Inputs of firm to be evaluated. (k, m) matrix of observations of k firms with m inputs. In case transpose=True the input matrix is transposed.

  • y (2-d array) – Outputs of firm to be evaluated. (k, n) matrix of observations of k firms with n outputs. In case transpose=True the output matrix is transposed.

  • rts (int, str, RTS) –

    Returns to scale assumption.

    0 vrs - Variable returns to scale

    1 crs - Constant returns to scale

    2 drs - Decreasing returns to scale

    3 irs - Increasing returns to scale

  • xref (2-d array) – Inputs of the firms determining the technology, defaults to x.

  • yref (2-d array) – Outputs of the firms determining the technology, defaults to y.

  • transpose (bool) – Flag determining if input and output matrix are transposed. See x, y.

Returns

Result efficiency object.

Return type

Efficiency

Example

>>> x = [[20], [40], [40], [40], [60], [70], [50]]
>>> y = [[20], [30], [50], [40], [60], [20]]
>>> eff = add(x, y, rts="vrs")
>>> print(eff.objval)
[ 5.  20.   0.  35.  27.5 42.5]

dealib.dea.core._direct.direct

dealib.dea.core._direct.direct(x: Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], y: Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], direct_: Union[str, float, List[float], List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], *, rts: Union[int, str, dealib.dea.utils.options.RTS] = RTS.vrs, orientation: Union[int, str, dealib.dea.utils.options.Orientation] = Orientation.input, xref: Optional[Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]]] = None, yref: Optional[Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]]] = None, two_phase: bool = False, transpose: bool = False)

Estimates a DEA frontier and calculates directional efficiency measures.

Parameters
  • x (2-d array) – Inputs of firm to be evaluated. (k, m) matrix of observations of k firms with m inputs. In case transpose=True the input matrix is transposed.

  • y (2-d array) – Outputs of firm to be evaluated. (k, n) matrix of observations of k firms with n outputs. In case transpose=True the output matrix is transposed.

  • direct (float, 1-d array, 2-d array) – Directional efficiency, direct is either a scalar, an array, or a matrix with nonnegative elements.

  • rts (int, str, RTS) –

    Returns to scale assumption.

    0 vrs - Variable returns to scale

    1 crs - Constant returns to scale

    2 drs - Decreasing returns to scale

    3 irs - Increasing returns to scale

  • orientation (int, str, Orientation) –

    Efficiency orientation.

    0 input - Input efficiency

    1 output - Output efficiency

  • xref (2-d array) – Inputs of the firms determining the technology, defaults to x.

  • yref (2-d array) – Outputs of the firms determining the technology, defaults to y.

  • two_phase (bool) – Flag determining slack optimization either one or two phase.

  • transpose (bool) – Flag determining if input and output matrix are transposed. See x, y.

Returns

Result efficiency object.

Return type

Efficiency

Example

>>> x = [[20], [40], [40], [40], [60], [70], [50]]
>>> y = [[20], [30], [50], [40], [60], [20]]
>>> eff = direct(x, y, 0.5, rts="vrs", orientation="input")
>>> print(eff.eff)
[1.         0.66666667 1.         0.55555556 1.         0.4       ]

dealib.dea.core._slack.slack

dealib.dea.core._slack.slack(x: Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], y: Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], e: dealib.dea.utils.wrappers.Efficiency, *, xref: Optional[Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]]] = None, yref: Optional[Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]]] = None, transpose: Optional[bool] = False) dealib.dea.utils.wrappers.Efficiency

Estimats a DEA frontier and optimize slacks.

Parameters
  • x (2-d array) – Inputs of firm to be evaluated. (k, m) matrix of observations of k firms with m inputs. In case transpose=True the input matrix is transposed.

  • y (2-d array) – Outputs of firm to be evaluated. (k, n) matrix of observations of k firms with n outputs. In case transpose=True the output matrix is transposed.

  • e (Efficiency) – Efficiency object returned by dea, add, direct, mea.

  • xref (2-d array) – Inputs of the firms determining the technology, defaults to x.

  • yref (2-d array) – Outputs of the firms determining the technology, defaults to y.

  • transpose (bool) – Flag determining if input and output matrix are transposed. See x, y.

Returns

Result efficiency object.

Return type

Efficiency

Example

>>> x = [[1, 5], [2, 2], [4, 1], [6, 1], [4, 4]]
>>> y = [[2], [2], [2], [2], [2]]
>>> e = dea(x, y, rts="vrs", orientation="input")
>>> eff = slack(x, y, e)
>>> print(eff.slack)
    [[0. 0. 0.]
     [0. 0. 0.]
     [0. 0. 0.]
     [2. 0. 0.]
     [0. 0. 0.]]

dealib.dea.core._mea.mea

dealib.dea.core._mea.mea(x: Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], y: Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], rts: Union[int, str, dealib.dea.utils.options.RTS] = RTS.vrs, orientation: Union[int, str, dealib.dea.utils.options.Orientation] = Orientation.input, xref: Optional[Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]]] = None, yref: Optional[Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]]] = None, transpose: bool = False) dealib.dea.utils.wrappers.Efficiency

Estimates a DEA frontier and calculates multi-directional Farrell measures.

Parameters
  • x (2-d array) – Inputs of firm to be evaluated. (k, m) matrix of observations of k firms with m inputs. In case transpose=True the input matrix is transposed.

  • y (2-d array) – Outputs of firm to be evaluated. (k, n) matrix of observations of k firms with n outputs. In case transpose=True the output matrix is transposed.

  • rts (int, str, RTS) –

    Returns to scale assumption.

    0 vrs - Variable returns to scale

    1 crs - Constant returns to scale

    2 drs - Decreasing returns to scale

    3 irs - Increasing returns to scale

  • orientation (int, str, Orientation) –

    Efficiency orientation.

    0 input - Input efficiency

    1 output - Output efficiency

  • xref (2-d array) – Inputs of the firms determining the technology, defaults to x.

  • yref (2-d array) – Outputs of the firms determining the technology, defaults to y.

  • transpose (bool) – Flag determining if input and output matrix are transposed. See x, y.

Returns

Result efficiency object.

Return type

Efficiency

Example

>>> x = [[20], [40], [40], [40], [60], [70], [50]]
>>> y = [[20], [30], [50], [40], [60], [20]]
>>> eff = mea(x, y, rts="vrs", orientation="input")
>>> print(eff.eff)
[0. 1. 0. 1. 0. 1.]

dealib.dea.core._sdea.sdea

dealib.dea.core._sdea.sdea(x: Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], y: Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], rts: Union[int, str, dealib.dea.utils.options.RTS] = RTS.vrs, orientation: Union[int, str, dealib.dea.utils.options.Orientation] = Orientation.input, direct: Optional[Union[str, float, List[float], List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]]] = None, transpose: bool = False) dealib.dea.utils.wrappers.Efficiency

Estimates a DEA frontier and calcilates super-efficiency measures.

Parameters
  • x (2-d array) – Inputs of firm to be evaluated. (k, m) matrix of observations of k firms with m inputs. In case transpose=True the input matrix is transposed.

  • y (2-d array) – Outputs of firm to be evaluated. (k, n) matrix of observations of k firms with n outputs. In case transpose=True the output matrix is transposed.

  • rts (int, str, RTS) –

    Returns to scale assumption.

    0 vrs - Variable returns to scale

    1 crs - Constant returns to scale

    2 drs - Decreasing returns to scale

    3 irs - Increasing returns to scale

  • orientation (int, str, Orientation) –

    Efficiency orientation.

    0 input - Input efficiency

    1 output - Output efficiency

  • direct (float, 1-d array, 2-d array) – Directional efficiency, direct is either a scalar, an array, or a matrix with nonnegative elements.

  • transpose (bool) – Flag determining if input and output matrix are transposed. See x, y.

Returns

Result efficiency object.

Return type

Efficiency

Example

>>> x = [[20], [40], [40], [40], [60], [70], [50]]
>>> y = [[20], [30], [50], [40], [60], [20]]
>>> eff = sdea(x, y, rts="vrs", orientation="input")
>>> print(eff.eff)
[2.         0.66666667 1.4375     0.55555556 0.66666667 0.4       ]

dealib.dea.core._malmq.malmq

dealib.dea.core._malmq.malmq(x0: Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], y0: Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], x1: Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], y1: Union[List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]], *, rts: Union[int, str, dealib.dea.utils.options.RTS] = RTS.vrs, orientation: Union[int, str, dealib.dea.utils.options.Orientation] = Orientation.input, direct: Optional[Union[str, float, List[float], List[List[float]], numpy.ndarray[Any, numpy.dtype[float]]]] = None, transpose: bool = False) dealib.dea.utils.wrappers.Malmquist

Estimates Malmquist indices between two periods.

Parameters
  • x0 (2-d array) – Inputs of firm to be evaluated. (k, m) matrix of observations of k firms with m inputs. In case transpose=True the input matrix is transposed.

  • y0 (2-d array) – Outputs of firm to be evaluated. (k, n) matrix of observations of k firms with n outputs. In case transpose=True the output matrix is transposed.

  • x1 (2-d array) – Inputs of firm to be evaluated. (k, m) matrix of observations of k firms with m inputs. In case transpose=True the input matrix is transposed.

  • y1 (2-d array) – Outputs of firm to be evaluated. (k, n) matrix of observations of k firms with n outputs. In case transpose=True the output matrix is transposed.

  • rts (int, str, RTS) –

    Returns to scale assumption.

    0 vrs - Variable returns to scale

    1 crs - Constant returns to scale

    2 drs - Decreasing returns to scale

    3 irs - Increasing returns to scale

  • orientation (int, str, Orientation) –

    Efficiency orientation.

    0 input - Input efficiency

    1 output - Output efficiency

  • direct (float, 1-d array, 2-d array) – Directional efficiency, direct is either a scalar, an array, or a matrix with nonnegative elements.

  • transpose (bool) – Flag determining if input and output matrix are transposed. See x0, y0, x1, y1.

Returns

Result malmquist object.

Return type

Malmquist

Example

>>> x0 = [[10], [28], [30], [60]]
>>> y0 = [[5], [7], [10], [15]]
>>> x1 = [[12], [26], [16], [60]]
>>> y1 = [[6], [8], [9], [15]]
>>> ma = malmq(x0, y0, x1, y1)
>>> print(ma.m)
[0.9860133  1.24869426 1.44543617 1.        ]