Package 'rDEA'

Title: Robust Data Envelopment Analysis (DEA) for R
Description: Data Envelopment Analysis for R, estimating robust DEA scores without and with environmental variables and doing returns-to-scale tests.
Authors: Jaak Simm [aut, cre], Galina Besstremyannaya [aut]
Maintainer: Jaak Simm <[email protected]>
License: GPL-2 | GPL-3
Version: 1.2-8
Built: 2024-11-25 06:51:32 UTC
Source: CRAN

Help Index


Data envelopment analysis scores

Description

Naive scores in input-oriented, output-oriented and cost-minimization DEA models

Usage

dea(XREF, YREF, X, Y, W=NULL, model, RTS="variable")

Arguments

XREF

a matrix of inputs for observations used for constructing the frontier.

YREF

a matrix of outputs for observations used for constructing the frontier.

X

a matrix of inputs for observations, for which DEA scores are estimated.

Y

a matrix of outputs for observations, for which DEA scores are estimated.

W

a matrix of input prices for observations, for which DEA scores are estimated in cost-minimization model, W=NULL for input- and output-oriented models.

model

a string for the type of DEA model to be estimated, "input" for input-oriented, "output" for output-oriented, "costmin" for cost-minimization model.

RTS

a string for returns-to-scale under which DEA scores are estimated, RTS can be "constant", "variable" or "non-increasing".

Details

Estimates technical efficiency scores (input- and output-oriented DEA models) and cost efficiency score (cost-minimization DEA).

Value

A list containing the optimal solutions for linear optimization problem for each firm, with the following components.

thetaOpt

a vector of DEA scores in input- or output-oriented model, thetaOpt is in (0,1).

gammaOpt

a vector of DEA scores in cost-minimization model.

XOpt

the matrix of optimal values of inputs, only returned for cost-minimization model.

lambda

the matrix of values for constraint coefficients in the corresponding linear optimization problem, lambda >=0.

lambda_sum

the vector for sum of constraint coefficients in the corresponding linear optimization problem, lamdba_sum=1 for variable returns-to-scale, lambda_sum <=1 for non-increasing returns-to-scale.

Author(s)

Jaak Simm, Galina Besstremyannaya

References

Charnes, A. and Cooper, W. and Rhodes, E. 1978. Measuring the efficiency of decision making units. European Journal of Operational Research. Vol.2, pp.429–444.

Fare, R. and Grosskopf, S. and Lovell, C.A. 1985. The Measurement of Efficiency in Production. Kluwer Academic Publishers.

Coelli, T.J. and Rao, D.S.P. and Battese, G.E. 1994. An Introduction to Efficiency and Productivity Analysis. Kluwer Academic Publishers.

The Measurement of Productive Efficiency and Productivity Growth. 2008. O'Fried, H. and Lovell, C.A.K. and Schmidt, S.S., eds. Oxford University Press.

Besstremyannaya, G. 2011. Managerial performance and cost efficiency of Japanese local public hospitals. Health Economics. Vol.20(S1), pp.19–34.

Besstremyannaya, G. 2013. The impact of Japanese hospital financing reform on hospital efficiency. Japanese Economic Review. Vol.64, No.3, pp.337–362.

Besstremyannaya G., Simm J., Golovan S. 2014. Robust non-parametric estimation of cost efficiency with an application to banking industry. Working paper.

See Also

dea.robust, dea.env.robust and hospitals.

Examples

## load data on Japanese hospitals (Besstremyannaya 2013, 2011)
data("hospitals", package="rDEA")

## inputs and outputs for analysis
Y = hospitals[c('inpatients', 'outpatients')]
X = hospitals[c('labor', 'capital')]
W = hospitals[c('labor_price', 'capital_price')]

## Naive input-oriented DEA score for the first 20 firms under variable returns-to-scale
firms=1:20
di_naive = dea(XREF=X, YREF=Y, X=X[firms,], Y=Y[firms,], model="input", RTS="variable")
di_naive$thetaOpt

## Naive DEA score in cost-minimization model for the first 20 firms under variable returns-to-scale
ci_naive = dea(XREF=X, YREF=Y, X=X[firms,], Y=Y[firms,], W=W[firms,],
               model="costmin", RTS="variable")
ci_naive$XOpt
ci_naive$gammaOpt

Bias-corrected data envelopment analysis with environmental variables

Description

Estimates bias-corrected efficiency scores in input- and output-oriented DEA models with environmental (exogenous) variables

