59
Package ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA Version 0.26 Date 2015-7-8 ($Date: 2015-07-08 12:32:10 +0200 (on, 08 jul 2015) $) Author Peter Bogetoft and Lars Otto Maintainer Lars Otto <[email protected]> Depends lpSolveAPI, ucminf Imports methods, stats, graphics, grDevices Description Methods for frontier analysis, Data Envelopment Analysis (DEA), under different technology assumptions (fdh, vrs, drs, crs, irs, add/frh, and fdh+), and using different efficiency measures (input based, output based, hyperbolic graph, additive, super, and directional efficiency). Peers and slacks are available, partial price information can be included, and optimal cost, revenue and profit can be calculated. Evaluation of mergers is also supported. Methods for graphing the technology sets are also included. There is also support comparative methods based on Stochastic Frontier Analyses (SFA). In general, the methods can be used to solve not only standard models, but also many other model variants. It complements the book, Bogetoft and Otto, Benchmarking with DEA, SFA, and R, Springer-Verlag, 2011, but can of course also be used as a stand-alone package. License GPL (>= 2) LazyLoad yes NeedsCompilation no Repository CRAN Date/Publication 2015-07-08 17:44:18 R topics documented: Benchmarking-package ................................... 2 1

Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

Embed Size (px)

Citation preview

Page 1: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

Package ‘Benchmarking’July 8, 2015

Type Package

Title Benchmark and Frontier Analysis Using DEA and SFA

Version 0.26

Date 2015-7-8 ($Date: 2015-07-08 12:32:10 +0200 (on, 08 jul 2015) $)

Author Peter Bogetoft and Lars Otto

Maintainer Lars Otto <[email protected]>

Depends lpSolveAPI, ucminf

Imports methods, stats, graphics, grDevices

Description Methods for frontieranalysis, Data Envelopment Analysis (DEA), under differenttechnology assumptions (fdh, vrs, drs, crs, irs, add/frh, and fdh+),and using different efficiency measures (input based, output based,hyperbolic graph, additive, super, and directional efficiency). Peersand slacks are available, partial price information can be included,and optimal cost, revenue and profit can be calculated. Evaluation ofmergers is also supported. Methods for graphing the technology setsare also included. There is also support comparative methods basedon Stochastic Frontier Analyses (SFA). In general, the methods can beused to solve not only standard models, but also many other modelvariants. It complements the book, Bogetoft and Otto,Benchmarking with DEA, SFA, and R, Springer-Verlag, 2011, but can ofcourse also be used as a stand-alone package.

License GPL (>= 2)

LazyLoad yes

NeedsCompilation no

Repository CRAN

Date/Publication 2015-07-08 17:44:18

R topics documented:Benchmarking-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1

Page 2: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

2 Benchmarking-package

charnes1981 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5cost.opt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7critValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10dea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11dea.add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15dea.boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17dea.direct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20dea.dual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24dea.merge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26dea.plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28eff, efficiencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31eff.dens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33eladder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34excess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36lambda . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37make.merge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38mea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40milkProd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42norWood2004 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43outlier.ap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44peers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45pigdata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47projekt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48sdea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49sfa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51slack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54typeIerror . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

Index 58

Benchmarking-package Data Envelopment Analyses (DEA) and Stochastic Frontier Analyses(SFA) – Model Estimations and Efficiency Measuring

Description

The Benchmarking package contains methods to estimate technologies and measure efficienciesusing DEA and SFA. Data Envelopment Analysis (DEA) are supported under different technologyassumptions (fdh, vrs, drs, crs, irs, add), and using different efficiency measures (input based, outputbased, hyperbolic graph, additive, super, directional). Peers are available, partial price informationcan be included, and optimal cost, revenue and profit can be calculated. Evaluation of mergers arealso supported. A comparative method for estimating stochastic frontier function (SFA) efficienciesis included. The methods can solve not only standard models, but also many other model variants,and they can be modified to solve new models.

The package also support simple plots of DEA technologies with two goods; either as a transforma-tion curve (2 outputs), an isoquant (2 inputs), or a production function (1 input and 1 output). Whenmore inputs and outputs are available they are aggregated using weights (prices, relative prices).

Page 3: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

Benchmarking-package 3

The package complements the book, Bogetoft and Otto, Benchmarking with DEA, SFA, and R,Springer-Verlag 2011, but can of course also be used as a stand-alone package.

Details

Package: BenchmarkingType: PackageVersion: 0.26 ($Revision: 152 $)Date: $Date: 2015-07-07 12:02:02 +0200 (ti, 07 jul 2015) $License: Copyright

dea DEA input or output efficience measures, peers, lambdas and slacksdea.dual Dual weights (prices), including restrictions on weightsdea.direct Directional efficiencysdea Super efficiency.dea.add Additive efficiency; sum of slacks in DEA technology.mea Multidirectional efficiency analysis or potential improvements.eff Efficiency from an object returned from any of the dea or sfa functions.slack Slacks in DEA modelsexcess Calculates excess input or output compared to DEA frontier.peers get the peers for each firm.dea.boot Bootstrap DEA modelscost.opt Optimal input for given output and prices.revenue.opt Optimal output for given input and prices.profit.opt Optimal input and output for given input and output prices.dea.plot Graphs of DEA technologies under alternative technology assumptions.dea.plot.frontier Specialized for 1 input and 1 output.dea.plot.isoquant Specialized for 2 inputs.dea.plot.transform Specialized for 2 outputs.eladder Efficiency ladder for a single firm.eladder.plot Plot efficiency ladder for a single firm.make.merge Make an aggregation matrix to perform mergers.dea.merge Decompose efficiency from a merger of firmssfa Stochastic frontier analysis, production, distance, and cost function (SFA)outlier.ap Detection of outlierseff.dens Estimate and plot kernel density of efficienciescritValue Critical values calculated from bootstrap DEA models.typeIerror Probability of a type I error for a test in bootstrap DEA models.

Note

The interface for the methods are very much like the interface to the methods in the package FEAR(Wilson 2008). One change is that the data now are transposed to reflect how data is usually avail-

Page 4: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

4 Benchmarking-package

able in applications, i.e. we have firms on rows, and inputs and output in the columns. Also, theargument for the options RTS and ORIENTATION can be given as memotechnical strings, and thereare more options to control output.

The input and output matrices can contain negative numbers, and the methods can thereby managerestricted or fixed input or output.

The return is not just the efficiency, but also slacks, dual values (shadow prices), peers, and lambdas(weights).

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

References

Bogetoft and Otto; Benchmarking with DEA, SFA, and R; Springer 2011

Paul W. Wilson (2008), “FEAR 1.0: A Software Package for Frontier Efficiency Analysis with R,”Socio-Economic Planning Sciences 42, 247–254

Examples

# Plot of different technologiesx <- matrix(c(100,200,300,500),ncol=1,dimnames=list(LETTERS[1:4],"x"))y <- matrix(c(75,100,300,400),ncol=1,dimnames=list(LETTERS[1:4],"y"))dea.plot(x,y,RTS="vrs",ORIENTATION="in-out",txt=rownames(x))dea.plot(x,y,RTS="drs",ORIENTATION="in-out",add=TRUE,lty="dashed",lwd=2)dea.plot(x,y,RTS="crs",ORIENTATION="in-out",add=TRUE,lty="dotted")

dea.plot(x,y,RTS="fdh",ORIENTATION="in-out",txt=rownames(x),main="fdh")dea.plot(x,y,RTS="irs",ORIENTATION="in-out",txt=TRUE,main="irs")dea.plot(x,y,RTS="irs2",ORIENTATION="in-out",txt=rownames(x),main="irs2")dea.plot(x,y,RTS="add",ORIENTATION="in-out",txt=rownames(x),main="add")

# A quick frontier with 1 input and 1 outputdea.plot(x,y, main="Basic plot of frontier")

# Calculating efficiencydea(x,y, RTS="vrs", ORIENTATION="in")e <- dea(x,y, RTS="vrs", ORIENTATION="in")eeff(e)peers(e)peers(e, NAMES=TRUE)print(peers(e, NAMES=TRUE), quote=FALSE)lambda(e)summary(e)

# Calculating super efficiencyesuper <- sdea(x,y, RTS="vrs", ORIENTATION="in")esuperprint(peers(esuper,NAMES=TRUE),quote=FALSE)

Page 5: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

charnes1981 5

# Technology for super efficiency for firm number 3/C# Note that drop=FALSE is necessary for XREF and YREF to be matrices# when one of the dimensions is or is reduced to 1.e3 <- dea(x,y, XREF=x[-3,,drop=FALSE], YREF=y[-3,,drop=FALSE])dea.plot(x[-3],y[-3],RTS="vrs",ORIENTATION="in-out",txt=LETTERS[c(1,2,4)])points(x[3],y[3],cex=2)text(x[3],y[3],LETTERS[3],adj=c(-.75,.75))e3 <- dea(x,y, XREF=x[-3,,drop=FALSE], YREF=y[-3,,drop=FALSE])eff(e3)peers(e3)print(peers(e3,NAMES=TRUE),quote=FALSE)lambda(e3)e3$lambda

# Taking care of slacksx <- matrix(c(100,200,300,500,100,600),ncol=1,

dimnames=list(LETTERS[1:6],"x"))y <- matrix(c(75,100,300,400,50,400),ncol=1,

dimnames=list(LETTERS[1:6],"y"))

# Phase one, calculate efficiencye <- dea(x,y)print(e)peers(e)lambda(e)# Phase two, calculate slacks (maximize sum of slacks)sl <- slack(x,y,e)data.frame(sl$sx,sl$sy)peers(sl)lambda(sl)sl$lambdasummary(sl)

# The two phases in one function calle2 <- dea(x,y,SLACK=TRUE)print(e2)data.frame(eff(e2),e2$slack,e2$sx,e2$sy,lambda(e2))peers(e2)lambda(e2)e2$lambda

charnes1981 Data: Charnes et al. (1981): Program follow through

Description

The data set is from an US federally sponsored program for providing remedial assistance to disad-vantaged primary school students. The firms are 70 school sites, and data are from entire sites. Thevariables consists of results from three different kind of tests, a reading score, y1, a math score, y2,and a self–esteem score, y3, which are considered outputs in the model, and five different variables

Page 6: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

6 charnes1981

considered to be inputs, the education level of the mother, x1, the highest occupation of a familymember, x2, parental visits to school, x3, time spent with children in school-related topics, x4, andthe number of teachers at the site, x5.

Usage

data(charnes1981)

Format

A data frame with 70 school sites with the following variables.

firm school site number

x1 education level of the mother

x2 highest occupation of a family member

x3 parental visits to school

x4 time spent with children in school-related topics

x5 the number of teachers at the site

y1 reading score

y2 math score

y3 self–esteem score

pft =1 if in program (program follow through) and =0 if not in program

name Site name

Details

The command data(charnes1981) will create a data frame named charnes1981 with the abovedata.

Beside input and output varianles there is further information in the data set, that the first 50 schoolsites followed the program and that the last 20 are the results for sites not following the program.This is showed by the variable pft.

Note

Data as .csv are loaded by the command data using read.table(..., header=TRUE, sep=";")such that this file is a semicolon separated file and not a comma separated file.

Therefore, to read the file from a script the command must be read.csv("charnes1981.csv", sep=";")or read.csv2("charnes1981.csv").

Thus the data can be read either as charnes1981 <-read.csv2(paste(.Library, "Benchmarking/data","charnes1981.csv", sep ="/"))or as data(charnes1981) if the package Benchmarking is loaded. In both cases the data will bein the data frame charnes1981.

Page 7: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

cost.opt 7

Source

Charnes, Cooper, and Rhodes, “Evaluating Program and Managerial Efficiency: An Applicationof Data Envelopment Analysis to Program Follow Through”, Management Science, volume 27,number 6, June 1981, pages 668–697.

Examples

data(charnes1981)x <- with(charnes1981, cbind(x1,x2,x3,x4,x5))y <- with(charnes1981, cbind(y1,y2,y3))

# Farrell inpout efficiency; vrs technologye <- dea(x,y)# The number of times each peer is a peernp <- get.number.peers(e)# Peers that are peers for more than 20 schools, and the number of# times they are peersnp[which(np[,2]>20),]

# Plot first input against first output and emphasize the peers that# are peers for more than 20 schools in the model with five inputs and# three outputsinp <- np[which(np[,2]>20),1]dea.plot(x[,1],y[,1])points(x[inp,1], y[inp,1], pch=16, col="red")

cost.opt DEA optimal cost, revenue, and profit

Description

Estimates the input and/or output vector(s) that minimize cost, maximize revenue or maximize profitin the context of a DEA technology

Usage

cost.opt(XREF, YREF, W, YOBS=NULL, RTS="vrs", param=NULL,TRANSPOSE=FALSE, LP=FALSE, LPK = NULL)

revenue.opt(XREF, YREF, P, XOBS=NULL, RTS="vrs", param=NULL,TRANSPOSE = FALSE, LP = FALSE, LPK = NULL)

profit.opt(XREF, YREF, W, P, RTS = "vrs", param=NULL,TRANSPOSE = FALSE, LP = FALSE, LPK = NULL)

Page 8: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

8 cost.opt

Arguments

Input and output matrices are in the same form as for the method dea.

XREF Input of the firms defining the technology, a K x m matrix of observations of Kfirms with m inputs (firm x input). In case TRANSPOSE=TRUE the input matrix istransposed as input x firm.

YREF output of the firms defining the technology, a K x n matrix of observations of Kfirms with n outputs (firm x input). In case TRANSPOSE=TRUE the output matrixis transposed as output x firm.

W Input prices as a matrix. Either same prices for all firms or individual prices forall firms; i.e. either a 1 x m or a K x m matrix for K firms and m inputs

P Output prices as a matrix. Either same prices for all firms or individual pricesfor all firms; i.e. either a 1 x n or K x n matrix for K firms and n outputs

XOBS The input for which an optimal, revenue maximizing, output vector is to becalculated. Defaults is XREF. Same form as XREF

YOBS The output for which an optimal, cost minimizing input vector is to be calcu-lated. Defaults is YREF. Same form as YREF

RTS A text string or a number defining the underlying DEA technology / returns toscale assumption.

0 fdh Free disposability hull, no convexity assumption1 vrs Variable returns to scale, convexity and free disposability2 drs Decreasing returns to scale, convexity, down-scaling and free disposability3 crs Constant returns to scale, convexity and free disposability4 irs Increasing returns to scale, (up-scaling, but not down-scaling), convexity and free disposability5 add Additivity (scaling up and down, but only with integers), and free disposability6 fdh+ A combination of free disposability and restricted or local constant return to scale

param Possible parameters. At the moment only used for RTS="fdh+" to set low andhigh values for restrictions on lambda; see the section details and examples indea for its use. Future versions might also use param for other purposes.

TRANSPOSE Input and output matrices are treated as firms times goods for the default valueTRANSPOSE=FALSE corresponding to the standard in R for statistical models.When TRUE data matrices, quantities and prices, are transposed to goods timesfirms matrices.

LP Only for debugging. If LP=TRUE then input and output for the LP program arewritten to standard output for each unit.

LPK When LPK=k then a mps file is written for firm k; it can be used as input to analternative LP solver to check the results.

Details

The LP optimization problem is formulated in Bogetoft and Otto (2011, pp 35 and 102) and issolved by the LP method in the package lpSolveAPI.

The methods print and summary are working for cost.opt, revenue.opt, and profit.opt

Page 9: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

cost.opt 9

Value

The values returned are the optimal input, and/or optimal output. When saved in an object thefollowing components are available:

xopt The optimal input, returned as a matrix by cost.opt and profit.cost.

yopt The optimal output, returned as a matrix by revenue.opt and profit.cost.

cost The optimal/minimal cost.

revenue The optimal/maximal revenue

profit The optimal/maximal profit

lambda The peer weights that determines the technology, a matrix. Each row is thelambdas for the firm corresponding to that row; for the vrs technology the rowssum to 1. A column shows for a given firm how other firms are compared to thisfirm; i.e. peers are firms with a positive element in their columns.

Note

The index for peer units can be returned by the method peers and the weights are returned inlambda. Note that the peers now are the firms for the optimal input and/or output allocation, notjust the technical efficient firms.

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

References

Bogetoft and Otto; Benchmarking with DEA, SFA, and R; Springer 2011

See Also

Paul W. Wilson (2008), “FEAR 1.0: A Software Package for Frontier Efficiency Analysis with R,”Socio-Economic Planning Sciences 42, 247–254

Examples

x <- matrix(c(2,12, 2,8, 5,5, 10,4, 10,6, 3,13), ncol=2, byrow=TRUE)y <- matrix(1,nrow=dim(x)[1],ncol=1)w <- matrix(c(1.5, 1),ncol=2)

txt <- LETTERS[1:dim(x)[1]]dea.plot(x[,1],x[,2], ORIENTATION="in", cex=1.25)text(x[,1],x[,2],txt,adj=c(-.7,-.2),cex=1.25)

# technical efficiencyte <- dea(x,y,RTS="vrs")xopt <- cost.opt(x,y,w,RTS=1)cobs <- x %*% t(w)copt <- xopt$x %*% t(w)

Page 10: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

10 critValue

# cost efficiencyce <- copt/cobs# allocaltive efficiencyae <- ce/te$effdata.frame("ce"=ce,"te"=te$eff,"ae"=ae)print(cbind("ce"=c(ce),"te"=te$eff,"ae"=c(ae)),digits=2)

# isocost line in the technology plotabline(a=copt[1]/w[2], b=-w[1]/w[2], lty="dashed")

critValue Critical values from bootstrapped DEA models

Description

Calculates critical value for test using bootstrap output in DEA models

Usage

critValue(s, alpha=0.05)

Arguments

s Vector with calculated values of the statistic for each of the NREP bootstraps;NREP is from boot.sw98

alpha The size of the test

Details

Needs bootstrapped values of the test statistic

Value

Returns the critical value

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

See Also

boot.sw98 in FEAR, Paul W. Wilson (2008), “FEAR 1.0: A Software Package for Frontier Effi-ciency Analysis with R,” Socio-Economic Planning Sciences 42, 247–254

Examples

# The critical value for two-sided test in normal distribution found# by simulation.x <- rnorm(1000000)critValue(x,.975)

Page 11: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

dea 11

dea DEA efficiency

Description

Estimates a DEA frontier and calculates efficiency measures a la Farrell.

Usage

dea(X, Y, RTS="vrs", ORIENTATION="in", XREF=NULL, YREF=NULL,FRONT.IDX=NULL, SLACK=FALSE, DUAL=FALSE, DIRECT=NULL, param=NULL,TRANSPOSE=FALSE, FAST=FALSE, LP=FALSE, CONTROL=NULL, LPK=NULL)

## S3 method for class 'Farrell'print(x, digits=4, ...)## S3 method for class 'Farrell'summary(object, digits=4, ...)

Arguments

X Inputs of firms to be evaluated, a K x m matrix of observations of K firms withm inputs (firm x input). In case TRANSPOSE=TRUE the input matrix is transposedto input x firm.

Y Outputs of firms to be evaluated, a K x n matrix of observations of K firms with noutputs (firm x input). In case TRANSPOSE=TRUE the output matrix is transposedto output x firm.

RTS Text string or a number defining the underlying DEA technology / returns toscale assumption.

0 fdh Free disposability hull, no convexity assumption1 vrs Variable returns to scale, convexity and free disposability2 drs Decreasing returns to scale, convexity, down-scaling and free disposability3 crs Constant returns to scale, convexity and free disposability4 irs Increasing returns to scale, (up-scaling, but not down-scaling), convexity and free disposability5 irs2 Increasing returns to scale (up-scaling, but not down-scaling), additivity, and free disposability6 add Additivity (scaling up and down, but only with integers), and free disposability; also known af replicability and free disposability, the free disposability and replicability hull (frh) – no convexity assumption7 fdh+ A combination of free disposability and restricted or local constant return to scale

ORIENTATION Input efficiency "in" (1), output efficiency "out" (2), and graph efficiency "graph"(3). For use with DIRECT, an additional option is "in-out" (0).

XREF Inputs of the firms determining the technology, defaults to X

YREF Outputs of the firms determining the technology, defaults to Y

FRONT.IDX Index for firms determining the technologySLACK Calculate slack in a phase II calculation; the precision for calculating slacks for

orientation graph is low. The calculation is then done by an intern call of thefunction slack.

Page 12: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

12 dea

DUAL Calculate dual variables, i.e. shadow prices; not calculated for orientation graphas that is not an LP problem.

DIRECT Directional efficiency, DIRECT is either a scalar, an array, or a matrix with non-negative elements.If the argument is a scalar, the direction is (1,1,...,1) times the scalar; the valueof the efficiency depends on the scalar as well as on the unit of measurements.If the argument is an array, this is used for the direction for every firm; the lengthof the array must correspond to the number of inputs and/or outputs dependingon the ORIENTATION.If the argument is a matrix then different directions are used for each firm. Thedimensions depends on the ORIENTATION (and TRANSPOSE), the number of firmsmust correspond to the number of firms in X and Y.DIRECT must not be used in connection with DIRECTION="graph".

param Possible parameters. At the moment only used for RTS="fdh+" to set low andhigh values for restrictions on lambda; see the section details and examples forits use. Future versions might also use param for other purposes.

TRANSPOSE Input and output matrices are treated as firms times goods matrices for the de-fault value TRANSPOSE=FALSE corresponding to the standard in R for statisticalmodels. When TRUE data matrices are transposed to good times firms matricesas is normally used in LP formulation of the problem.

LP Only for debugging. If LP=TRUE then input and output for the LP program arewritten to standard output for each unit.

FAST Only calculate efficiencies and just return them as a vector, i.e. no lambda orother output. The return when using FAST cannot be used as input for slackand peers.

CONTROL Possible controls to lpSolveAPI, see the documentation for that package.

... Optional parameters for the print and summary methods.

object, x An object of class Farrell (returned by the function dea) – R code uses ‘object’and ‘x’ alternating for generic methods.

digits digits in printed output, handled by format in print.

LPK when LPK=k then a mps file is written for firm k; it can be used as input to analternative LP solver to check the results.

Details

The return from dea and sdea is an object of class Farrell. The efficiency in dea is calculated bythe LP method in the package lpSolveAPI. Slacks can be calculated either in the call of dea usingthe option SLACK=TRUE or in a following call to the function slack.

The directional efficiency when the argument DIRECT is used, depends on the unit of measurementand is not restricted to be less than 1 (or greater than 1 for output efficiency) and is thereforecompletely different from the Farrell efficiency.

The crs factor in RTS="fdh+" that sets the lower and upper bound can be changed by the argu-ment param that will set the lower and upper bound to 1-param and 1+param; the default value isparam=.15. The value must be greater than or equal to 0 and strictly less than 1. A value of 0 corre-sponds to RTS="fdh". To get an asymmetric interval set param to a 2 dimentional array with values

Page 13: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

dea 13

for the low and high end for interval, for instance param=c(.8,1.15). The FDH+ technology setis described in Bogetoft and Otto (2011) pages 73–74.

The graph orientated efficiency is calculated by bisection between feasible and infeasible values ofG. The precision in the result is less than for the other orientations.

When the argument DIRECT=d is used then the returned value e for input orientation is the ex-ces input measured in d units of measurements, i.e. x − ed, and for output orientation y +ed. The directional efficency can be restricted to inputs (ORIENTAION="in"), restricted to out-puts (ORIENTAION="out"), or both include inputs and output directions (ORIENTAION="in-out").Dirctional efficiency is discussed on pages 31–35 and 121–127 in Bogetoft and Otto (2011).

Value

The results are returned in a Farrell object with the following components. The last three compo-nents in the list are only part of the object when SLACK=TRUE.

eff The efficiencies. Note when DIRECT is used then the efficencies are not Farrellefficiencies but rather exces values in DIRECT units of measurement

lambda The lambdas, i.e. the weight of the peers, for each firm

objval The objective value as returned from the LP program; normally the same as eff,but for slack it is the the sum of the slacks.

RTS The return to scale assumption as in the option RTS in the call

ORIENTATION The efficiency orientation as in the call

TRANSPOSE As in the call

slack A logical vector where the component for a firm is TRUE if the sums of slacksfor the corresponding firm is positive. Only calculated in dea when optionSLACK=TRUE

sum A vector with sums of the slacks for each firm. Only calculated in dea whenoption SLACK=TRUE

