# \donttest{
# Example 1.
library(deaR)
data("Coll_Blasco_2006")
ni <- 2 # number of inputs
no <- 2 # number of outputs
data_example <- make_deadata(datadea = Coll_Blasco_2006,
ni = ni,
no = no)
nd <- length(data_example$dmunames) # number of DMUs
var_input <- matrix(1, nrow = ni, ncol = nd)
var_output <- matrix(1, nrow = no, ncol = nd)
data_stoch <- make_deadata_stoch(datadea = data_example,
var_input = var_input,
var_output = var_output)
# Evaluate the sixth DMU
Collstoch <- modelstoch_radial(data_stoch, dmu_eval = 6)
efficiencies(Collstoch)
# Example 2. Deterministic data with one stochastic input.
library(deaR)
dmunames <- c("A", "B", "C")
nd <- length(dmunames) # Number of DMUs
inputnames <- c("Input_1", "Input_2")
ni <- length(inputnames) # Number of Inputs
outputnames <- c("Output_1", "Output_2", "Output_3")
no <- length(outputnames) # Number of Outputs
X <- matrix(c(5, 14, 8, 15, 7, 12),
nrow = ni, ncol = nd, dimnames = list(inputnames, dmunames))
Y <- matrix(c(9, 4, 16, 5, 7, 10, 4, 9, 13),
nrow = no, ncol = nd, dimnames = list(outputnames, dmunames))
datadea <- make_deadata(inputs = X,
outputs = Y)
covX <- array(0, dim = c(2, 3, 3))
# The 2nd input is stochastic.
# Since the corresponding 3x3 covariances matrix is symmetric, only values
# above the diagonal are necessary.
covX[2, 1, ] <- c(1.4, 0.9, 0.6)
covX[2, 2, 2:3] <- c(1.5, 0.7)
covX[2, 3, 3] <- 1.2
# Alternatively (note that values below the diagonal are ignored).
covX[2, , ] <- matrix(c(1.4, 0.9, 0.6, 0, 1.5, 0.7, 0, 0, 1.2),
nrow = 3,
byrow = TRUE)
datadea_stoch <- make_deadata_stoch(datadea,
cov_input = covX)
alpha <- 0.025
res <- modelstoch_radial(datadea_stoch,
alpha = alpha,
rts = "vrs")
efficiencies(res)
# }
# Example 3. Replication of results in Land et al. (1993)
library(deaR)
data("PFT1981")
# Selecting DMUs in Program Follow Through (PFT)
PFT <- PFT1981[1:49, ]
PFT <- make_deadata(PFT,
inputs = 2:6,
outputs = 7:9)
c <- 0.5
var_output <- matrix(c^2, nrow = 3, ncol = 49)
PFT_stoch <- make_deadata_stoch(datadea = PFT, var_output = var_output)
# Evaluate the second DMU
res <- modelstoch_radial(PFT_stoch, dmu_eval = 2)
efficiencies(res)
Run the code above in your browser using DataLab