-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d662a97
commit 5183cb9
Showing
16 changed files
with
900 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
d7f9a76f9ebd9f4ec1f5d6c6f783345e *DESCRIPTION | ||
f72375bffd457cb3fe5117eed9b9d8f0 *DESCRIPTION | ||
7420c3435de96c603a7eac5974e3ad63 *LICENSE | ||
c581dc6070df1c1f2ede2c134dcf3e5c *NAMESPACE | ||
5e4bae93b128521236d3f65a103c7a48 *R/costDEA.R | ||
7a5e183093294fd45ccce42f16305923 *R/hyperbolicDEA.R | ||
9a1bfa1b34f83cbff9affe2afb55718a *R/lprofitDEA.R | ||
4a944f9d71399c98794a6456d8679a90 *R/nlprofitDEA.R | ||
40d288bb253f218da700a696ab844b8e *NAMESPACE | ||
f431ca48123e257e4df594362349b979 *R/check_arguments.R | ||
3fd393a145c4f09922dfb8c4ccfdb803 *R/costDEA.R | ||
ca59a30e41c94608ba12ec8818db485a *R/hyperbolicDEA.R | ||
94478f63edbcb40cdab42a6f488cceb6 *R/lprofitDEA.R | ||
bb6ae3c0c6f9e60b8294856ad30c6080 *R/nlprofitDEA.R | ||
c0be7b6dc48e621146ab64b145af7d1b *R/slack.R | ||
7590bcef71201e0535bdfe9405280ae4 *R/wrDEA.R | ||
49322e18bc98f2e01f48873107d43f6b *README.md | ||
75a4f572ac6ed3c7f7cb50b6f3b2a934 *man/costDEA.Rd | ||
5301a3ef1a0dcf4b6f77e64099c72a20 *man/hyperbolicDEA.Rd | ||
da825138fe98080f7706cd658623d31a *man/lprofitDEA.Rd | ||
e1abb9bbf539f08fff7a570f5a2461e9 *man/nlprofitDEA.Rd | ||
2c2a5c42b855f23499c159842bffe2a9 *man/costDEA.Rd | ||
de66a1215cef333db63c1f1c93b96867 *man/hyperbolicDEA.Rd | ||
33dfe4ebef753d02d8da9e22458bb6d5 *man/lprofitDEA.Rd | ||
e4ccd6da57bb2111dc2be22d6ebca7ff *man/nlprofitDEA.Rd | ||
153b2b504257309308a9f25cde35b062 *man/wrDEA.Rd | ||
5eb9c7385ddd9a0f93218d310178b677 *tests/testthat.R | ||
138e001fe5d422d50412e43b8b89fbd8 *tests/testthat/test-hyperbolicDEA.R | ||
4af076af8dd051d1e74bb66bbc4a2e6e *tests/testthat/test-hyperbolicDEA.R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
check_arguments <- function(X, Y, XREF = NULL, YREF = NULL, | ||
WR = NULL, RTS = "vrs", | ||
NONDISC_IN = NULL, NONDISC_OUT = NULL, | ||
ALPHA = NULL, ORIENTATION = NULL){ | ||
|
||
# General checks for all functions in the package | ||
if (!is.matrix(X) && !is.data.frame(X) && !is.numeric(X)){ | ||
stop("X must be a numeric vector, matrix or dataframe") | ||
} | ||
if (!is.matrix(Y) && !is.data.frame(Y) && !is.numeric(Y)){ | ||
stop("Y must be a numeric vector, matrix or dataframe") | ||
} | ||
|
||
if (!is.null(WR)){ | ||
if (!is.matrix(WR) && !is.data.frame(WR)){ | ||
WR <- t(as.matrix(WR)) | ||
} | ||
if (ncol(WR) != ncol(as.matrix(X)) + ncol(as.matrix(Y))){ | ||
stop("WR must be a matrix of weight restrictions in standard form, | ||
ncol(WR) = ncol(Y) + ncol(X)") | ||
} | ||
} | ||
if (!is.null(XREF)&&!is.null(YREF)){ | ||
if (!is.matrix(XREF) && !is.data.frame(XREF) && !is.numeric(XREF)){ | ||
stop("XREF must be a numeric vector, matrix or dataframe") | ||
} | ||
if (!is.matrix(YREF) && !is.data.frame(YREF) && !is.numeric(YREF)){ | ||
stop("YREF must be a numeric vector, matrix or dataframe") | ||
} | ||
if ((ncol(as.matrix(YREF))+ncol(as.matrix(XREF))) != (ncol(as.matrix(X)) + ncol(as.matrix(Y)))){ | ||
stop("XREF and YREF must be the same input-output combination: | ||
ncol(XREF) = ncol(X); ncol(YREF) = ncol(Y)") | ||
} | ||
} | ||
if (anyNA(X) || anyNA(Y) || anyNA(XREF) || anyNA(YREF) || anyNA(WR) || | ||
any(is.nan(X)) || any(is.nan(Y)) || any(is.nan(XREF)) || | ||
any(is.nan(YREF)) || any(is.nan(WR))) { | ||
stop("The optimizer cannot handle missing or NaN values.") | ||
} | ||
|
||
possible_rts <- c("crs", "vrs", "ndrs", "nirs", "fdh") | ||
RTS <- tolower(RTS) | ||
if (!(RTS %in% possible_rts)){ | ||
stop("Unknown scale of returns:", RTS) | ||
} | ||
if (!is.null(ALPHA)){ | ||
if (ALPHA < 0 || ALPHA > 1){ | ||
warning("ALPHA should be a number between 0 and 1 otherwise inputs can be increased | ||
or outputs can be decreased") | ||
} | ||
} | ||
if (!is.null(ORIENTATION)){ | ||
ORIENTATION <- tolower(ORIENTATION) | ||
if (!(ORIENTATION %in% c("in", "out"))){ | ||
stop("ORIENTATION must be either 'in' or 'out'") | ||
} | ||
} | ||
if (!is.null(NONDISC_IN)){ | ||
if (!(all(NONDISC_IN %in% 1:ncol(as.matrix(X))))){ | ||
stop("NONDISC_IN must be an available index of the input matrix") | ||
} | ||
} | ||
if (!is.null(NONDISC_OUT)){ | ||
if (!(all(NONDISC_OUT %in% 1:ncol(as.matrix(Y))))){ | ||
stop("NONDISC_OUT must be an available index of the output matrix") | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.