2
I am a beginner in R and do not understand much of the solutions in English. I believe, therefore, that a forum in Portuguese can help me.
I have the following database (date):
I’m trying to run the remote:
## inputs and outputs for analysis
Y = data[c('V7', 'V8')]
X = data[c('V3', 'V4','V5','V6')]
W = data[('V2')]
## 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")
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
I am getting, however, the following error message:
> library("rDEA", lib.loc="~/R/win-library/3.3")
Using the GLPK callable library version 4.47
> data <- read.delim("~/R/win-library/3.3/data.txt", header=FALSE)
> View(data)
> ## inputs and outputs for analysis
> Y = data[c('V7', 'V8')]
> X = data[c('V3', 'V4','V5','V6')]
> W = data[('V2')]
> ## 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) :
YREF has to be numeric matrix or data.frame.
> 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) :
YREF has to be numeric matrix or data.frame.
> ci_naive$XOpt
Error: object 'ci_naive' not found
> ci_naive$gammaOpt
Error: object 'ci_naive' not found
The error is saying that YREF needs to be numerical (in your case it is the Y object). Then, after you create the Y variable, run this command: Y <- as.Numeric(Y), and tell me if the error continues.
– TheBiro