sx A matrix for input slacks for each firm, only calculated if the option SLACK isTRUE or returned from the method slack

sy A matrix for output slack, see sx

ux Dual variable for input, only calculated if DUAL is TRUE.

vy Dual variable for output, only calculated if DUAL is TRUE.

Note

The arguments X, Y, XREF, and YREF are supposed to be matrices or numerical data frames thatin the functin will be converted to matrices. When subsetting a matrix or data frame to just onecolumn then the class of the resulting object/variable is no longer a matrix or a data frame, but just anumeric (array, vector). Therefore, in this case a numeric input that is not a matrix nor a data frameis transformed to a 1 column matrix, and here the use of the argument TRANSPOSE=TRUE gives anerror.

The dual values are not unique for extreme points (firms on the boundary with an efficiency of 1)and therefore the calculated dual values for these firms can depend on the order of firms in the

Page 14: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

14 dea

reference technology. The same lack of uniqueness also make the peers for some firms depend onthe order of firms in the reference technology.

To calucalte slack use the argument SLACK=TRUE or use the function slack directly.

When there is slack, and slack is not taken into consideration, then the peers for a firm with slackmight depend on the order of firms in the data set; this is a property of the LP algorithm used tosolve the problem.

To handle fixed, non-discretionary inputs, one can let it appear as negative output in an input-basedmode, and reversely for fixed, non-discretionary outputs. Fixed inputs (outputs) can also be handledby directional efficiency; set the direction, the argument DIRECT, equal to the variable, discretionaryinputs (outputs) and 0 for the fixed inputs (outputs).

When the the argument DIRECT=X is used the then the returned effiency is equal to 1 minus theFarrell efficiency for input orientation and to the Farrell effiency minus 1 for output orientation.

To use matrices X and Y prepared for the methods in the package FEAR (Wilson 2008) set the op-tions TRANSPOSE=TRUE; for consistency with FEAR the options RTS and ORIENTATION also acceptsnumbers as in FEAR.

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

References

Peter Bogetoft and Lars Otto; Benchmarking with DEA, SFA, and R; Springer 2011

See Also

Paul W. Wilson (2008), “FEAR 1.0: A Software Package for Frontier Efficiency Analysis with R,”Socio-Economic Planning Sciences 42, 247–254

Examples

x <- matrix(c(100,200,300,500,100,200,600),ncol=1)y <- matrix(c(75,100,300,400,25,50,400),ncol=1)dea.plot.frontier(x,y,txt=TRUE)

e <- dea(x,y)eff(e)print(e)summary(e)lambda(e)

# Input savings potential for each firm(1-eff(e)) * x(1-e$eff) * x

# calculate slacksel <- dea(x,y,SLACK=TRUE)data.frame(e$eff,el$eff,el$slack,el$sx,el$sy)

Page 15: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

dea.add 15

# Fully efficient units, eff==1 and no slackwhich(eff(e) == 1 & !el$slack)

# fdh+ with limits in the interval [.7, 1.2]dea(x,y,RTS="fdh+", param=c(.7,1.2))

dea.add Additive DEA model

Description

Calculates additive efficiency as sum of input and output slacks within different DEA models

Usage

dea.add(X, Y, RTS="vrs", XREF=NULL, YREF=NULL,FRONT.IDX=NULL, param=NULL, TRANSPOSE=FALSE, LP=FALSE)

Arguments

X Inputs of firms to be evaluated, a K x m matrix of observations of K firms withm inputs (firm x input). In case TRANSPOSE=TRUE the input matrix is transposedto input x firm.

Y Outputs of firms to be evaluated, a K x n matrix of observations of K firms with noutputs (firm x input). In case TRANSPOSE=TRUE the output matrix is transposedto output x firm.

RTS Text string or a number defining the underlying DEA technology / returns toscale assumption.

0 fdh Free disposability hull, no convexity assumption1 vrs Variable returns to scale, convexity and free disposability2 drs Decreasing returns to scale, convexity, down-scaling and free disposability3 crs Constant returns to scale, convexity and free disposability4 irs Increasing returns to scale, (up-scaling, but not down-scaling), convexity and free disposability5 add Additivity (scaling up and down, but only with integers), and free disposability

XREF Inputs of the firms determining the technology, defaults to X

YREF Outputs of the firms determining the technology, defaults to Y

FRONT.IDX Index for firms determining the technology

param Possible parameters. At the moment only used for RTS="fdh+" to set low andhigh values for restrictions on lambda; see the section details and examples forits use. Future versions might also use param for other purposes.

TRANSPOSE Input and output matrices are treated as firms times goods matrices for the de-fault value TRANSPOSE=FALSE corresponding to the standard in R for statistical

Page 16: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

16 dea.add

models. When TRUE data matrices are transposed to good times firms matricesas is normally used in LP formulation of the problem.

LP Only for debugging. If LP=TRUE then input and output for the LP program arewritten to standard output for each unit.

Details

The sum of the slacks is maximized in a LP formulation of the DEA technology. The sum of theslacks can be seen as distance to the frontier when you only move parallel to the axes of inputs andoutputs, i.e. not a usual Euclidean distance, but what is also known as an L1 norm.

Since it is the sum of slacks that is calculated, there is no exogenous ORIENTATION in the problem.Rather, there is generally both an input and an output direction in the slacks. The model considersthe input excess and output shortfall simultaneously and finds a point on the frontier that is mostdistant to the point being evaluated.

Value

sum Sum of all slacks for each firm, sum=sum(sx)+sum(sy).

slack A non-NULL vector of logical variables, TRUE if there is slack for the corre-sponding firm, and FALSE if the there is no slack, i.e. the sum of slacks is zero.

sx A matrix of input slacks for each firm

sy A matrix of output slack for each firm

lambda The lambdas, i.e. the weights of the peers for each firm

Note

This is neither a Farrell nor a Shephard like efficiency.

The value of the slacks depends on the scaling of the different inputs and outputs. Therefore thevalues are not independent of how the input and output are measured.

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

Source

Corresponds to Eqs. 4.34-4.38 in Cooper et al. (2007)

References

Bogetoft and Otto; Benchmarking with DEA, SFA, and R; Springer 2011

Cooper, Seiford, and Tone; Data Envelopment Analysis: A Comprehensive Text with Models, Ap-plications, References and DEA-Solver Software; Second edition, Springer 2007

Page 17: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

dea.boot 17

Examples

x <- matrix(c(2,3,2,4,6,5,6,8),ncol=1)y <- matrix(c(1,3,2,3,5,2,3,5),ncol=1)dea.plot.frontier(x,y,txt=1:dim(x)[1])

sb <- dea.add(x,y,RTS="vrs")data.frame("sx"=sb$sx,"sy"=sb$sy,"sum"=sb$sum,"slack"=sb$slack)

dea.boot Bootstrap DEA models

Description

The function dea.boot bootstrap DEA models and returns bootstrap of Farrell efficiencies. Thisfunction is slower than the boot.sw89 from the package FEAR. The faster function boot.fear isa wrapper for boot.sw89 from the package FEAR returning results directly as Farrell measures.

Usage

dea.boot(X, Y, NREP = 200, EFF = NULL, RTS = "vrs", ORIENTATION="in",alpha = 0.05, XREF = NULL, YREF = NULL, EREF = NULL,DIRECT = NULL, TRANSPOSE = FALSE, SHEPHARD.INPUT = TRUE, LP)

boot.fear(X, Y, NREP = 200, EFF = NULL, RTS = "vrs", ORIENTATION = "in",alpha = 0.05, XREF = NULL, YREF = NULL, EREF = NULL)

Arguments

X Inputs of firms to be evaluated, a K x m matrix of observations of K firms withm inputs (firm x input)

Y Outputs of firms to be evaluated, a K x n matrix of observations of K firms withn outputs (firm x input).

NREP Number of bootstrap replicats

EFF Efficiencies for (X,Y) relative to the technology generated from (XREF,YREF).

RTS The returns to scale assumptions as in dea, only works for "vrs", "drs", and"crs"; more to come.

ORIENTATION Input efficiency "in" (1), output efficiency "out" (2), and graph efficiency "graph"(3).

alpha One minus the size of the confidence interval for the bias corrected efficiencies

XREF Inputs of the firms determining the technology, defaults to X.

YREF Outputs of the firms determining the technology, defaults to Y.

EREF Efficiencies for the firms in XREF, YREF.

DIRECT Does not yet work and is therefore not used.

Page 18: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

18 dea.boot

TRANSPOSE Input and output matrices are K x m and K x n for the default value TRANSPOSE=FALSE;this is standard in R for statistical models. When TRANSPOSE=TRUE data matricesare m x K and n x K.

SHEPHARD.INPUT The bootstrap of the Farrell input efficiencies is done as a Shephard input dis-tance function, the inverse Farrell input efficiency. The option is only relevantfor input and graph directions.

LP Only for debugging purposes.

Details

The details are lightly explained in Bogetoft and Otto (2011) Chap. 6, and with more mathematicaldetails in Dario and Simar (2007) Sect. 3.4 and in Simar and Wilson (1998).

The bootstrap at the moment does not work for any kind of directional efficiency.

The returned confidence intervals are for the bias corrected efficiencies; to get confidence intervalsfor the uncorrected efficiencies add the biases to both upper and lower values for the intervals.

Under the default option SHEPHARD.INPUT=TRUE bias and bias corrected efficiencies are calcu-lated for Shephard input distance function and then transformed to Farrell input efficiencies toavoid possible negative biased corrected input efficiencies. If this is not wanted use the optionSHEPHARD.INPUT=FALSE. This option is only relevant for input and graph oriented directions.

Value

The returned values from both functions are as follows:

eff Efficiencies

eff.bc Bias-corrected efficiencies

bias An array of bootstrap bias estimates for the K firms

conf.int K x 2 matrix with confidence interval for the estimated efficiencies

var An array of bootstrap variance estimates for the K firms

boot The replica bootstrap estimates of the Farrell efficiencies, a K x NREP matrix

Note

The function dea.boot does not depend on the FEAR package and can therefore be used on com-puters where the package FEAR is not available. This, however, comes with a time penalty as ittakes around 4 times longer to run compared to using FEAR directly

The returned bootstrap estimates from FEAR::boot.sw98 of efficiencies are sorted for each firmindividually.

Unfortunately, this means that the component of replicas is not the efficiencies for the same boot-strap replica, but could easily be from differencts bootstrap replicas. This also means that thisfunction can not be used to bootstrap tests for statistical hypotheses where the statistics involvessumming of firms efficiencies.

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

Page 19: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

dea.boot 19

References

Peter Bogetoft and Lars Otto; Benchmarking with DEA, SFA, and R; Springer 2011.

Cinzia Dario and L. Simar; Advanced Robust and Nonparametric Methods in Efficiency Analysis.Methodology and Applications; Springer 2007.

Leopold Simar and Paul .W. Wilson (1998), “Sensitivity analysis of efficiency scores: How tobootstrap in nonparametric frontier models”, Management Science 44, 49–61.

Paul W. Wilson (2008), “FEAR 1.0: A Software Package for Frontier Efficiency Analysis with R,”Socio-Economic Planning Sciences 42, 247–254

See Also

The documentation for boot.sw98 in the package FEAR.

Examples

x <- matrix(c(100,200,300,500,100,200,600),ncol=1)y <- matrix(c(75,100,300,400,25,50,400),ncol=1)

e <- dea(x,y)eff(e)

dea.plot.frontier(x,y,txt=TRUE)

# To bootstrap for real, NREP should be at least 2000. Run the# following lines a couple of times with nrep=100 and see how the# bootstrap frontier changes from one run to the next. Try the same# with NREP=2000 even though is does take a longer time to run,# especially for dea.boot.nrep <- 1# nrep <- 2000

# if ( "FEAR" %in% .packages(TRUE) ) {## The following only works if the package FEAR is installed; it does## not have to be loaded.# b <- boot.fear(x,y, NREP=nrep)# } else {

b <- dea.boot(x,y, NREP=nrep)# }

# bias corrected frontierdea.plot.frontier(b$eff.bc*x, y, add=TRUE, lty="dashed")# outer 95% confidence interval frontier for uncorrected frontierdea.plot.frontier((b$conf.int[,1]+b$bias)*x, y, add=TRUE, lty="dotted")

