# NOT RUN {
# }
# NOT RUN {
require( npsf )
# Prepare data and matrices
data( pwt56 )
head( pwt56 )
# Create some missing values
pwt56 [49, "K"] <- NA # just to create missing
Y1 <- as.matrix ( pwt56[ pwt56$year == 1965, c("Y"), drop = FALSE] )
X1 <- as.matrix ( pwt56[ pwt56$year == 1965, c("K", "L"), drop = FALSE] )
X1 [51, 2] <- NA # just to create missing
X1 [49, 1] <- NA # just to create missing
data( ccr81 )
head( ccr81 )
# Create some missing values
ccr81 [64, "x4"] <- NA # just to create missing
ccr81 [68, "y2"] <- NA # just to create missing
Y2 <- as.matrix( ccr81[ , c("y1", "y2", "y3"), drop = FALSE] )
X2 <- as.matrix( ccr81[ , c("x1", "x2", "x3", "x4", "x5"), drop = FALSE] )
# Compute output-based measures of technical efficiency under
# the assumption of CRS (the default) and perform bias-correctiion
# using smoothed homogeneous bootstrap (the default) with 999
# replications (the default).
t1 <- teradialbc ( y1 + y2 + y3 ~ x1 + x2 + x3 + x4 + x5,
data = ccr81)
# or just
t2 <- teradialbc ( Y2 ~ X2)
# Combined formula and matrix
t3 <- teradialbc ( Y ~ K + L, data = pwt56, subset = Nu < 10,
ref = Y1[-2,] ~ X1[-1,] )
# Compute input-based measures of technical efficiency under
# the assumption of VRS and perform bias-correctiion using
# subsampling heterogenous bootstrap with 1999 replications.
# Choose to report 99<!-- % confidence interval. The reference set -->
# formed by data points where x5 is not equal 10.
# Suppress printing dots.
t4 <- teradialbc ( y1 + y2 + y3 ~ x1 + x2 + x3 + x4 + x5,
data = ccr81, ref = y1 + y2 + y3 ~ x1 + x2 + x3 + x4 + x5,
subset.ref = x5 != 10, data.ref = ccr81, reps = 1999,
smoothed = FALSE, kappa = 0.7, dots = FALSE,
base = "i", rts = "v", level = 99)
# Compute input-based measures of technical efficiency under
# the assumption of NRS and perform bias-correctiion using
# smoothed heterogenous bootstrap with 499 replications for
# all data points. The reference set formed by data points
# where x5 is not equal 10.
t5 <- teradialbc ( y1 + y2 + y3 ~ x1 + x2 + x3 + x4 + x5,
data = ccr81, ref = y1 + y2 + y3 ~ x1 + x2 + x3 + x4 + x5,
subset.ref = x5 != 10, data.ref = ccr81, homogeneous = FALSE,
reps = 999, smoothed = TRUE, dots = TRUE, base = "i", rts = "n")
# ===========================
# === Parallel computing ===
# ===========================
# Perform previous bias-correction but use 8 cores and
# cluster type SOCK
t51 <- teradialbc ( y1 + y2 + y3 ~ x1 + x2 + x3 + x4 + x5,
data = ccr81, ref = y1 + y2 + y3 ~ x1 + x2 + x3 + x4 + x5,
subset.ref = x5 != 10, data.ref = ccr81, homogeneous = FALSE,
reps = 999, smoothed = TRUE, dots = TRUE, base = "i", rts = "n",
core.count = 8, cl.type = "SOCK")
# Really large data-set
data(usmanuf)
head(usmanuf)
nrow(usmanuf)
table(usmanuf$year)
# This will take some time depending on computer power
data(usmanuf)
head(usmanuf)
t6 <- teradialbc ( Y ~ K + L + M, data = usmanuf,
subset = year >= 1999 & year <= 2000, homogeneous = FALSE,
base = "o", reps = 100,
core.count = 8, cl.type = "SOCK")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab