Vous êtes sur la page 1sur 3

## R code to illustrate data envelopment analysis

## Install a DEA package. When asked to select a CRAN mirror,


## scroll down to find a nearby mirror, such as USA (MA).
install.packages("nonparaeff")
## Load the package
library(nonparaeff)
## Example 1: one output and one input
## Load data on DMUs' outputs and inputs. Putting the command in
parentheses
## causes the object created to be displayed.
(YXtable = read.table("out1in1.txt"))
## Make the variables in YXtable accessible to R
attach(YXtable)
## Plot the data
plot(x,y)
## prepare data for use by nonparaeff (outputs listed before inputs)
tab11.dat = data.frame(y, x)
## Assuming a free disposal hull (fdh), implement an input-oriented analysis
## (orientation 1).
(fdhio11 = fdh(tab11.dat, noutput=1, orientation=1))
## Still assuming a free disposal hull, implement an output-oriented analysis
## (orientation 2).
(fdhoo11 = fdh(tab11.dat, noutput=1, orientation=2))
## With the output-orientation, nonparaeff calculates the factor by which
## a DMU could increase its output without needing additional inputs. The
## reciprocal of this factor is output-oriented technical efficiency.
1/fdhoo11

## Assuming a convex hull with variable returns to scale (rts=2), implement


an
## input-oriented analysis.
(vrio11 = dea(tab11.dat, noutput=1, orientation=1, rts=2))
## In table printed by the preceding command, eff is pure input-oriented
## technical efficiency. (It is pure in the sense of measuring efficiency
## conditional on the scale of production--that is, ignoring any
## inefficiency due to scale.
## Still assuming variable returns to scale, do an output-oriented analysis.
(vroo11 = dea(tab11.dat, noutput=1, orientation=2, rts=2))
1/vroo11$eff
## Assuming constant returns to scale (rts=1), do an input-oriented analysis.
(crio11 = dea(tab11.dat, noutput=1, orientation=1, rts=1))
## Maintaining the CRS assumption, do an output-oriented analysis.
(croo11 = dea(tab11.dat, noutput=1, orientation=2, rts=1))
1/croo11$eff
## Calculate input-oriented scale efficiency.
(seio11 = crio11$eff/vrio11$eff)
## Calculate output-oriented scale efficiency.
(seoo11 = (1/croo11$eff)/(1/vroo11$eff))

## Example 2: one output and two inputs


## Load data on DMUs' outputs and inputs.
(QKLtable = read.table("out1in2.txt"))
## Make the variables in YXtable accessible to R
attach(QKLtable)
## prepare data for use by nonparaeff (outputs listed before inputs)

tab12.dat = data.frame(Q, K, L)
## ## Assuming a convex hull with variable returns to scale, implement an
## input-oriented analysis.
(vrio12 = dea(tab12.dat, noutput=1, orientation=1, rts=2))

## Example 3: two outputs and two inputs


## Load data on DMUs' outputs and inputs
(YZKLtable = read.table("out2in2.txt"))
attach(YZKLtable)
## prepare data for use by nonparaeff (outputs listed before inputs)
tab22.dat = data.frame(Y, Z, K, L)
## ## Assuming a convex hull with constant returns to scale, implement an
## input-oriented analysis.
(crio22 = dea(tab22.dat, noutput=2, orientation=1, rts=1))

Vous aimerez peut-être aussi