## Test of hypothesis in DEA model# Null hypothesis is that technology is CRS and the alternative is VRS# Bogetoft and Otto (2011) pages 183--185.ec <- dea(x,y, RTS="crs")Ec <- eff(ec)

Page 20: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

20 dea.direct

ev <- dea(x,y, RTS="vrs")Ev <- eff(ev)# The test statistic; equation (6.1)S <- sum(Ec)/sum(Ev)

# To calculate CRS and VRS efficiencies in the same bootstrap replicas# we reset the random number generator before each call of the# function dea.boot.

# To get the an initial value for the random number generating process# we save its state (seed)save.seed <- sample.int(1e9,1)

# The bootstrap and calculate CRS and VRS under the assumption that# the true technology is CRS (the null hypothesis) and such that the# results correponds to the case where CRS and VRS are calculated for# the same reference set of firms; to make this happen we set the# random number generator to the same state before the calls.set.seed(save.seed)bc <- dea.boot(x,y, nrep,, RTS="crs")set.seed(save.seed)bv <- dea.boot(x,y, nrep,, RTS="vrs", XREF=x,YREF=y, EREF=ec$eff)

# Calculate the statistic for each bootstrap replicabs <- colSums(bc$boot)/colSums(bv$boot)# The critical value for the test (default size \code{alpha} of test is 5%)critValue(bs, alpha=.1)S# Accept the hypothesis at 10% level?critValue(bs, alpha=.1) <= S

# The probability of observering a smaller value of S when the# hypothesis is true; the p--value.typeIerror(S, bs)# Accept the hypothesis at size level 10%?typeIerror(S, bs) >= .10

dea.direct Directional efficiency

Description

Directional efficiency rescaled to an interpretation a la Farrell efficiency and the corresponding peerimportance (lambda).

Usage

dea.direct(X, Y, DIRECT, RTS = "vrs", ORIENTATION = "in",XREF = NULL, YREF = NULL, FRONT.IDX = NULL,SLACK = FALSE, param=NULL, TRANSPOSE = FALSE)

Page 21: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

dea.direct 21

Arguments

X Inputs of firms to be evaluated, a K x m matrix of observations of K firms withm inputs (firm x input)

Y Outputs of firms to be evaluated, a K x n matrix of observations of K firms withn outputs (firm x input).

DIRECT Directional efficiency, DIRECT is either a scalar, an array, or a matrix with non-negative elements.If the argument is a scalar, the direction is (1,1,...,1) times the scalar; the valueof the efficiency depends on the scalar as well as on the unit of measurements.If the argument an array, this is used for the direction for every firm; the lengthof the array must correspond to the number of inputs and/or outputs dependingon the ORIENTATION.If the argument is a matrix then different directions are used for each firm. Thedimensions depends on the ORIENTATION (and TRANSPOSE), the number of firmsmust correspond to the number of firms in X and Y.DIRECT must not be used in connection with DIRECTION="graph".

RTS Text string or a number defining the underlying DEA technology / returns toscale assumption.

0 fdh Free disposability hull, no convexity assumption1 vrs Variable returns to scale, convexity and free disposability2 drs Decreasing returns to scale (down-scaling, but not up-scaling), convexity, and free disposability3 crs Constant returns to scale, convexity and free disposability4 irs Increasing returns to scale (up-scaling, but not down-scaling), convexity, and free disposability6 add Additivity (scaling up and down, but only with integers), and free disposability7 fdh+ A combination of free disposability and restricted or local constant return to scale

ORIENTATION Input efficiency "in" (1), output efficiency "out" (2), and graph efficiency "graph"(3). For use with DIRECT, an additional option is "in-out" (0).

XREF Inputs of the firms determining the technology, defaults to X.

YREF Outputs of the firms determining the technology, defaults to Y.

FRONT.IDX Index for firms determining the technology.

SLACK See dea and slack.

param Possible parameters. At the moment only used for RTS="fdh+" to set low andhigh values for restrictions on lambda; see the section details and examples indea for its use. Future versions might also use param for other purposes.

TRANSPOSE see dea

Details

When the argument DIRECT=d is used then component objval of the returned object for inputorientation is the maximum value of e where for input orientation x− ed, and for output orientationy + ed are in the generated technology set. The returned component eff is for input 1 − ed/Xand for output 1 + ed/Y to make the interpretation as for a Farrell efficiency. Note that whenthe direction is not proportional to X or Y the returned eff are different for different inputs or

Page 22: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

22 dea.direct

outputs and eff is a matrix and not just an array. The directional efficiency can be restricted toinputs (ORIENTATION="in"), restricted to outputs (ORIENTATION="out"), or both include inputsand output directions (ORIENTATION="in-out"). Directional efficiency is discussed on pages 31–35 and 121–127 in Bogetoft and Otto (2011).

The Farrell efficiency interpretation is the ratio by which a firm can proportionally reduce all in-puts (or expand all outputs) without producing less outputs (using more inputs). The directionalefficiecies have the same interpretation expect that the direction is not proportional to the inputs (oroutputs) and therefore the different inputs may have different reduction ratios, the efficiency is anarray and not just a number.

Value

The results are returned in a Farrell object with the following components. The method slack onlyreturns the three components in the list relevant for slacks.

eff The Farrell efficiencies. Note that the the efficiencies are calculated to have thesame interpretations as Farrell efficiencies. eff is a matrix if there are more than1 good.

lambda The lambdas, i.e. the weight of the peers, for each firm

objval The objective value as returned from the LP program; the objval are excessvalues in DIRECT units of measurement.

RTS The return to scale assumption as in the option RTS in the call

ORIENTATION The efficiency orientation as in the call

TRANSPOSE As in the call

slack A vector with sums of the slacks for each firm. Only calculated in dea whenoption SLACK=TRUE

sx A matrix for input slacks for each firm, only calculated if the option SLACK isTRUE or returned from the method slack

sy A matrix for output slack, see sx

Note

To handle fixed, non-discretionary inputs, one can let it appear as negative output in an input-basedmode, and reversely for fixed, non-discretionary outputs. Fixed inputs (outputs) can also be handledby directional efficiency; set the direction, the argument DIRECT, equal to the variable, discretionaryinputs (outputs) and 0 for the fixed inputs (outputs).

When the the argument DIRECT=X is used the then the returned efficiency is equal to 1 minus theFarrell efficiency for input orientation and equal to the Farrell efficiency minus 1 for output orien-tation.

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

Page 23: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

dea.direct 23

References

Directional efficiency is discussed on pages 31–35 and 121–127 in Bogetoft and Otto (2011).

Peter Bogetoft and Lars Otto; Benchmarking with DEA, SFA, and R; Springer 2011

See Also

dea

Examples

# Directional efficiencyx <- matrix(c(2,5 , 1,2 , 2,2 , 3,2 , 3,1 , 4,1), ncol=2,byrow=TRUE)y <- matrix(1,nrow=dim(x)[1])dea.plot.isoquant(x[,1], x[,2],txt=1:dim(x)[1])

E <- dea(x,y)z <- c(1,1)e <- dea.direct(x,y,DIRECT=z)data.frame(Farrell=E$eff, Perform=e$eff, objval=e$objval)# The directionarrows(x[,1], x[,2], (x-z)[,1], (x-z)[,2], lty="dashed")# The efficiency (e$objval) along the directionsegments(x[,1], x[,2], (x-e$objval*z)[,1], (x-e$objval*z)[,2], lwd=2)

# Different directionsx1 <- c(.5, 1, 2, 4, 3, 1)x2 <- c(4, 2, 1,.5, 2, 4)x <- cbind(x1,x2)y <- matrix(1,nrow=dim(x)[1])dir1 <- c(1,.25)dir2 <- c(.25, 4)dir3 <- c(1,4)e <- dea(x,y)e1 <- dea.direct(x,y,DIRECT=dir1)e2 <- dea.direct(x,y,DIRECT=dir2)e3 <- dea.direct(x,y,DIRECT=dir3)data.frame(e=eff(e),e1=e1$eff,e2=e2$eff,e3=e3$eff)[6,]

# Technology and directions for all firmsdea.plot.isoquant(x[,1], x[,2],txt=1:dim(x)[1])arrows(x[,1], x[,2], x[,1]-dir1[1], x[,2]-dir1[2],lty="dashed")segments(x[,1], x[,2],

x[,1]-e1$objval*dir1[1], x[,2]-e1$objval*dir1[2],lwd=2)# slack for direction 1dsl1 <- slack(x,y,e1)cbind(E=e$eff,e1$eff,dsl1$sx,dsl1$sy, sum=dsl1$sum)

# Technology and directions for firm 6,

Page 24: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

24 dea.dual

# Figure 2.6 page 32 in Bogetoft & Otto (2011)dea.plot.isoquant(x1,x2,lwd=1.5, txt=TRUE)arrows(x[6,1], x[6,2], x[6,1]-dir1[1], x[6,2]-dir1[2],lty="dashed")arrows(x[6,1], x[6,2], x[6,1]-dir2[1], x[6,2]-dir2[2],lty="dashed")arrows(x[6,1], x[6,2], x[6,1]-dir3[1], x[6,2]-dir3[2],lty="dashed")segments(x[6,1], x[6,2],

x[6,1]-e1$objval[6]*dir1[1], x[6,2]-e1$objval[6]*dir1[2],lwd=2)segments(x[6,1], x[6,2],

x[6,1]-e2$objval[6]*dir2[1], x[6,2]-e2$objval[6]*dir2[2],lwd=2)segments(x[6,1], x[6,2],

x[6,1]-e3$objval[6]*dir3[1], x[6,2]-e3$objval[6]*dir3[2],lwd=2)

dea.dual Dual DEA models and assurance regions

Description

Solution of dual DEA models, possibly with partial value information given as restrictions on theratios (assurance regions)

Usage

dea.dual(X, Y, RTS = "vrs", ORIENTATION = "in",XREF = NULL, YREF = NULL,FRONT.IDX = NULL, DUAL = NULL, DIRECT=NULL,TRANSPOSE = FALSE, LP = FALSE, CONTROL=NULL, LPK=NULL)

Arguments

X Inputs of firms to be evaluated, a K x m matrix of observations of K firms withm inputs (firm x input). In case TRANSPOSE=TRUE the input matrix is transposedto input x firm.

Y Outputs of firms to be evaluated, a K x n matrix of observations of K firms with noutputs (firm x input). In case TRANSPOSE=TRUE the output matrix is transposedto output x firm.

RTS A text string or a number defining the underlying DEA technology / returns toscale assumption.

1 vrs Variable returns to scale, convexity and free disposability2 drs Decreasing returns to scale, convexity, down-scaling and free disposability3 crs Constant returns to scale, convexity and free disposability4 irs Increasing returns to scale, (up-scaling, but not down-scaling), convexity and free disposability.

ORIENTATION Input efficiency "in" (1), output efficiency "out" (2), and graph efficiency "graph"(3) (not yet implemented). For use with DIRECT an additional option is "in-out"(0). In this case, "graph" is not feasible

XREF Input of the firms determining the technology, defaults to X

Page 25: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

dea.dual 25

YREF Output of the firms determining the technology, defaults to Y

FRONT.IDX Index for firms determining the technology

DUAL Matrix of order “number of input plus number of outputs minus 2” times 2. Thefirst column is the lower bound and the second column is the upper bound forthe restrictions on the multiplier ratios. The ratios are relative to the first inputand the first output, respectively. This implyies that there is no restriction forneither the first input nor the first output so that the number of restrictions is twoless than the total number of inputs and outputs.

DIRECT Directional efficiency, DIRECT is either a scalar, an array, or a matrix with non-negative elements.NB Not yet implemented

TRANSPOSE Input and output matrices are treated as firms times goods for the default valueTRANSPOSE=FALSE corresponding to the standard in R for statistical models.When TRUE data matrices shall be transposed to good times firms matrices asis normally used in LP formulation of the problem.

LP Only for debugging. If LP=TRUE then input and output for the LP program arewritten to standard output for each unit.

CONTROL Possible controls to lpSolveAPI, see the documentation for that package.

LPK When LPK=k then a mps file is written for firm k; it can be used as input to analternative LP solver just to check the our results.

Details

Solved as an LP program using the package lpSolveAPI. The method dea.dual.dea calls themethod dea with the option DUAL=TRUE.

Value

eff The efficiencies

objval The objective value as returned from the LP problem, normally the same as eff

RTS The return to scale assumption as in the option RTS in the call

