在使用R运行模型时,我很糟糕。我正在尝试运行以下命令,可以找到here:
## 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
该命令运行良好,但是,当我尝试运行应用于我的数据的命令时,我在这里得到了这些东西:
> ## inputs and outputs for analysis
> Y = data[c('V7', 'V8')]
Error in data[c("V7", "V8")] :
object of type 'closure' is not subsettable
> X = data[c('V3', 'V4','V5','V6')]
Error in data[c("V3", "V4", "V5", "V6")] :
object of type 'closure' is not subsettable
> W = data[c('V2')]
Error in data[c("V2")] : object of type 'closure' is not subsettable
> ## Naive input-oriented DEA score for the first 20 firms under variable returns-to-scale
> firms=1:19
> di_naive = dea(XREF=X, YREF=Y, X=X[firms,], Y=Y[firms,], model="input", RTS="variable")
Error in dea.input(XREF = XREF, YREF = YREF, X = X, Y = Y, RTS = RTS) :
object 'X' not found
> di_naive$thetaOpt
Error: object 'di_naive' not found
> ## 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")
Error in dea.costmin(XREF = XREF, YREF = YREF, X = X, Y = Y, W = W, RTS = RTS) :
object 'X' not found
> ci_naive$XOpt
Error: object 'ci_naive' not found
> ci_naive$gammaOpt
Error: object 'ci_naive' not found
>
有人可以帮我一个忙吗?