install.packages(“nonparaeff”)

3장의 1투입 1산출 예제

library(nonparaeff)
## Warning: package 'nonparaeff' was built under R version 3.2.3
## Loading required package: lpSolve
## Warning: package 'lpSolve' was built under R version 3.2.3
## Loading required package: gdata
## Warning: package 'gdata' was built under R version 3.2.3
## gdata: Unable to locate valid perl interpreter
## gdata: 
## gdata: read.xls() will be unable to read Excel XLS and XLSX files
## gdata: unless the 'perl=' argument is used to specify the location
## gdata: of a valid perl intrpreter.
## gdata: 
## gdata: (To avoid display of this message in the future, please
## gdata: ensure perl is installed and available on the executable
## gdata: search path.)
## gdata: Unable to load perl libaries needed by read.xls()
## gdata: to support 'XLX' (Excel 97-2004) files.
## 
## gdata: Unable to load perl libaries needed by read.xls()
## gdata: to support 'XLSX' (Excel 2007+) files.
## 
## gdata: Run the function 'installXLSXsupport()'
## gdata: to automatically download and install the perl
## gdata: libaries needed to support Excel XLS and XLSX formats.
## 
## Attaching package: 'gdata'
## 
## The following object is masked from 'package:stats':
## 
##     nobs
## 
## The following object is masked from 'package:utils':
## 
##     object.size
## 
## Loading required package: Hmisc
## Warning: package 'Hmisc' was built under R version 3.2.3
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
## Warning: package 'Formula' was built under R version 3.2.3
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 3.2.3
## 
## Attaching package: 'Hmisc'
## 
## The following object is masked from 'package:gdata':
## 
##     combine
## 
## The following objects are masked from 'package:base':
## 
##     format.pval, round.POSIXt, trunc.POSIXt, units
## 
## Loading required package: rms
## Warning: package 'rms' was built under R version 3.2.3
## Loading required package: SparseM
## 
## Attaching package: 'SparseM'
## 
## The following object is masked from 'package:base':
## 
##     backsolve
## 
## Loading required package: geometry
## Warning: package 'geometry' was built under R version 3.2.3
## Loading required package: magic
## Warning: package 'magic' was built under R version 3.2.3
## Loading required package: abind
## Warning: package 'abind' was built under R version 3.2.3
## Loading required package: psych
## Warning: package 'psych' was built under R version 3.2.3
## 
## Attaching package: 'psych'
## 
## The following object is masked from 'package:Hmisc':
## 
##     describe
## 
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
## 
## Loading required package: pwt
## Warning: package 'pwt' was built under R version 3.2.3
##  Package 'pwt' provides Penn World Table versions 5.6, 6.x, 7.x.
##  For more recent versions see package 'pwt8' (or subsequent packages).
y <- c(1, 2, 4, 6, 7, 9, 9)
x <- c(3, 2, 6, 4, 8, 8, 10)

tab3.1.data <- data.frame(y, x)

re <- dea(base = tab3.1.data, noutput = 1, orientation = 1, rts = 1, onlytheta = FALSE)

re
##         eff lambda1 lambda2 lambda3   lambda4 lambda5 lambda6 lambda7
## 1 0.2222222       0       0       0 0.1666667       0       0       0
## 2 0.6666667       0       0       0 0.3333333       0       0       0
## 3 0.4444444       0       0       0 0.6666667       0       0       0
## 4 1.0000000       0       0       0 1.0000000       0       0       0
## 5 0.5833333       0       0       0 1.1666667       0       0       0
## 6 0.7500000       0       0       0 1.5000000       0       0       0
## 7 0.6000000       0       0       0 1.5000000       0       0       0
##   slack.x1 slack.y1
## 1        0        0
## 2        0        0
## 3        0        0
## 4        0        0
## 5        0        0
## 6        0        0
## 7        0        0

3장의 2투입 1산출 예제

y  <- c(1, 1, 1, 1, 1, 1)
x1 <- c(1, 3, 6, 2, 5, 9)
x2 <- c(4, 1, 1, 8, 5, 2)

tab3.3.dat <- data.frame(y, x1, x2)

re <- dea(base = tab3.3.dat, noutput = 1, orientation = 1, rts = 1)