ORIENTATION The efficiency orientation as in the call

TRANSPOSE As in the call

u Dual values, prices, for inputs

v Dual values, prices, for outputs

gamma The values of gamma, the shadow price(s) for returns to scale restriction

sol Solution of all variables as one component, sol=c(u,v,gamma).

Note

Note that the dual values are not unique for extreme points in the technology set. In this case thevalue of the calculated dual variable can depend on the order of the complete efficient firms.

Page 26: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

26 dea.merge

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

References

Bogetoft and Otto; Benchmarking with DEA, SFA, and R; Springer 2011. Sect. 5.10: Partial valueinformation

See Also

dea

Examples

x <- matrix(c(2,5 , 1,2 , 2,2 , 3,2 , 3,1 , 4,1), ncol=2,byrow=TRUE)y <- matrix(1,nrow=dim(x)[1])dea.plot.isoquant(x[,1],x[,2],txt=1:dim(x)[1])segments(0,0, x[,1], x[,2], lty="dotted")

e <- dea(x,y,RTS="crs",SLACK=TRUE)ed <- dea.dual(x,y,RTS="crs")print(cbind("e"=e$eff,"ed"=ed$eff, peers(e), lambda(e),

e$sx, e$sy, ed$u, ed$v), digits=3)

dual <- matrix(c(.5, 2.5), nrow=dim(x)[2]+dim(y)[2]-2, ncol=2, byrow=TRUE)er <- dea.dual(x,y,RTS="crs", DUAL=dual)print(cbind("e"=e$eff,"ar"=er$eff, lambda(e), e$sx, e$sy, er$u,

"ratio"=er$u[,2]/er$u[,1],er$v),digits=3)

dea.merge Estimate potential merger gains and their decompositions

Description

Calculate and decompose potential gains from mergers of similar firms (horizontal integration).

Usage

dea.merge(X, Y, M, RTS = "vrs", ORIENTATION = "in",XREF = NULL, YREF = NULL, FRONT.IDX = NULL, TRANSPOSE=FALSE)

Page 27: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

dea.merge 27

Arguments

Most of the arguments correspond to the arguments in dea, with K firms, minputs, and n outputs.

X K times m matrix as in dea

Y K times n matrix as in dea

M Kg times K matrix where each row defines a merger by the firms (collums)included; matrix as returned from method make.merge

RTS as in dea

ORIENTATION as in dea

XREF as in dea

YREF as in dea

FRONT.IDX as in dea

TRANSPOSE as in dea

Details

The K firms are merged into Kg new, merged firms.

The decomposition is summarized on page 275 and in table 9.1 page 276 in Bogetoft and Otto(2011) and is based on Bogetoft and Wang (2005)

Value

Eff Overall efficiencies of mergers, Kg vector

Estar Adjusted overall efficiencies of mergers after the removal of individual learning,Kg vector

learning Learning effects, Kg vector

harmony Harmony (scope) effects, Kg vector

size Size (scale) effects, Kg vector

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

References

Bogetoft and Otto; Benchmarking with DEA, SFA, and R; chapter 9; Springer 2011.

Bogetoft and Wang; “Estimating the Potential Gains from Mergers”; Journal of Productivity Ana-lysis, 23, pp. 145-171, 2005.

See Also

dea and make.merge

Page 28: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

28 dea.plot

Examples

x <- matrix(c(100,200,300,500),ncol=1,dimnames=list(LETTERS[1:4],"x"))y <- matrix(c(75,100,300,400),ncol=1,dimnames=list(LETTERS[1:4], "y"))

dea.plot.frontier(x,y,RTS="vrs",txt=LETTERS[1:length(x)],xlim=c(0,1000),ylim=c(0,1000) )dea.plot.frontier(x,y,RTS="drs", add=TRUE, lty="dashed", lwd=2)dea.plot.frontier(x,y,RTS="crs", add=TRUE, lty="dotted")

dea(x,y,RTS="crs")M <- make.merge(list(c(1,2), c(3,4)), X=x)xmer <- M %*% xymer <- M %*% ypoints(xmer,ymer,pch=8)text(xmer,ymer,labels=c("A+B","C+D"),pos=4)dea.merge(x,y,M, RTS="vrs")dea.merge(x,y,M, RTS="crs")

dea.plot Plot of DEA technologies

Description

Draw a graph of a DEA technology. Designed for two goods illustrations, either isoquant (2 inputs),transformation curve (2 outputs), or a production function (1 input and 1 output). If the number ofgood is larger than 2 then aggregation occur, either simple or weighted.

Usage

dea.plot(x, y, RTS="vrs", ORIENTATION="in-out", txt=NULL, add=FALSE,wx=NULL, wy=NULL, TRANSPOSE=FALSE, fex=1, GRID=FALSE,RANGE=FALSE, param=NULL, ..., xlim, ylim, xlab, ylab)

dea.plot.frontier(x, y, RTS="vrs",...)

dea.plot.isoquant(x1, x2, RTS="vrs",...)

dea.plot.transform(y1, y2, RTS="vrs",...)

Arguments

x The good illustrated on the first axis. If there are more than 1 input then inputsare just summed or, if wx is present, a weighted sum of inputs is used.

y The good illustrated on the second axis. If there are more than 1 output thenoutputs are just summed or, if wy is present, a weighted sum of outputs is used.

Page 29: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

dea.plot 29

x1, y1 The good illustrated on the first axis

x2, y2 The good illustrated on the second axis

RTS Underlying DEA model / assumptions about returns to scale: "fdh" (0), "vrs"(1), "drs" (2), "crs" (3), "irs" (4), "irs2" (5) (irs without convexity), "add" (6),and "fdh+" (7). Numbers in parenthesis can also be used as values for RTS

ORIENTATION Input-output graph of 1 input and 1 output is "in-out" (0), graph of 2 inputs is"in" (1), and graph of 2 outputs is "out" (2).

txt txt is an array to label the observations. If txt=TRUE the observations are la-beled by the observation number or rownames if there are any.

add For add=T the technology is drawn on top of an existing graph. With the defaultadd=F, a new graph is made.

wx Weight to aggregate the first axis if there are more than 1 good behind the firstaxis.

wy Weights to aggregate for the second axis if there are more than 1 good behindthe second the second axis.

TRANSPOSE Only relevant for more than 1 good for each axis, see dea for a description ofthis option.

GRID If GRIF=TRUE a gray grid is put on the plot.

... Usual options for the methods plot, lines, and abline etc.

fex Relative size of the text/labels on observations; corresponds to cex, but onlychanges the size of the text.

RANGE A logical variable, if RANGE=TRUE the limits for the graph is the range of thevariables; zero is always included. Default is RANGE=FALSE when the range isfrom zero to the max values. Relevant if some values are negative.

param Possible parameters. At the moment only used for RTS="fdh+"; see the sectiondetails and examples for its use. Future versions might also use param for otherpurposes.

xlim Possible limits c(x1,x2) for the first axis

ylim Possible limits c(y1,y2) for the second axis

xlab Possible label for the x-axis

ylab Possible label for the y-axis

Details

The method dea.plot is the general plotting method. The the 3 others are specialized versions forfrontiers (1 input and 1 output), isoquant curves (2 inputs for given outputs), and transformationcurves (2 outputs for given inputs) obtained by using the argument ORIENTATION.

The crs factor in RTS="fdh+" that sets the lower and upper bound can be changed by the argu-ment param that will set the lower and upper bound to 1-param and 1+param; the default value isparam=.15. The value must be greater than or equal to 0 and strictly less than 1. A value of 0 cor-responds to RTS="fdh". The FDH+ technology set is described in Bogetoft and Otto (2011) pages72–73.

Page 30: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

30 dea.plot

Value

No return, uses the original graphing system.

Note

If there are more than 1 good for the arguments x and y then the goods are just summed or, if wxor wy are present, weighted sum of goods are used. In this case the use of the command identifymust be calles as dea.plot(rowSums(x),rowSums(y)).

Warning If you use this facility to plot multi input and multi output then the plot may deceive youas fully multi efficient firms are not necessarely placed on the two dimensional frontier.

Note that RTS="add" and RTS="fdh+" only works for ORIENTATION="in-out" (0).

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

References

Peter Bogetoft and Lars Otto; Benchmarking with DEA, SFA, and R; Springer 2011

Paul Murrell; R Graphics; Chapman & Hall 2006

See Also

The documentation for the function plot and Murrell (2006) for further options and on customizingplots.

Examples

x <- matrix(c(100,200,300,500,600,100),ncol=1)y <- matrix(c(75,100,300,400,400,50),ncol=1)

dea.plot(x,y,RTS="vrs",ORIENTATION="in-out",txt=LETTERS[1:length(x)])dea.plot(x,y,RTS="crs",ORIENTATION="in-out",add=TRUE,lty="dashed")

dea.plot.frontier(x,y,txt=1:dim(x)[1])

n <- 10x <- matrix(1:n,,1)y <- matrix(x^(1.6) + abs(rnorm(n)),,1)dea.plot.frontier(x,y,RTS="irs",txt=1:n)dea.plot.frontier(x,y,RTS="irs2",add=TRUE,lty="dotted")

# Two different forms of irs: irs and irs2, and two different ways to# make a frontierid <- sample(1:n,30,replace=TRUE)dea.plot(x[id],y[id],RTS="irs",ORIENTATION="in-out")dea.plot.frontier(x[id],y[id],RTS="irs2")

# Difference between the FDH technology and the additive

Page 31: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

eff, efficiencies 31

# FRH technologyx <- matrix(c(100,220,300,520,600,100),ncol=1)y <- matrix(c(75,100,300,400,400,50),ncol=1)dea.plot(x,y,RTS="fdh",ORIENTATION="in-out",txt=LETTERS[1:length(x)])dea.plot(x,y,RTS="add",ORIENTATION="in-out",add=TRUE,lty="dashed",lwd=2)dea.plot(x,y,RTS="fdh+",ORIENTATION="in-out",add=TRUE,

lty="dotted",lwd=3,col="red")

# Use of parameter in FDH+dea.plot(x,y,RTS="fdh",ORIENTATION="in-out",txt=LETTERS[1:length(x)])dea.plot(x,y,RTS="fdh+",ORIENTATION="in-out",add=TRUE,lty="dashed")dea.plot(x,y,RTS="fdh+",ORIENTATION="in-out",add=TRUE,lty="dotted",param=.5)

eff, efficiencies Calculate efficiencies for Farrell and sfa object

Description

Calculate efficiencies for Farrell and sfa object. For a sfa there are several types

Usage

eff( object, ... )efficiencies( object, ... )## Default S3 method:efficiencies( object, ... )## S3 method for class 'Farrell'efficiencies(object, type = "Farrell", ...)## S3 method for class 'Farrell'eff(object, type = "Farrell", ...)## S3 method for class 'sfa'efficiencies(object, type = "BC", ...)## S3 method for class 'sfa'eff(object, type = "BC", ...)

Arguments

object A Farrell object returned from a DEA function like dea, sdea, or mea or an sfaobject returned from the function sfa.

type The type of efficiencies to be calculated. For a Farrell object the possibilities are“Farrell” efficiency or “Shephard” efficiency. For a sfa object the possibilitiesare “BC”, “Mode”, “J”, or “add”.

... Further arguments ...

Page 32: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

32 eff, efficiencies

Details

The possible types for class Farrell (an object returned from dea et al. are “Farrell” and “Shep-hard”.

The possible types for class sfa efficiencies are

BC Efficiencies estimated by minimizing the mean square error; Eq. (7.21) in Bogetoft and Otto(2011, 219) and Battese and Coelli (1988, 392)

Mode Efficiencies estimates using the conditional mode approach; Bogetoft and Otto (2011, 219),Jondrow et al. (1982, 235).

J Efficiencies estimates using the conditional mean approach Jondrow et al. (1982, 235).

add Efficiency in the additive model, Bogetoft and Otto (2011, 219)

Value

The efficiencies are returned as an array.

Note

For the Farrell object the orientation is determined by the calculations that led to the object and cannot be changed here.

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

References

Bogetoft and Otto; Benchmarking with DEA, SFA, and R, Springer 2011

See Also

dea and sfa.

Examples

##---- Should be DIRECTLY executable !! ----##-- ==> Define data, use random,##--or do help(data=index) for the standard data sets.

Page 33: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

eff.dens 33

eff.dens Estimate and plot density of efficiencies

Description

A method to estimate and plot kernel estimate of (Farrell) efficiencies taken into consideration thatefficiencies are bounded either above (input direction) or below (output direction).

Usage

eff.dens(eff, bw = "nrd0")

eff.dens.plot(obj, bw = "nrd0", ..., xlim, ylim, xlab, ylab)

Arguments

eff Either a list of (Farrell) efficiencies or a Farrell object returned from the methoddea.

bw Bandwith, look at the documentation of density for an explanation.

obj Either an array of efficiencies or a list returned from eff.dens.

... Further arguments to the plot method like line type and line width.

xlim Range on the x-axis; usualy not needed, just use the defaults.

ylim Range on the x-axis; usualy not needed, just use the defaults.

xlab Label for the x-axis.

ylab Label for the y-axis.

Details

The calculation is based on a reflection method (Silverman 1986, 30) using the default windowkernel and defult bandwidth (window width) in the method density.

The method eff.dens.plot plot the density directly, and eff.dens just estimate the numericaldensity, and the result can then either be plotted by plot, corresponds to eff.dens.plot, or bylines as an overlay on an existing plot.

Value

The return from eff.dens is a list list(x,y) with efficiencies and the corresponding density val-ues.

Note

The input efficiency is also bounded below by 0, but for normal firms an efficiency at 0 will nothappen, i.e. the boundary is not effective, and therefore this boundary is not taken into considera-tion.

Page 34: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

34 eladder

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

References

B.W. Silverman (1986), Density Estimation for Statistics and Data Analysis, Chapman and Hall,London.

Examples

e <- 1 - rnorm(100)e[e>1] <- 1e <- e[e>0]eff.dens.plot(e)

hist(e, breaks=15, freq=FALSE, xlab="Efficiency", main="")den <- eff.dens(e)lines(den,lw=2)

eladder Efficiency ladder for a single firm

Description

How the efficiency changes as the most influential peer is removed sequentially one at a time

Usage

eladder(n, X, Y, RTS = "vrs", ORIENTATION = "in",XREF=NULL, YREF=NULL, DIRECT = NULL, param=NULL)

eladder.plot(elad, peer, TRIM = NULL)

Arguments

n The number of the firm where the ladder is calculated

X Inputs of firms to be evaluated, a K x m matrix of observations of K firms withm inputs (firm x input). In case TRANSPOSE=TRUE the input matrix is transposedto input x firm.

Y Outputs of firms to be evaluated, a K x n matrix of observations of K firms with noutputs (firm x input). In case TRANSPOSE=TRUE the output matrix is transposedto output x firm.

RTS Text string or a number defining the underlying DEA technology / returns toscale assumption, se the possible values for dea.

ORIENTATION Input efficiency "in" (1), output efficiency "out" (2), and graph efficiency "graph"(3). For use with DIRECT, an additional option is "in-out" (0).

XREF Inputs of the firms determining the technology, defaults to X

Page 35: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

eladder 35

YREF Outputs of the firms determining the technology, defaults to Y

DIRECT Directional efficiency, DIRECT is either a scalar, an array, or a matrix with non-negative elements. See dea for a further description of this argument.

param Possible parameters. At the moment only used for RTS="fdh+" to set low andhigh values for restrictions on lambda; see the section details and examples indea for its use. Future versions might also use param for other purposes.

elad The sequence of efficiencies returned from eladder.

peer The sequence of peers returned from eladder.

TRIM The number of characters for the name of the peers on the axis in the plot.

Details

The function eladder calculates how the efficiency for a firm changes when the most influentialpeer is removed sequentially one at a time. Somewhere in the sequence the firm becomes efficientand are itself removed from the set of firms generating the technology (or the only firm left) andthereafter the efficiencies are super-efficiencies.

Value

The object returned from eladder is a list with components

eff The sequence of efficiencies when the peer with the largest value of lambda hasbeen removed.

peer The sequence of removed peers corresponding to the largest values of lambdaas index in the X rows.

Note

When the number of firms is large then the number of influential peers will also be large and thenames or numbers of the peers on the x-axis might be squeeze together and be illegible. In this caserestrict the number of influential peers to be removed.

The efficiency step ladder is discussed in Essay 4 of Dag Fjeld Edvardsens’s Ph.D. thesis from 2004.

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

References

Dag Fjeld Edvardsen; Four Essays on the Measurement of Productive Efficiency; University ofGothenburg 2004; http://hdl.handle.net/2077/2923

Page 36: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

36 excess

Examples

data(charnes1981)x <- with(charnes1981, cbind(x1,x2,x3,x4,x5))y <- with(charnes1981, cbind(y1,y2,y3))

# Choose the firm for analysis, we choose 'Tacoma'n <- which(charnes1981$name=="Tacoma")[1]

el <- eladder(n, x, y, RTS="crs")eladder.plot(el$eff, el$peer)

# Restrict to 20 most influential peers for 'Tacoma' and use names# instead of numbereladder.plot(el$eff[1:20], charnes1981$name[el$peer][1:20])

# Truncate the names of the peers and put a title on topeladder.plot(el$eff[1:20], charnes1981$name[el$peer][1:20], TRIM=5)title("Eladder for Tacoma")

excess Excess input compared over frontier input

Description

Excess input compared over frontier input and/or less output than frontier/transformation/optimaloutput.

Usage

excess(object, X = NULL, Y = NULL)

Arguments

object A Farrell object as returned from functions like dea, dea.direct, linksdea, andmea.

X Input matrix, only neccesary for ordinary input Farrell efficiency

Y Ouput matrix , only neccesary for ordinary output Farrell efficiency

Details

For Farrell input efficiency E the exess input is (1 − E)X and for Farrell ouput efficiency F themissing output is (F − 1)Y .

For directional efficiency e in the direction D the excess input is eD.

If a firm is outside the technology set, as could be the case when calculating super-efficiencies, theFarrell input efficiency is larger then 1 and then the excess values are negative.

Page 37: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

lambda 37

Value

Return a matrix with exces input and/or less output.

Author(s)

Peter Bogeroft and Lars Otto <[email protected]>

References

Peter Bogetoft and Lars Otto; Benchmarking with DEA, SFA, and R; Springer 2011

Examples

x <- matrix(c(100,200,300,500,100,200,600),ncol=1)y <- matrix(c(75,100,300,400,25,50,400),ncol=1)

e <- dea(x,y)excess(e,x)x - eff(e) * x

e <- dea(x,y, ORIENTATION="graph")excess(e, x, y)x - eff(e) * x1/eff(e) * y -y

me <- mea(x,y)excess(me)

lambda Lambdas or the weight of the peers

Description

The lambdas, i.e. the weight of the peers, for each firm.

Usage

lambda(object, KEEPREF = FALSE)lambda.print(x, KEEPREF = FALSE, ...)

Arguments

object,x A Farrell object as returned from dea et al.KEEPREF if TRUE then all firms are kept as reference firms even though they have all zero

weights (lambda); might come handy if one needs to calculate X x lambda suchthat the firms in X and lambda agree. If FALSE, the default, then only weight forthe peers are in the matrix lambda.

... Optional parameters for the print method.

Page 38: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

38 make.merge

Details

Only returns the the lambdas for firms that appear as a peer, i.e. only lambdas for firms where atleast one element of the lambda is positive.

Value

The return is a matrix with the firms as rows and the peers as columns.

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

See Also

dea

Examples

##---- Should be DIRECTLY executable !! ----##-- ==> Define data, use random,##--or do help(data=index) for the standard data sets.

make.merge Make an aggregation matrix to perform mergers

Description

Make an aggregation matrix to perform mergers of firms. The matrix can be post multiplied (matrixmultiplication) to input and output matrices to make merged input and output matrices.

Usage

make.merge(grp, nFirm = NULL, X = NULL, names = NULL)

Arguments

grp Either a list of length Kg for Kg firms after mergers; each component of the listis a (named) list with the firm numbers or names going into this merger.Or a factor of length K with Kg levels where where each level determines amerger; to exclude firms for mergers set the factor value to NA.

nFirm Number of firms before the mergers

X A matrix of inputs or outputs where the rows corresponds to the number oforiginal (starting) firms

names A list with names of all firms, only needed if the mergers are given as a list ofnames, i.e. grp is a list of names.

Page 39: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

make.merge 39

Details

Either nFirm or X must be present; if both are present then nFirm must be equal to the number ofrows in X, the number of firms.

When X is an input matrix of dimension K x m, K firms and m inputs, and M <- make.merge(gr,K)then M %*% X is the input matrix for the merged firms.

Value

Returns an aggregation matrix of dimension Kg times K where rows corresponds to new mergedfirms and columns are 1 for firms to be included and 0 for firms to be excluded in the the givenmerger as defined by the row.

Note

The argument TRANSPOSE has not been implemented for this function. If you need transposedmatrices you must transpose the merger matrix yourself. If you define mergers via factors there isno need to transpose in the arguments; just do not use X in the arguments.

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

See Also

dea.merge

Examples

# To merge firms 1,3, and 5; and 2 and 4 of 7 firms into 2 new firms# the aggregation matrix is M; not all firms are involved in a merger.M <- make.merge(list(c(1,3,5), c(2,4)),7)print(M)

# Merge 1 and 2, and 4 and 5, and leave 3 alone, total of 5 firms.# Using a listM1 <- make.merge(list(c(1,2), c(4,5)), nFirm=5)print(M1)

# Using a factorfgr <- factor(c("en","en",NA,"to","to"))M2 <- make.merge(fgr)print(M2)

# Name of mergersM3 <- make.merge(list(AB=c("A","B"), DE=c("D","E")), names=LETTERS[1:5])print(M3)

# No name of mergersM4 <- make.merge(list(c("A","B"), c("D","E")), names=LETTERS[1:5])print(M4)

Page 40: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

40 mea

mea MEA multi-directional efficiency analysis

Description

Potential improvements PI or multi-directional efficiency analysis. The result is an exces valuemeasures by the direction.

The direction is determined by the direction corresponding to the minimum input/maximum direc-tion each good can be changed when they are changed one at a time.

Usage

mea(X, Y, RTS = "vrs", ORIENTATION = "in", XREF = NULL, YREF = NULL,FRONT.IDX = NULL, param=NULL, TRANSPOSE = FALSE,LP = FALSE, CONTROL = NULL, LPK = NULL)

mea.lines(N, X, Y, ORIENTATION="in")

Arguments

X K times m matrix with K firms and m inputs as in dea

Y K times n matrix with K firms and n outputs as in dea

RTS Text string or a number defining the underlying DEA technology / returns toscale assumption.

0 fdh Free disposability hull, no convexity assumption1 vrs Variable returns to scale, convexity and free disposability2 drs Decreasing returns to scale, convexity, down-scaling and free disposability3 crs Constant returns to scale, convexity and free disposability4 irs Increasing returns to scale, (up-scaling, but not down-scaling), convexity and free disposability6 add Additivity (scaling up and down, but only with integers), and free disposability7 fdh+ A combination of free disposability and restricted or local constant return to scale

ORIENTATION Input efficiency "in" (1) or output efficiency "out" (2), and also the additionaloption "in-out" (0) for both input and output direction.

XREF Inputs of the firms determining the technology, defaults to X

YREF Outputs of the firms determining the technology, defaults to Y

FRONT.IDX Index for firms determining the technology

param Possible parameters. At the moment only used for RTS="fdh+" to set low andhigh values for restrictions on lambda; see the section details and examples indea for its use. Future versions might also use param for other purposes.

TRANSPOSE as in dea

LP as in dea

CONTROL as in dea

Page 41: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

mea 41

LPK as in dea

N Number of firms where directional lines are to be drawn on an all raeady ecistingfrontier plot (dea.plot.frontier)

Details

Details can be found in Bogetoft and Otto (2011, 121–124).

This method is for input directional efficiency only interesting when there are 2 or more inputs, andfor output only when there are 2 or more outputs.

Value

The results are returned in a Farrell object with the following components.

eff Exces value in DIRECT units of measurement, this is not Farrell efficiency

lambda The lambdas, i.e. the weight of the peers, for each firm

objval The objective value as returned from the LP program; normally the same as eff

RTS The return to scale assumption as in the option RTS in the call

ORIENTATION The efficiency orientation as in the call

direct A K times m|n|m+n matrix with directions for each firm: the number of columnsdepends on wether it is input, output og in-out orientated.

TRANSPOSE As in the call

Note

The calculation is done in dea after a calculation of the dirction that then is used in the argumentDIRECT. The calulation of the direction is done in a series LP programs, one for each good in thedirection.

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

References

Peter Bogetoft and Lars Otto; Benchmarking with DEA, SFA, and R; Springer 2011

See Also

dea and the argument DIRECT.

Page 42: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

42 milkProd

Examples

X <- matrix(c(2, 2, 5, 10, 10, 3, 12, 8, 5, 4, 6,12), ncol=2)Y <- matrix(rep(1,dim(X)[1]), ncol=1)

dea.plot.isoquant(X[,1], X[,2],txt=1:dim(X)[1])mea.lines(c(5,6),X,Y)

me <- mea(X,Y)mepeers(me)# MEA potential saving in inputs, exces inputseff(me) * me$directme$eff * me$direct

# Compare to traditionally Farrell efficiencye <- dea(X,Y)epeers(e)# Farrell potential saving in inputs, exces inputs(1-eff(e)) * X

milkProd Data: Milk producers

Description

Data colected from Danish milk producers.

Usage

data(milkProd)

Format

A data frame with 108 observations on the following 5 variables.

farmNo farm number

milk Output of milk, kg

energy Energy expenses

vet Veterinary expenses

cows Number of cows

Note

Data as .csv are loaded by the command data using read.table(..., header = TRUE, sep = ";")such that this file is a semicolon separated file and not a comma separated file.

Page 43: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

norWood2004 43

Source

Accounting and buissiness check data

Examples

data(milkProd)y <- with(milkProd, cbind(milk))x <- with(milkProd, cbind(energy, vet, cows))

norWood2004 Data: Forestry in Norway

Description

A data set for 113 farmers in forestry in Norway.

Usage

data(norWood2004)

Format

A data frame with 113 observations on the following 7 variables.

firm firm numberm Variable costx Woodland, value of forrest and landy Profitz1 Secondary income from ordinary farmingz3 Age of forrest ownerz6 Whether there is a long-term plan =1 or not =0

Details

Collected from farmers in forestry.

Note

Data as .csv are loaded by the command data using read.table(..., header=TRUE, sep=";")such that this file is a semicolon separated file and not a comma separated file.

Source

Norwegian Agricultural Economics Research Institute.

Examples

data(norWood2004)## maybe str(norWood2004) ; plot(norWood2004) ...

Page 44: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

44 outlier.ap

outlier.ap Detection of outliers in benchmark models

Description

The functions implements the Wilson (1993) outlier detection method using only R functions.

Usage

outlier.ap(X, Y, NDEL = 3, NLEN = 25, TRANSPOSE = FALSE)

outlier.ap.plot(ratio, NLEN = 25, xlab = "r", ylab = "Log ratio",..., ylim)

Arguments

X Input as a firms times goods matrix, see TRANSPOSE.Y Output as a firms times goods matrix, see TRANSPOSE.NDEL The maximum number of firms to be considered as a group of outliers, i.e. the

maximum number of firms to be deleted.NLEN The number of ratios to save for each level or removal, the number of rows in

ratio used.TRANSPOSE Input and output matrices are treated as firms times goods matrices for the de-

fault value TRANSPOSE=FALSE corresponding to the standard in R for statisticalmodels. When TRUE data matrices are transposed to good times firms matricesas is normally used in LP formulation of the problem.

ratio The ratio component from the list as output from outlier.ap.xlab Label for the x-axis.ylab Label for the y-axisylim The y limits (y1, y2) of the plot, an array/vector of length 2.... Usual options for the methods plot and lines.

Details

An implementation of the method in Wilson (1993) using only R functions and especially the func-tion det to calculate R

(i)min.

An elementary presentation of the method is found in Bogetoft and Otto (2011), Sect. 5.13 onoutliers.

Value

ratio A min(NLEN,K) x NDEL matrix with the log-ratios to be plotted.imat A NDEL x NDEL matrix with indicies for deleted firms.r0 A NDEL array with the minimum value Ri of the for each number of deleted

firms.

Page 45: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

peers 45

Note

The function outlier.ap is extremely slow and for NDEL larger than 3 or 4 it might be advisable touse the function ap from the package FEAR.

The name of the returned components are the same as for ap in the package FEAR.

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

References

Bogetoft and Otto; Benchmarking with DEA, SFA, and R; Springer 2011

Wilson (1993), “Detecing outliers in deterministic nonparametric frontier models with multipleoutputs,” Journal of Business and Economic Statistics 11, 319-323.

Wilson (2008), “FEAR 1.0: A Software Package for Frontier Efficiency Analysis with R,” Socio-Economic Planning Sciences 42, 247–254

See Also

The function ap in the package FEAR.

Examples

n <- 25x <- matrix(rnorm(n))y <- .5 + 2.5*x + 2*rnorm(25)tap <- outlier.ap(x,y, NDEL=2)print(cbind(tap$imat,tap$rmin), na.print="", digit=2)outlier.ap.plot(tap$ratio)

peers Find peer firms and units

Description

The function peers finds for each firm its peers, get.number.peers finds for each peer the numberof times this peer apears as a peer, and get.which.peers determines for one or more peers the firmsthey apear as peers for.

Usage

peers(object, NAMES = FALSE)get.number.peers(object, NAMES = FALSE)get.which.peers(object, N = 1:length(object$eff))

Page 46: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

46 peers

Arguments

object An object of class Farrell as returned by the functions dea, dea.direct et al.

NAMES If true then names for the peers are returned if names are available otherwise theunit index numbers are used

N The peer(s) for which

Details

The returned values are index of the firms and can be used by itself, but can also by used as an indexfor a variable with names of the firms.

The peers returns a matrix with numbers for the peers for each firm; for firms with efficiency 1 thepeers are just the firm itself. If there is slack in the evaluation of a firm with efficiency 1, this canbe found with a call to slack, either directly or by the argument SLACK when a function dea wascalled to generate the Farrell object.

The get.number.peers returns the number of firms that a peer serves as a peer for.

Value

The return values are firm numbers. If the argument NAMES=TRUE is used in the function peers thereturn is a list of names of the peers if names for the firms are avilable as rownames.

Note

Peers are defines as firms where the coresponding lambdas are positive.

Note that peers might change between a Farrell object return from dea with SLACK=FALSE and acall with SLACK=TRUE or a following call to the function slack because a peer on the frontier withslack might by the call to dea be seen as a peer for itself whereas this will not happen when slacksare calculated.

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

References

Peter Bogetoft and Lars Otto; Benchmarking with DEA, SFA, and R; Springer 2011. Sect. 4.6 page93

See Also

dea

Examples

x <- matrix(c(100,200,300,500,100,200,600),ncol=1)y <- matrix(c(75,100,300,400,25,50,400),ncol=1)

e <- dea(x,y)

Page 47: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

pigdata 47

peers(e)get.number.peers(e)

# Who are the firms that firm 1 and 4 is peers forget.which.peers(e, c(1,4))

pigdata Data: Multi-output pig producers

Description

Input and output data for 248 pig producers that also produces crop, i.e. a multi–output data set.

Usage

data(pigdata)

Format

A data frame with 248 observations on the following 16 variables.

firm Serial number for pig producer

x1 Input fertilizer

x2 Input feedstuf

x3 Input land

x4 Input labour

x5 Input machinery

x6 Input other capital

y2 Output crop

y4 Output pig

w1 Price of fertilizer

w2 Price of feedstuf

w3 Price of land

w4 Price of labour

w5 Price of michenery

w6 Price of other capital

p2 Price of pig

p4 Price of crop

cost Total cost, w1*x1+...+w6*x6.

rev Total revenue, p2*y2+p4*y4.

Page 48: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

48 projekt

Details

In raising pigs, most farmers also produce crops to feed the pigs. Labor and capital are used not justdirectly for pig-raising but also on the field.

Note

Data as .csv are loaded by the command data using read.table(..., header = TRUE, sep = ";")such that this file is a semicolon separated file and not a comma separated file.

Source

Farmers accounting data converted to index.

Examples

data(pigdata)## maybe str(pigdata) ; plot(pigdata) ...

projekt Data: Milk producers

Description

Accounting and production data for 101 milk producing farmers.

Usage

data(projekt)

Format

A data frame with 101 observations on the following 14 variables.

numb Serial number for the milk producercows Number of cowsvet Veterinary expencesunitCost Unit cost, variable costcapCost Capacity costfixedCost Fixed costmilkPerCow Milk per cow, kgquota Milk quotafatPct Fat percent in milkprotPct Protein percent in milkcellCount Cell count for milkrace Race for cows, a factor with levels jersey, large, and mixed

type Type of production, conventional or organic, a factor with levels conv orga

age Age of the farmer

Page 49: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

sdea 49

Details

Data is a mix of accounting data and production controls.

Note

Data as .csv are loaded by the command data using read.table(..., header = TRUE, sep = ";")such that this file is a semicolon separated file and not a comma separated file.

Source

Collected from farmers.

Examples

data(projekt)## maybe str(projekt) ; plot(projekt) ...

sdea Super efficiency

Description

The method sdea calculates super-effciency and returns the same class of object as dea.

Usage

sdea(X, Y, RTS = "vrs", ORIENTATION = "in", DIRECT = NULL, param = NULL,TRANSPOSE = FALSE, LP = FALSE)

Arguments

X Inputs of firms to be evaluated, a K x m matrix of observations of K firms withm inputs (firm x input). In case TRANSPOSE=TRUE the input matrix is transposedto input x firm.

Y Outputs of firms to be evaluated, a K x n matrix of observations of K firms with noutputs (firm x input). In case TRANSPOSE=TRUE the output matrix is transposedto output x firm.

RTS Text string or a number defining the underlying DEA technology / returns toscale assumption; the same values as for dea.

0 fdh Free disposability hull, no convexity assumption1 vrs Variable returns to scale, convexity and free disposability2 drs Decreasing returns to scale, convexity, down-scaling and free disposability3 crs Constant returns to scale, convexity and free disposability4 irs Increasing returns to scale, (up-scaling, but not down-scaling), convexity and free disposability5 irs2 Increasing returns to scale (up-scaling, but not down-scaling), additivity, and free disposability6 add Additivity (scaling up and down, but only with integers), and free disposability7 fdh+ A combination of free disposability and restricted or local constant return to scale

Page 50: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

50 sdea

ORIENTATION Input efficiency "in" (1), output efficiency "out" (2), and graph efficiency "graph"(3). For use with DIRECT, an additional option is "in-out" (0).

DIRECT Directional efficiency, DIRECT is either a scalar, an array, or a matrix with non-negative elements.If the argument is a scalar, the direction is (1,1,...,1) times the scalar; the valueof the efficiency depends on the scalar as well as on the unit of measurements.If the argument an array, this is used for the direction for every firm; the lengthof the array must correspond to the number of inputs and/or outputs dependingon the ORIENTATION.If the argument is a matrix then different directions are used for each firm. Thedimensions depends on the ORIENTATION, the number of firms must correspondto the number of firms in X and Y.DIRECT must not be used in connection with DIRECTION="graph".

param Argument is at present only used when RTS="fdh+", see dea for a description.

TRANSPOSE See the description in dea.

LP Only for debugging, see the description in dea.

Details

Super-efficiency measures are constructed by avoiding that the evaluated firm can help span thetechnology; ie. if the firm in qestuen is a firm on the frontier in a normal dea approach then thisfirm in super efficiency might be outside the technology set.

Value

The object returned is a Farrell object with the component described in dea. The relevant compo-nents are

eff The efficiencies. Note when DIRECT is used then the efficencies are not Farrellefficiencies but rather exces values in DIRECT units of measurement

lambda The lambdas, i.e. the weight of the peers, for each firm

objval The objective value as returned from the LP program; normally the same as eff.

RTS The return to scale assumption as in the option RTS in the call

ORIENTATION The efficiency orientation as in the call

Note

Calculation of slacks for super efficiency should be done by using the option SLACK=TRUE in thecall of the method sdea. If the two phases are done in two steps as first a call to sdea and then acall to slacks the user must make sure to set the reference technology to the one corresponding tosuper-efficiency in the call to slack and this requires a loop with calls to slack.

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

Page 51: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

sfa 51

References

Peter Bogetoft and Lars Otto; Benchmarking with DEA, SFA, and R; Springer 2011. Sect. 5.2 page115

P Andersen and NC Petersen; “A procedure for ranking efficient units in data envelopment analy-sis”; Management Science 1993 39(10):1261–1264

See Also

dea

Examples

x <- matrix(c(100,200,300,500,100,200,600),ncol=1)y <- matrix(c(75,100,300,400,25,50,400),ncol=1)se <- sdea(x,y)se

# Leave out firm 3 as a determining firm of the technology setn <- 3dea.plot.frontier(x[-n], y[-n], txt=(1:dim(x)[1])[-n])# Plot and label firm 3points(x[n],y[n],cex=1.25,pch=16)text(x[n],y[n],n,adj=c(-.75,.75))

sfa Stochastic frontier estimation

Description

Estimate a stochastic frontier production function using a maximum likelihood method.

Usage

sfa(x, y, beta0 = NULL, lambda0 = 1, resfun = ebeta,TRANSPOSE = FALSE, DEBUG=FALSE,control=list(), hessian=2)

te.sfa(object)teBC.sfa(object)teMode.sfa(object)teJ.sfa(object)

te.add.sfa(object)

sigma2u.sfa(object)

Page 52: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

52 sfa

sigma2v.sfa(object)sigma2.sfa(object)

lambda.sfa(object)

Arguments

x Input as a K x m matrix of observations on m inputs from K firms; (firm x input);MUST be a matrix. No constant for the intercept should be included in x as it isadded by default.

y Output; K times 1 matrix (one output)

beta0 Optional initial parameter values

lambda0 Optional initial ratio of variances

resfun Function to calculate the residuals, default is a linear model with an intercept.Must be called as resfun(x,y,parm) where parm=c(beta,lambda) or parm=c(beta),and return the residuals as an array of length corresponding to the length of out-put y.

TRANSPOSE If TRUE, data is transposed, i.e. input is now m x K matrix

DEBUG Set to TRUE to get various debugging information written on the console

control List of control parameters to ucminf

hessian How the Hessian is delivered, see the ucminf documentation

object Object of class ‘sfa’ as output from the function sfa

Details

The optimization is done by the R method ucminf from the package with the same name. Theefficiency terms are assumed to be half–normal distributed.

Changing the maximum steplength, the trust rgion, might be important, and this can be done by theoption ’control= list(stepmax=0.1)’. The default value is 0.1 and that value is suitable for parametersaround 1; for smaller parameters a lower value should be used. Notice that the step length is updatedby the optimizing program and thus must be set for every call of the function sfa if it is to be set.

The generic functions print.sfa, summary.sfa, fitted.sfa, residuals.sfa, logLik.sfa, andcoef.sfa all work as expected.

The methods te.sfa, teMode.sfa etc. calculates the efficiency corresponding to different methods

Value

The values returned from sfa is the same as for ucminf, i.e. a list with components plus someespecially relevant for sfa:

par The best set of parameters found c(beta,lambda).

value The value of minus log-likelihood function corresponding to ’par’.

beta The parameters for the function

sigma2 The estimate of the total variance

Page 53: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

sfa 53

lambda The estimate of lambda

N The number of observations

df The degrees of freedom for the model

residuals The residuals as a K times 1 matrix/vector, can also be obtained byresiduals(sfa-object)

fitted.values Fitted values

vcov The variance-covarians matrix for all estimated parameters incl. lambda

convergence An integer code. ’0’ indicates successful convergence. Some of the error codestaken from ucminf are’1’ Stopped by small gradient (grtol).’2’ Stopped by small step (xtol).’3’ Stopped by function evaluation limit (maxeval).’4’ Stopped by zero step from line searchMore codes are found in ucminf

message A character string giving any additional information returned by the optimizer,or ’NULL’.

o The object returned by ucminf, for further information on this see ucminf

Note

Calculation of technical efficiencies for each unit can be done by the method te.sfa as shown in theexamples.

te.sfa(sfaObject), teBC.sfa(sfaObject): Efficiencies estimated by minimizing the meansquare error; Eq. (7.21) in Bogetoft and Otto (2011, 219) and Battese and Coelli (1988, 392)

teMode.sfa(sfaObject), te1.sfa(sfaObject): Efficiencies estimates using the conditionalmode approach; Bogetoft and Otto (2011, 219), Jondrow et al. (1982, 235).

teJ.sfa(sfaObject), te2.sfa(sfaObject): Efficiencies estimates using the conditional meanapproach Jondrow et al. (1982, 235).

te.add.sfa(sfaObject) Efficiency in the additive model, Bogetoft and Otto (2011, 219)

The variance pf the distribution of efficiency can be calculated by sigma2u.sfa(sfaObject), thevariance of the random error by sigma2v.sfa(sfaObject), and the total variance (sum of vari-ances of efficiency and random noise) by sigma2.sfa.

The ratio of variances of the efficiency and the random noise can be found from the methodlambda.sfa

The generic method summary prints the parameters, standard errors, t-values, and a few more statis-tics from the optimization.

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

References

Bogetoft and Otto; Benchmarking with DEA, SFA, and R, Springer 2011; chapters 7 and 8.

Page 54: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

54 slack

See Also

See the method ucminf for the possible optimization methods and further options to use in theoption control.

The method sfa in the package frontier gives another way to estimate stochastic production func-tions.

Examples

# Example from the book by Coelli et al.# d <- read.csv("c:/0work/rpack/front41Data.csv", header = TRUE, sep = ",")# x <- cbind(log(d$capital), log(d$labour))# y <- matrix(log(d$output))

n <- 50x1 <- 1:50 + rnorm(50,0,10)x2 <- 100 + rnorm(50,0,10)x <- cbind(x1,x2)y <- 0.5 + 1.5*x1 + 2*x2 + rnorm(n,0,1) - pmax(0,rnorm(n,0,1))sfa(x,y)summary(sfa(x,y))

# Estimate efficiency for each unito <- sfa(x,y)eff(o)

te <- te.sfa(o)teM <- teMode.sfa(o)teJ <- teJ.sfa(o)cbind(eff(o),te,Mode=eff(o, type="Mode"),teM,teJ)[1:10,]

sigma2.sfa(o) # Estimated varianslambda.sfa(o) # Estimated lambda

slack Calculate slack in an efficiency analysis

Description

Slacks are calculated after taking the efficiency into consideration.

Usage

slack(X, Y, e, XREF = NULL, YREF = NULL, FRONT.IDX = NULL, LP = FALSE)

Page 55: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

slack 55

Arguments

X Inputs of firms to be evaluated, a K x m matrix of observations of K firms withm inputs (firm x input).

Y Outputs of firms to be evaluated, a K x n matrix of observations of K firms withn outputs (firm x input).

e A Farrell object as returned from dea et al.

XREF Inputs of the firms determining the technology, defaults to X

YREF Outputs of the firms determining the technology, defaults to Y

FRONT.IDX Index for firms determining the technology

LP Set TRUE for debugging.

Details

Slacks are calculated in a LP problem where the sum of all slacks are maximied after correction forefficiency.

Value

The result is returned as the Farrell object used as the argument in the call of the function with thefollowing added components:

slack A logical vector where the component for a firm is TRUE if the sums of slacksfor the corresponding firm is positive. Only calculated in dea when optionSLACK=TRUE

sum A vector with sums of the slacks for each firm. Only calculated in dea whenoption SLACK=TRUE

sx A matrix for input slacks for each firm, only calculated if the option SLACK isTRUE or returned from the method slack

sy A matrix for output slack, see sx

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

References

Peter Bogetoft and Lars Otto; Benchmarking with DEA, SFA, and R; Springer 2011. Sect. 5.6 page127.

WW Cooper, LM Seiford, and K Tone; Data Envelopment Analysis: A Comprehensive Text withModels, Applications, References and DEA-Solver Software, 2nd edn. Springer 2007 .

Page 56: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

56 typeIerror

Examples

x <- matrix(c(100,200,300,500,100,200,600),ncol=1)y <- matrix(c(75,100,300,400,25,50,400),ncol=1)dea.plot.frontier(x,y,txt=1:dim(x)[1])

e <- dea(x,y)eff(e)

# calculate slackssl <- slack(x,y,e)data.frame(e$eff,sl$slack,sl$sx,sl$sy)

typeIerror Probability of type I error for test in a bootstrap DEA model

Description

Calculates the probability of a type I error for a test in bootstrapped DEA models.

Usage

typeIerror(shat,s)

Arguments

shat The value of the statistic for which the probability of a type I error is to becalculated

s Vector with calculated values of the statistic for each of the NREP bootstraps;NREP is from dea.boot

Details

Needs bootstrapped values of the test statistic

Value

Returns the probability of a type I error

Author(s)

Peter Bogetoft and Lars Otto <[email protected]>

See Also

boot.sw98 in FEAR, Paul W. Wilson (2008), “FEAR 1.0: A Software Package for Frontier Effi-ciency Analysis with R,” Socio-Economic Planning Sciences 42, 247–254

Page 57: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

typeIerror 57

Examples

# Probability of getting something larger than 1.96 in 10000 random# standard normal variates.x <- rnorm(10000)typeIerror(1.96,x)

Page 58: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

Index

∗Topic DEAcost.opt, 7

∗Topic \textasciitildekwd1lambda, 37peers, 45slack, 54

∗Topic \textasciitildekwd2lambda, 37peers, 45slack, 54

∗Topic bootstrapdea.boot, 17

∗Topic datasetscharnes1981, 5milkProd, 42norWood2004, 43pigdata, 47projekt, 48

∗Topic efficienciesdea.boot, 17

∗Topic efficiencyBenchmarking-package, 2cost.opt, 7dea, 11dea.direct, 20dea.merge, 26eff, efficiencies, 31eladder, 34excess, 36mea, 40sdea, 49sfa, 51

∗Topic mergerdea.merge, 26

∗Topic modelsBenchmarking-package, 2cost.opt, 7dea, 11dea.add, 15

dea.direct, 20dea.merge, 26dea.plot, 28eladder, 34excess, 36mea, 40sdea, 49

∗Topic packageBenchmarking-package, 2

∗Topic plotdea.plot, 28eladder, 34

∗Topic sfasfa, 51

Benchmarking (Benchmarking-package), 2Benchmarking-package, 2boot.fear (dea.boot), 17

charnes1981, 5coef.sfa (sfa), 51cost.opt, 7critValue, 10

dea, 8, 11, 17, 21, 23, 26, 27, 29, 31–38, 40,41, 46, 49–51, 55

dea.add, 15dea.boot, 17dea.direct, 20, 36, 46dea.dual, 24dea.merge, 26, 39dea.plot, 28dea.plot.frontier, 41

eff (eff, efficiencies), 31eff, efficiencies, 31eff.dens, 33efficiencies (eff, efficiencies), 31eladder, 34excess, 36

58

Page 59: Package ‘Benchmarking’ - The Comprehensive R Archive ... · PDF filePackage ‘Benchmarking’ July 8, 2015 Type Package Title Benchmark and Frontier Analysis Using DEA and SFA

INDEX 59

get.number.peers (peers), 45get.which.peers (peers), 45

lambda, 37lambda.sfa (sfa), 51logLik.sfa (sfa), 51

make.merge, 27, 38mea, 31, 36, 40milkProd, 42

norWood2004, 43

outlier.ap, 44

peers, 45pigdata, 47print.cost.opt (cost.opt), 7print.Farrell (dea), 11print.profit.opt (cost.opt), 7print.revenue.opt (cost.opt), 7print.sfa (sfa), 51print.slack (slack), 54profit.opt (cost.opt), 7projekt, 48

residuals.sfa (sfa), 51revenue.opt (cost.opt), 7

sdea, 31, 49sfa, 31, 32, 51sigma2.sfa (sfa), 51sigma2u.sfa (sfa), 51sigma2v.sfa (sfa), 51slack, 11, 12, 14, 21, 46, 54summary.cost.opt (cost.opt), 7summary.Farrell (dea), 11summary.profit.opt (cost.opt), 7summary.revenue.opt (cost.opt), 7summary.sfa (sfa), 51summary.slack (slack), 54

te.add.sfa (sfa), 51te.sfa (sfa), 51teBC.sfa (sfa), 51teJ.sfa (sfa), 51teMode.sfa (sfa), 51typeIerror, 56

ucminf, 53