Usage

dea.env.robust (X, Y, W=NULL, Z, model, RTS="variable",
                L1=100, L2=2000, alpha=0.05)

Arguments

X

a matrix of inputs for observations, for which DEA scores are estimated.

Y

a matrix of outputs for observations, for which DEA scores are estimated.

W

a matrix of input prices, only used if model="costmin".

Z

a matrix of environmental variables for observations, for which DEA scores are estimated. Constant is automatically included in Z.

model

a string for the type of DEA model to be estimated, "input" for input-oriented, "output" for output-oriented, "costmin" for cost-minimization model.

RTS

a string for returns-to-scale under which DEA scores are estimated, RTS can be "constant", "variable" or "non-increasing".

L1

an integer showing the number of bootstrap replications in the first loop of Simar and Wilson's (2007) algorithm, default is 100.

L2

an integer showing the number of bootstrap replications in the second loop of Simar and Wilson's (2007) algorithm, default is 2000.

alpha

a number in (0,1) denoting the size of confidence interval for the bias-corrected DEA score, default is 0.05.

Details

Implements Simar and Wilson's (2007) second algorithm for bias-correction of technical efficiency scores in input- and output-oriented DEA models. Computations are done in terms of distance function, i.e. the reciprocal of efficiency score, with the range from one to infinity.

Value

A list containing bias-corrected scores for each firm, with the following components.

delta_hat

the vector of the reciprocal of DEA score (distance function), estimated in input or output-oriented model in with dea function.

beta_hat

the vector of coefficients in the truncated regression of the reciprocal of DEA score on environmental variables.

sigma_hat

the standard deviation of the errors in the truncated regression of reciprocal of DEA score on environmental variables.

beta_hat_hat

the vector of robust coefficients in the truncated regression of reciprocal of DEA score on environmental variables (after the second loop).

sigma_hat_hat

the robust standard deviation of the errors in the truncated regression of reciprocal of DEA score on environmental variables (after the second loop).

delta_hat_hat

the vector of robust reciprocal of DEA score (after the second loop).

bias

the vector of bias of the reciprocal of DEA score, bias is non-positive.

delta_ci_low

the vector of the lower bounds of confidence interval for delta_hat_hat (bias-corrected reciprocal of DEA score).

delta_ci_high

the vector of the upper bounds of confidence interval for delta_hat_hat (bias-corrected reciprocal of DEA score).

beta_ci

the matrix of lower and upper bounds for beta using alpha confidence intervals (beta is robust coefficients in the truncated regression of the reciprocal of DEA score on environmental variables).

sigma_ci

the matrix of lower and upper bounds for sigma using alpha confidence intervals (sigma is the robust standard deviation in the truncated regression of the reciprocal of DEA score on environmental variables).

Author(s)

Jaak Simm, Galina Besstremyannaya

References

Simar, L. and Wilson, P.W. 2007. Estimation and inference in two-stage, semi-parametric models of production processes. Journal of Econometrics. Vol.136, pp.31–64.

The Measurement of Productive Efficiency and Productivity Growth. 2008. O'Fried, H. and Lovell, C.A.K. and Schmidt, S.S., eds. Oxford University Press.

Simar, L. and Wilson, P. 2011. Two-stage DEA: caveat emptor. Journal of Productivity Analysis. Vol.36, pp.205–218.

Besstremyannaya, G. 2011. Managerial performance and cost efficiency of Japanese local public hospitals. Health Economics. Vol.20(S1), pp.19–34.

Besstremyannaya, G. 2013. The impact of Japanese hospital financing reform on hospital efficiency. Japanese Economic Review. Vol.64, No.3, pp.337–362.

See Also

dea, dea.robust and hospitals.

Examples

## load data on Japanese hospitals (Besstremyannaya 2013, 2011)
data("hospitals", package="rDEA")
Y = hospitals[c('inpatients', 'outpatients')]
X = hospitals[c('labor', 'capital')]
Z = hospitals[c('z1')]

## Naive input-oriented DEA score for the first 20 firms
## under variable returns-to-scale
firms=1:20
di_naive = dea(XREF=X, YREF=Y, X=X[firms,], Y=Y[firms,],
               model="input", RTS="variable")
di_naive$thetaOpt

## added only for testing of the manual
library(maxLik)

## Bias-corrected DEA score in input-oriented model
## with environmental variables, variable returns-to-scale
di_env = dea.env.robust(
             X=X[firms,], Y=Y[firms,], Z=Z[firms,], model="input",
             RTS="variable", L2=100, alpha=0.05)
