Skip to content

Commit cbaad8a

Browse files
committed
additional tests
1 parent 8fda07c commit cbaad8a

38 files changed

+1241
-846
lines changed

R/helpers.R renamed to R/feglm_helpers.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ check_formula_ <- function(formula) {
106106
check_data_ <- function(data) {
107107
if (is.null(data)) {
108108
stop("'data' has to be specified.", call. = FALSE)
109+
} else if (nrow(data) == 0L) {
110+
stop("'data' has zero observations.", call. = FALSE)
109111
} else if (!inherits(data, "data.frame")) {
110112
stop("'data' has to be of class data.frame.", call. = FALSE)
111113
}

R/kendall_correlation.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ kendall_cor <- function(x, y) {
3636

3737
n <- ncol(arr)
3838

39-
kw <- kendall_warnings(arr, n)
39+
kw <- kendall_warnings_(arr, n)
4040

4141
if (isFALSE(kw)) { return(NA) }
4242

@@ -81,7 +81,7 @@ kendall_cor_test <- function(x, y,
8181
n <- nrow(arr)
8282
m <- ncol(arr)
8383

84-
kw <- kendall_warnings(arr, m)
84+
kw <- kendall_warnings_(arr, m)
8585

8686
if (isFALSE(kw)) { return(NA) }
8787

@@ -138,7 +138,7 @@ kendall_cor_test <- function(x, y,
138138
)
139139
}
140140

141-
kendall_warnings <- function(arr, n) {
141+
kendall_warnings_ <- function(arr, n) {
142142
if (n != 2) {
143143
stop("x and y must be uni-dimensional vectors")
144144
}

R/srr-stats-standards.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,12 @@
5858
#' @srrstats {G5.4a} *For new methods, it can be difficult to separate out correctness of the method from the correctness of the implementation, as there may not be reference for comparison. In this case, testing may be implemented against simple, trivial cases or against multiple implementations such as an initial R implementation compared with results from a C/C++ implementation.*
5959
#' @srrstats {G5.4b} *For new implementations of existing methods, correctness tests should include tests against previous implementations. Such testing may explicitly call those implementations in testing, preferably from fixed-versions of other software, or use stored outputs from those where that is not possible.*
6060
#' @srrstats {G5.4c} *Where applicable, stored values may be drawn from published paper outputs when applicable and where code from original implementations is not available*
61-
#' @srrstatsTODO {G5.5} *Correctness tests should be run with a fixed random seed*
6261
#' @srrstatsTODO {G5.6} **Parameter recovery tests** *to test that the implementation produce expected results given data with known properties. For instance, a linear regression algorithm should return expected coefficient values for a simulated data set generated from a linear model.*
6362
#' @srrstatsTODO {G5.6a} *Parameter recovery tests should generally be expected to succeed within a defined tolerance rather than recovering exact values.*
6463
#' @srrstatsTODO {G5.6b} *Parameter recovery tests should be run with multiple random seeds when either data simulation or the algorithm contains a random component. (When long-running, such tests may be part of an extended, rather than regular, test suite; see G5.10-4.12, below).*
6564
#' @srrstatsTODO {G5.7} **Algorithm performance tests** *to test that implementation performs as expected as properties of data change. For instance, a test may show that parameters approach correct estimates within tolerance as data size increases, or that convergence times decrease for higher convergence thresholds.*
6665
#' @srrstatsTODO {G5.8} **Edge condition tests** *to test that these conditions produce expected behaviour such as clear warnings or errors when confronted with data with extreme properties including but not limited to:*
67-
#' @srrstatsTODO {G5.8a} *Zero-length data*
66+
#' @srrstats {G5.8a} *Zero-length data*
6867
#' @srrstats {G5.8b} *Data of unsupported types (e.g., character or complex numbers in for functions designed only for numeric data)*
6968
#' @srrstats {G5.8c} *Data with all-`NA` fields or columns or all identical fields or columns*
7069
#' @srrstats {G5.8d} *Data outside the scope of the algorithm (for example, data with more fields (columns) than observations (rows) for some regression algorithms)*
@@ -131,6 +130,7 @@ NULL
131130
#' to `@srrstatsNA`, and placed together in this block, along with explanations
132131
#' for why each of these standards have been deemed not applicable.
133132
#' (These comments may also be deleted at any time.)
133+
#' @srrstatsNA {G5.5} *Correctness tests should be run with a fixed random seed*
134134
#' @srrstatsNA {G2.14c} *replace missing data with appropriately imputed values*
135135
#' @srrstatsNA {G2.16} *All functions should also provide options to handle undefined values (e.g., `NaN`, `Inf` and `-Inf`), including potentially ignoring or removing such values.*
136136
#' @srrstatsNA {G5.11a} *When any downloads of additional data necessary for extended tests fail, the tests themselves should not fail, rather be skipped and implicitly succeed with an appropriate diagnostic message.*

docs/apple-touch-icon-120x120.png

-205 Bytes
Loading

docs/apple-touch-icon-152x152.png

-310 Bytes
Loading

docs/apple-touch-icon-180x180.png

-228 Bytes
Loading

docs/apple-touch-icon-60x60.png

-173 Bytes
Loading

docs/apple-touch-icon-76x76.png

-69 Bytes
Loading

docs/apple-touch-icon.png

-228 Bytes
Loading

docs/favicon-16x16.png

-6 Bytes
Loading

0 commit comments

Comments
 (0)