Title: | Productivity and Efficiency Analysis using DEA |
---|---|
Description: | Measure productivity and efficiency using Data Envelopment Analysis (DEA). Available methods include DEA under different technology assumptions, bootstrapping of efficiency scores and calculation of the Malmquist productivity index. Analyses can be performed either in the console or with the provided 'shiny' app. See Banker, R.; Charnes, A.; Cooper, W.W. (1984) <doi:10.1287/mnsc.30.9.1078>, Färe, R.; Grosskopf, S. (1996) <doi:10.1007/978-94-009-1816-0>. |
Authors: | Ove Haugland Jakobsen [aut, cre], Aleksander Eilertsen Valberg [aut], Jan Roar Beckstrøm [ctb], Lars Skaage Engebretsen [ctb], Jonas Månsson [ctb], Joachim Sandnes [ctb], National Audit Office of Norway [cph] |
Maintainer: | Ove Haugland Jakobsen <[email protected]> |
License: | GPL-3 |
Version: | 0.5.0 |
Built: | 2024-10-26 03:38:28 UTC |
Source: | CRAN |
Run bootstrap on a DEA model to estimate bias corrected efficiency scores and confidence intervals.
bootstrap_dea(dea, alpha = 0.05, bw_rule = "ucv", iterations = 2000)
bootstrap_dea(dea, alpha = 0.05, bw_rule = "ucv", iterations = 2000)
dea |
An object of class 'pioneer_dea' from |
alpha |
One minus the confidence level required. Default is 0.05. |
bw_rule |
A string with the type of bandwidth rule to be used, or a number with the bandwidth parameter. See details. |
iterations |
The number of bootstrap iterations to perform. Default is 2000. |
In order to bootstrap a DEA model, you must first create a model object using the
compute_dea()
function. Note that you currently can only bootstrap models using
constant or variable returns to scale (RTS). If you try to bootstrap a model using another
RTS, the bootstrap will fail with an error message.
The bandwidth argument can be set to either ucv
for unbiased cross validation,
silverman
for the Silverman rule, or scott
for the Scott rule. If you provide a
number, this will be used directly as the bandwidth parameter h
. This can be useful
to replicate results where h
is given, such as Simar & Wilson (1998). For most practical
applications of the bootstrap, the default value of unbiased cross validation is sensible.
A list of class pioneer_bootstrap
.
# Load example data fare89 <- deaR::Electric_plants # Estimate efficiency mod <- compute_dea( data = fare89, input = c("Labor", "Fuel", "Capital"), output = "Output", id = "Plant", ) # Run bootstrap. Reducing the number of iterations to save processing time boot <- bootstrap_dea(mod, iterations = 100) # Print results print(boot) # Get summary summary(boot)
# Load example data fare89 <- deaR::Electric_plants # Estimate efficiency mod <- compute_dea( data = fare89, input = c("Labor", "Fuel", "Capital"), output = "Output", id = "Plant", ) # Run bootstrap. Reducing the number of iterations to save processing time boot <- bootstrap_dea(mod, iterations = 100) # Print results print(boot) # Get summary summary(boot)
Solve an input or output oriented DEA model under constant (crs
), variable (vrs
),
non-increasing (drs
), or non-decreasing (irs
) returns to scale.
compute_dea( data, input, output, id = NULL, rts = c("crs", "vrs", "drs", "irs"), orientation = c("in", "out"), super = FALSE, slack = FALSE, peers = FALSE )
compute_dea( data, input, output, id = NULL, rts = c("crs", "vrs", "drs", "irs"), orientation = c("in", "out"), super = FALSE, slack = FALSE, peers = FALSE )
data |
Dataset to analyse. |
||||||||||||||||
input |
A character vector with input variables. |
||||||||||||||||
output |
A character vector with output variables. |
||||||||||||||||
id |
Optional. A string with the DMU id or name variable. Defaults to the rownames of the dataset. |
||||||||||||||||
rts |
Returns to scale.
|
||||||||||||||||
orientation |
Model orientation. |
||||||||||||||||
super |
If |
||||||||||||||||
slack |
If |
||||||||||||||||
peers |
If |
A list of class pioneer_dea
.
# Load example data fare89 <- deaR::Electric_plants # Estimate efficiency mod <- compute_dea( data = fare89, input = c("Labor", "Fuel", "Capital"), output = "Output", id = "Plant", rts = "vrs", orientation = "in" ) # Print results print(mod) # Get summary summary(mod) # Convert to data frame df <- as.data.frame(mod)
# Load example data fare89 <- deaR::Electric_plants # Estimate efficiency mod <- compute_dea( data = fare89, input = c("Labor", "Fuel", "Capital"), output = "Output", id = "Plant", rts = "vrs", orientation = "in" ) # Print results print(mod) # Get summary summary(mod) # Convert to data frame df <- as.data.frame(mod)
Calculate the Malmquist productivity index and its components using Data Envelopment Analysis.
compute_malmquist(data, input, output, id, time, orientation = c("in", "out"))
compute_malmquist(data, input, output, id, time, orientation = c("in", "out"))
data |
Dataset to analyse. |
input |
A character vector with input variables. |
output |
A character vector with output variables. |
id |
A string with the DMU id or name variable. |
time |
A string with the time period variable. |
orientation |
Model orientation. |
Results are returned a la Farrell. This implies that for output-oriented models values above one signify improvements in productivity, while values less than one imply deterioration in productivity. For input-oriented models the interpretation is reversed; values less than one denote improvements and values above one denote deterioration.
Note that compute_malmquist()
only works for balanced panel datasets.
A list of class pioneer_mlm
Färe, R., Grosskopf, S. (1996). Intertemporal production frontiers: With dynamic DEA. Springer.
# Load example data chnEconomy <- deaR::EconomyLong # Estimate Malmquist mod <- compute_malmquist( data = chnEconomy, id = 'DMUs', time = 'Period', input = c('Labor', 'Capital'), output = 'GIOV', orientation = 'in') # Print results print(mod) # Get summary summary(mod) # Convert to data frame df <- as.data.frame(mod)
# Load example data chnEconomy <- deaR::EconomyLong # Estimate Malmquist mod <- compute_malmquist( data = chnEconomy, id = 'DMUs', time = 'Period', input = c('Labor', 'Capital'), output = 'GIOV', orientation = 'in') # Print results print(mod) # Get summary summary(mod) # Convert to data frame df <- as.data.frame(mod)
Calculate scale efficiency from a set of inputs and outputs and return a data.frame
compute_scale_efficiency(x, y, orientation = c("in", "out"), digits = NULL)
compute_scale_efficiency(x, y, orientation = c("in", "out"), digits = NULL)
x |
A matrix of inputs, created with |
y |
A matrix of outputs, created with |
orientation |
|
digits |
An integer with the number of digits to round to. If |
A data frame containing the efficiency scores for CRS, VRS, the Scale Efficiency, the VRS to NIRS ratio, and a recommendation on whether to increase or decrease the size of the DMU.
# Create matrices with random values inputs <- matrix(runif(10, 1, 10), ncol = 2) outputs <- matrix(runif(10, 1, 10), ncol = 2) # Compute scale efficiency res <- compute_scale_efficiency( inputs, outputs, orientation = 'out', digits = 2)
# Create matrices with random values inputs <- matrix(runif(10, 1, 10), ncol = 2) outputs <- matrix(runif(10, 1, 10), ncol = 2) # Compute scale efficiency res <- compute_scale_efficiency( inputs, outputs, orientation = 'out', digits = 2)
Create a matrix for input or output variables that can be used in DEA models from a supplied data.frame
create_matrix(df, columns, id, normalize = FALSE)
create_matrix(df, columns, id, normalize = FALSE)
df |
A data.frame containing the data. |
columns |
A character vector of column names to include in the matrix. |
id |
A character string specifying the column with DMU IDs. |
normalize |
A logical indicating whether to normalize the columns by their
mean. Defaults to |
A matrix of inputs or outputs
df <- data.frame(id = 1:3, a = c(10, 20, 30), b = c(5, 15, 25)) create_matrix(df, columns = c("a", "b"), id = "id", normalize = TRUE)
df <- data.frame(id = 1:3, a = c(10, 20, 30), b = c(5, 15, 25)) create_matrix(df, columns = c("a", "b"), id = "id", normalize = TRUE)
Run the pioneeR app on your local machine.
run_pioneer(x = NULL, port = NULL, ...)
run_pioneer(x = NULL, port = NULL, ...)
x |
A data frame that should be loaded with the app. See details. |
port |
Integer. The TCP port that the application should listen on. |
... |
Other arguments to send to |
Note that pioneeR must be loaded into the namespace with library(pioneeR)
before you run the pioneeR app.
You can load a data object in your current environment to the app. You can pass
a data frame or a character string with the object name of the data frame you
want to be loaded when the app launches. Note that you should only use data
frame objects. If you have a tibble (from the tidyverse) or a data table, you
can convert to an ordinary data.frame using as.data.frame()
None
# Only run this example in interactive R sessions if (interactive()) { df = deaR::Electric_plants # Load app with data.frame and set port to 8080 run_pioneer(x = df, port = 8080) }
# Only run this example in interactive R sessions if (interactive()) { df = deaR::Electric_plants # Load app with data.frame and set port to 8080 run_pioneer(x = df, port = 8080) }
Create a binned summary table for efficiency scores from a DEA model.
summary_tbl_dea(x)
summary_tbl_dea(x)
x |
A numeric vector of efficiency scores or an object of class |
The function will return a summary table for efficiency scores from a DEA model.
Efficiency scores will be placed in 11 bins, where DMUs with an efficiency score
equal to 1 are placed in a separate bin. For output oriented models with range
[1, Inf], bins are created with 1/bin
. Bin widths will be equal to models
with range [0, 1].
A data.frame()
with summary statistics
# Load example data fare89 <- deaR::Electric_plants # Estimate efficiency mod <- compute_dea( data = fare89, input = c("Labor", "Fuel", "Capital"), output = "Output", rts = "vrs" ) # Get a summary table of efficiency scores summary_tbl_dea(mod) # You can also create the table from a numeric vector of efficiency scores res <- as.data.frame(mod) summary_tbl_dea(res$efficiency)
# Load example data fare89 <- deaR::Electric_plants # Estimate efficiency mod <- compute_dea( data = fare89, input = c("Labor", "Fuel", "Capital"), output = "Output", rts = "vrs" ) # Get a summary table of efficiency scores summary_tbl_dea(mod) # You can also create the table from a numeric vector of efficiency scores res <- as.data.frame(mod) summary_tbl_dea(res$efficiency)
Unsets the environment variables set by pioneeR
unset_env_vars()
unset_env_vars()
A logical vector, with elements being TRUE
if unsetting the variable succeeded
unset_env_vars()
unset_env_vars()