di_env$delta_hat_hat

Bias-corrected data envelopment analysis

Description

Estimates bias-corrected scores for input- and output-oriented models

Usage

dea.robust (X, Y, W=NULL, model, RTS="variable", B=1000, alpha=0.05, 
            bw="bw.ucv", bw_mult=1)

Arguments

X

a matrix of inputs for observations, for which DEA scores are estimated.

Y

a matrix of outputs for observations, for which DEA scores are estimated.

W

a matrix of input prices, only used if model="costmin".

model

a string for the type of DEA model to be estimated, "input" for input-oriented, "output" for output-oriented, "costmin" for cost-minimization model.

RTS

a string for returns-to-scale under which DEA scores are estimated, RTS can be "constant", "variable" or "non-increasing".

B

an integer showing the number of bootstrap replications, the default is B=1000.

alpha

a number in (0,1) for the size of confidence interval for the bias-corrected DEA score.

bw

a string for the type of bandwidth used as a smoothing parameter in sampling with reflection, "cv" or "bw.ucv" for cross-validation bandwidth, "silverman" or "bw.nrd0" for Silverman's (1986) rule.

bw_mult

bandwidth multiplier, default is 1 that means no change.

Details

Implements Simar and Wilson's (1998) bias-correction of technical efficiency scores in input- and output-oriented DEA models.

Value

A list containing bias-corrected scores for each firm, with the following components.

theta_hat_hat

the vector of bias-corrected DEA score for each firm, theta_hat_hat is in the range of zero to one.

bias

the vector of bias for naive DEA scores, bias is non-negative.

theta_ci_low

the vector for the lower bounds of confidence interval for bias-corrected DEA score.

theta_ci_high

the vector for the upper bounds of confidence interval for bias-corrected DEA score.

Author(s)

Jaak Simm, Galina Besstremyannaya

References

Silverman, B.W. 1986. Density Estimation for Statistics and Data Analysis.Chapman and Hall, New York.

Simar, L. and Wilson, P.W. 1998. Sensitivity analysis of efficiency scores: how to bootstrap in nonparametric frontier models. Management Science. Vol.44, pp.49–61.

Simar, L. and Wilson, P. 2000. A general methodology for bootstrapping in non-parametric frontier models. Journal of Applied Statistics. Vol.27, No.6, pp.779–802.

Badin, L. and Simar, L. 2003. Confidence intervals for DEA-type efficiency scores: how to avoid the computational burden of the bootstrap. IAP Statistics Network, Technical report 0322, http://sites.uclouvain.be/IAP-Stat-Phase-V-VI/PhaseV/publications_2003/TR/TR0322.pdf

Kneip, A. and Simar, L. and Wilson, P.W. 2008. Asymptotics and consistent bootstraps for DEA estimators in nonparametric frontier models. Econometric Theory. Vol.24, pp.1663–1697.

Kneip, A. and Simar, L. and Wilson, P.W. 2011. A computationally efficient, consistent bootstrap for inference with non-parametric DEA estimators. Computational Economics. Vol.38, pp.483–515.

Besstremyannaya, G. 2011. Managerial performance and cost efficiency of Japanese local public hospitals. Health Economics. Vol.20(S1), pp.19–34.

Besstremyannaya, G. 2013. The impact of Japanese hospital financing reform on hospital efficiency. Japanese Economic Review. Vol.64, No.3, pp.337–362.

See Also

dea, dea.env.robust and hospitals.

Examples

## load data on Japanese hospitals (Besstremyannaya 2013, 2011)
data("hospitals", package="rDEA")
Y = hospitals[c('inpatients', 'outpatients')]
X = hospitals[c('labor', 'capital')]

## Naive input-oriented DEA score for the first 20 firms under variable returns-to-scale
firms=1:20
di_naive = dea(XREF=X, YREF=Y, X=X[firms,], Y=Y[firms,],
               model="input", RTS="variable")
di_naive$thetaOpt

## Bias-corrected DEA score in input-oriented model under variable returns-to-scale
di_robust = dea.robust(X=X[firms,], Y=Y[firms,], model="input",
                       RTS="variable", B, alpha=0.05, bw="cv")
di_robust$theta_hat_hat
di_robust$bias

Data on Japanese local public hospitals

Description

Administrative dataset for financial variables and selected characteristics of Japanese local public hospitals. Processed for fiscal year 1999 (Heisei 11) and exploited in Besstremyannaya (2013, 2011)