re
##    eff lambda1 lambda2 lambda3 lambda4 lambda5 lambda6 slack.x1 slack.x2
## 1 1.00     1.0     0.0       0       0       0       0      0.0        0
## 2 1.00     0.0     1.0       0       0       0       0      0.0        0
## 3 1.00     0.0     1.0       0       0       0       0      3.0        0
## 4 0.50     1.0     0.0       0       0       0       0      0.0        0
## 5 0.44     0.4     0.6       0       0       0       0      0.0        0
## 6 0.50     0.0     1.0       0       0       0       0      1.5        0
##   slack.y1
## 1        0
## 2        0
## 3        0
## 4        0
## 5        0
## 6        0

앞의 예제에서 모든 관측점의 투영점을 확인해 보자.

ref <- data.frame(y  = c(tab3.3.dat$y + re$slack.y1),
                  x1 = c(tab3.3.dat$x1 * re$eff - re$slack.x1),
                  x2 = c(tab3.3.dat$x2 * re$eff - re$slack.x2))

ref
##   y  x1  x2
## 1 1 1.0 4.0
## 2 1 3.0 1.0
## 3 1 3.0 1.0
## 4 1 1.0 4.0
## 5 1 2.2 2.2
## 6 1 3.0 1.0

연습문제 3 번

y1  <- c(1, 1, 1, 1, 1, 1, 1)
x11 <- c(1, 3, 6, 2, 5, 9, 2.6)
x12 <- c(4, 1, 1, 8, 5, 2, 1.6)

tab3.3.dat <- data.frame(y, x1, x2)

re1 <- dea(base = tab3.3.dat, noutput = 1, orientation = 1, rts = 1)

re1
##    eff lambda1 lambda2 lambda3 lambda4 lambda5 lambda6 slack.x1 slack.x2
## 1 1.00     1.0     0.0       0       0       0       0      0.0        0
## 2 1.00     0.0     1.0       0       0       0       0      0.0        0
## 3 1.00     0.0     1.0       0       0       0       0      3.0        0
## 4 0.50     1.0     0.0       0       0       0       0      0.0        0
## 5 0.44     0.4     0.6       0       0       0       0      0.0        0
## 6 0.50     0.0     1.0       0       0       0       0      1.5        0
##   slack.y1
## 1        0
## 2        0
## 3        0
## 4        0
## 5        0
## 6        0
ref1 <- data.frame(y  = c(tab3.3.dat$y + re$slack.y1),
                   x1 = c(tab3.3.dat$x1 * re$eff - re$slack.x1),
                   x2 = c(tab3.3.dat$x2 * re$eff - re$slack.x2))

ref1
##   y  x1  x2
## 1 1 1.0 4.0
## 2 1 3.0 1.0
## 3 1 3.0 1.0
## 4 1 1.0 4.0
## 5 1 2.2 2.2
## 6 1 3.0 1.0

연습문제 5번

y <- c(1, 2, 4, 6, 7, 9, 9)
x <- c(3, 2, 6, 4, 8, 8, 10)

tab3.1.data <- data.frame(c(y, 8), c(x, 3))
tab3.1.frontier <- data.frame(y, x)
re <- dea(base = tab3.1.data, frontier = tab3.1.frontier, noutput = 1, orientation = 1, rts = 1, onlytheta = FALSE)

re
##         eff lambda1 lambda2 lambda3   lambda4 lambda5 lambda6 lambda7
## 1 0.2222222       0       0       0 0.1666667       0       0       0
## 2 0.6666667       0       0       0 0.3333333       0       0       0
## 3 0.4444444       0       0       0 0.6666667       0       0       0
## 4 1.0000000       0       0       0 1.0000000       0       0       0
## 5 0.5833333       0       0       0 1.1666667       0       0       0
## 6 0.7500000       0       0       0 1.5000000       0       0       0
## 7 0.6000000       0       0       0 1.5000000       0       0       0
## 8 1.7777778       0       0       0 1.3333333       0       0       0
##   slack.x1 slack.y1
## 1        0        0
## 2        0        0
## 3        0        0
## 4        0        0
## 5        0        0
## 6        0        0
## 7        0        0
## 8        0        0