Usage

hospitals

Format

The processed dataset contains anonymous observations for 958 local public hospitals, identified by a researcher-generated variable "firm_id". Hospital outputs are annual numbers of inpatients and outpatients, denoted, "inpatients" and "outpatients", respectively. Hospital inputs are "labour" (total number of employees) and "capital" (total number of beds). The price of labor is per capita annual salary (th.yen) and the price of capital is the sum of depreciation and interest per bed (th.yen). Corresponding variable names are "labor_price" and "capital_price". A vector of environmental variables (z1) is the number of examinations per 100 patients.

References

Besstremyannaya, G. 2011. Managerial performance and cost efficiency of Japanese local public hospitals. Health Economics. Vol.20(S1), pp.19–34.

Besstremyannaya, G. 2013. The impact of Japanese hospital financing reform on hospital efficiency. Japanese Economic Review. Vol.64, No.3, pp.337–362.

Examples

data("hospitals", package="rDEA")
Y = hospitals[c('inpatients', 'outpatients')]
X = hospitals[c('labor', 'capital')]
W = hospitals[c('labor_price', 'capital_price')]
Z= hospitals[c('z1')]

## DEA score in input-oriented model
firms=1:20
di_naive = dea(XREF=X, YREF=Y, X=X[firms,], Y=Y[firms,], model="input", RTS="variable")
di_naive$thetaOpt

## added only for testing of the manual
library(maxLik)

## robust DEA score in input-oriented model with environmental inputs
di_env = dea.env.robust(X=X[firms,], Y=Y[firms,], Z=Z[firms,],
                        model="input", RTS="variable", L1, L2=100, alpha=0.05)
di_env$delta_hat_hat

## DEA score in cost-minimization model
ci_naive = dea(XREF=X, YREF=Y, X=X[firms,], Y=Y[firms,], W=W[firms,],
               model="costmin", RTS="variable")
ci_naive$XOpt
ci_naive$gammaOpt

Multi Problem Solver for Linear and Mixed Integer Programming Using GLPK

Description

High level R interface to the GNU Linear Programming Kit (GLPK) for solving multiple linear as well as mixed integer linear programming (MILP) problems. Solving multiple problems at the same time allows to avoid R communication overhead, critical when solving many small problems.

Usage

multi_glpk_solve_LP(obj, mat, dir, rhs, bounds = NULL, types = NULL, max = FALSE,
          control = list(),
          mobj_i = NULL, mobj_val = NULL,
          mmat_i = NULL, mmat_val = NULL,
          mrhs_i = NULL, mrhs_val = NULL,
          ...)

Arguments

obj

a numeric vector representing the objective coefficients.

mat

a numeric vector or a matrix of constraint coefficients.

dir

a character vector with the directions of the constraints. Each element must be one of "<", "<=", ">", ">=", or "==".

rhs

the right hand side of the constraints.

bounds

NULL (default) or a list with elements upper and lower containing the indices and corresponding bounds of the objective variables. The default for each variable is a bound between 0 and Inf.

types

a character vector indicating the types of the objective variables. types can be either "B" for binary, "C" for continuous or "I" for integer. By default NULL, taken as all-continuous. Recycled as needed.

max

a logical giving the direction of the optimization. TRUE means that the objective is to maximize the objective function, FALSE (default) means to minimize it.

control

a list of parameters to the solver. Currently the only options are: verbose, a logical for turning on/off additional solver output; canonicalize_status, a logical indicating whether to canonicalize GLPK status codes or not. Defaults: FALSE; TRUE.

mobj_i

a vector of objective coefficient indices which will get different values in each optimization problem. Defaults: NULL.

mobj_val

a matrix of objective coefficient values. Each column specifies for one optimization problem the values of the objective coefficients specified by in mobj_i.

mmat_i

a matrix of coordinates of mat matrix. Each row specifies one constraint cell (its row and column). The cell specified in row i will be assigned values from row i of matrix mmat_val. Cells not specified in mat will be left unchanged. Defaults: NULL.

mmat_val

a matrix of values, each column specifies values for one optimization task. Cell specified in row i in mmat_i gets values from row i of mmat_val. Defaults: NULL.

mrhs_i

a vector of RHS constraint rows that will get different values in each optimization problem. Defaults: NULL.

mrhs_val

a matrix of RHS values. Element mrhs_val[i,j] specifies RHS value for row mrhs_i[i] in optimization problem j. Defaults: NULL.

...

a list of control parameters (overruling those specified in control).

Details

Package rDEA provides method for Data Envelopment Analysis (DEA), including standard input, output and cost-minimization DEA estimation and also robust DEA solvers. The latter can be with or without additional environmental variables.

Value

A list containing the optimal solutions for each problem, with the following components.

solution

the matrix of optimal coefficients, each column is one problem

objval

the vector of values of the objective function at the optimum, for each problem

status

the vector of integers with status information about the solution returned, for each problem. If the control parameter canonicalize_status is set (the default) then it will return 0 for the optimal solution being found, and non-zero otherwise. If the control parameter is set to FALSE it will return the GLPK status codes.

Author(s)

Jaak Simm

References

GNU Linear Programming Kit (http://www.gnu.org/software/glpk/glpk.html).

See Also

glpk and glpkAPI for C API bindings; Rglpk_solve in package Rglpk.

Examples

## Simple linear program.
## maximize:   2 x_1 + 4 x_2 + 3 x_3
## subject to: 3 x_1 + 4 x_2 + 2 x_3 <= 60
##             2 x_1 +   x_2 + 2 x_3 <= 40
##               x_1 + 3 x_2 + 2 x_3 <= 80
##               x_1, x_2, x_3 are non-negative real numbers

obj <- c(2, 4, 3)
mat <- matrix(c(3, 2, 1, 4, 1, 3, 2, 2, 2), nrow = 3)
dir <- c("<=", "<=", "<=")
rhs <- c(60, 40, 80)
max <- TRUE

multi_glpk_solve_LP(obj, mat, dir, rhs, max = max)

## Simple mixed integer linear program.
## maximize:    3 x_1 + 1 x_2 + 3 x_3
## subject to: -1 x_1 + 2 x_2 +   x_3 <= 4
##                      4 x_2 - 3 x_3 <= 2
##                x_1 - 3 x_2 + 2 x_3 <= 3
##                x_1, x_3 are non-negative integers
##                x_2 is a non-negative real number

obj <- c(3, 1, 3)
mat <- matrix(c(-1, 0, 1, 2, 4, -3, 1, -3, 2), nrow = 3)
dir <- c("<=", "<=", "<=")
rhs <- c(4, 2, 3)
types <- c("I", "C", "I")
max <- TRUE

multi_glpk_solve_LP(obj, mat, dir, rhs, types = types, max = max)

## Same as before but with bounds replaced by
## -Inf <  x_1 <= 4
##    0 <= x_2 <= 100
##    2 <= x_3 <  Inf

bounds <- list(lower = list(ind = c(1L, 3L), val = c(-Inf, 2)),
               upper = list(ind = c(1L, 2L), val = c(4, 100)))
multi_glpk_solve_LP(obj, mat, dir, rhs, bounds, types, max)

## Examples from the GLPK manual
## Solver output enabled

## 1.3.1
## maximize:   10 x_1 + 6 x_2 + 4 x_3
## subject to:    x_1 +   x_2 +   x_3 <= 100
##             10 x_1 + 4 x_2 + 5 x_3 <= 600
##              2 x_1 + 2 x_2 + 6 x_3 <= 300
##                x_1,    x_2,    x_3 are non-negative real numbers

obj <- c(10, 6, 4)
mat <- matrix(c(1, 10, 2, 1, 4, 2, 1, 5, 6), nrow = 3)
dir <- c("<=", "<=", "<=")
rhs <- c(100, 600, 300)
max <- TRUE

multi_glpk_solve_LP(obj, mat, dir, rhs, max = max, control = list("verbose" =
TRUE, "canonicalize_status" = FALSE))

Test for returns-to-scale in data envelopment analysis

Description

Tests for returns-to-scale in input- and output-oriented DEA models

Usage

rts.test(X, Y, W=NULL, model, H0, bw, B, alpha)

Arguments

X

a matrix of inputs for observations, for which DEA scores are estimated.

Y

a matrix of outputs for observations, for which DEA scores are estimated.

W

a matrix of input prices, only used if model="costmin".

model

a string for the type of DEA model to be estimated, "input" for input-oriented, "output" for output-oriented model, "costmin" for cost-minimization model.

H0

a string for the NULL hypothesis to be tested, "constant" for constant returns-to-scale, "non-increasing" for non-inscreasing returns-to-scale.

bw

a string for the type of bandwidth used as a smoothing parameter in sampling with reflection, "cv" or "bw.ucv" for cross-validation bandwidth, "silverman" or "bw.nrd0" for Silverman's (1986) rule.

B

an integer showing the number of bootstrap replications in constracting the test staticstics. Recommended is 100.

alpha

a number in (0,1) for the size of confidence interval for the test statistics.

Details

Implements Simar and Wilson's (2002, 2011) returns-to-scale tests for input- and output-oriented DEA models, using ratio of means, mean of ratios or mean of ratios less unity of DEA scores under the null and the alternative hypotheses as test statistics (denoted respectively, statistics 4.5 and 4.6 in Simar and Wilson (2002) and statistics 48 in Simar and Wilson (2011)). Tests the null hypothesis of constant returns to scale vs. the alternative hypothesis of variable returns to scale, and the null hypothesis of non-increasing returns to scale vs. the alternative hypothesis of variable returns to scale.

Value

A list containing the results of returns-to-scale test, with the following components.

w_hat

the vector for the values of the test statistics 4.5.

w48_hat

the vector for the values of the test statistics 48 or statistics 4.6.

theta_H0_hat

the vector for the values of naive DEA scores under the Null hypothesis (H0).

theta_vrs_hat

the vector for the values of naive DEA scores under the alternative hypothesis.

w_hat_boot

the vector for bootstrap values of the test statistics 4.5.

w48_hat_boot

the vector for bootstrap values of the test statistics 48 or statistics 46.

pvalue

the p-value for rejecting the Null hypothesis, according to test statistics 4.5.

pvalue48

the p-value for rejecting the Null hypothesis, according to test statistics 4.6 and 48.

H0reject

FALSE if H0 is not rejected according to pvalue45 and confidence level alpha, TRUE otherwise.

H0reject48

FALSE if H0 is not rejected according to pvalue48 and confidence level alpha, TRUE otherwise.

H0level

the cut-off value of w45_hat_boot for confidence level alpha.

H0level48

the cut-off value of w48_hat_boot for confidence level alpha.

H0

the Null hypothesis tested.

bw

the type of bandwidth employed.

bw_value

the value for the bandwidth.

Author(s)

Jaak Simm, Galina Besstremyannaya

References

Silverman, B.W. 1986. Density Estimation for Statistics and Data Analysis.Chapman and Hall, New York.

Simar, L. and Wilson, P. 2002. Non-parametric tests of returns to scale. European Journal of Operational Research. Vol.139, No.1, pp.115–132.

The Measurement of Productive Efficiency and Productivity Growth. 2008. O'Fried, H. and Lovell, C.A.K. and Schmidt, S.S., eds. Oxford University Press.

Simar, L. and Wilson, P. 2011. Inference by the m out of n bootstrap in nonparametric frontier models. Journal of Productivity Analysis. Vol.36, pp.33–53.

Besstremyannaya, G. 2011. Managerial performance and cost efficiency of Japanese local public hospitals. Health Economics. Vol.20(S1), pp.19–34.

Besstremyannaya, G. 2013. The impact of Japanese hospital financing reform on hospital efficiency. Japanese Economic Review. Vol.64, No.3, pp.337–362.

Besstremyannaya G., Simm J., Golovan S. 2014. Robust non-parametric estimation of cost efficiency with an application to banking industry. Working paper.

See Also

dea, dea.robust, dea.env.robust and hospitals.

Examples

## load data on Japanese hospitals (Besstremyannaya 2013, 2011)
data("hospitals", package="rDEA")
firms = 1:50
Y = hospitals[firms, c('inpatients', 'outpatients')]
X = hospitals[firms, c('labor', 'capital')]

## Returns-to-scale test in the input-oriented DEA model,
## Testing the null hypothesis of constant returns-to-scale
## vs. an alternative of variable returns-to-scale
rts_input=rts.test(X=X, Y=Y, W=NULL, model="input", H0="constant",
                bw="cv", B=100, alpha=0.05)

rts_input$pvalue
rts_input$H0reject
rts_input$H0level


## Test for cost-efficiency DEA model,
## Testing the null hypothesis of constant returns-to-scale
## vs. an alternative of variable returns-to-scale
W = hospitals[firms, c('labor_price', 'capital_price')]

rts_cost = rts.test(X=X, Y=Y, W=W, model="costmin", H0="constant",
                    bw="cv", B=100, alpha=0.05)

rts_cost$pvalue
rts_cost$H0reject
rts_cost$H0level