Skip to content

Commit 1ad5deb

Browse files
committed
add configure + missing srr documentation entries
1 parent dac82ff commit 1ad5deb

File tree

10 files changed

+168
-163
lines changed

10 files changed

+168
-163
lines changed

Diff for: .Rbuildignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
^README\.html$
1212
^pkgdown$
1313
^Makefile$
14+
^src/Makevars$
1415
^codemeta\.json$
1516
^CODE_OF_CONDUCT\.md$
1617
^\.lintr$

Diff for: cleanup

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rm -f src/Makevars configure.log

Diff for: configure

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
# Set the number of cores
4+
if [ -z "$PKG_NCORES" ]; then
5+
PKG_NCORES=$(getconf _NPROCESSORS_ONLN)
6+
if [ -z "$PKG_NCORES" ] || [ "$PKG_NCORES" -lt 1 ]; then
7+
PKG_NCORES=1
8+
elif [ "$PKG_NCORES" -gt 1 ]; then
9+
PKG_NCORES=$((PKG_NCORES - 1))
10+
fi
11+
fi
12+
13+
# Write Makevars
14+
sed -e "s|@ncores@|$PKG_NCORES|" \
15+
src/Makevars.in > src/Makevars
16+

Diff for: man/figures/logo.svg

+107-158
Loading

Diff for: src/Makevars.in

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -DARMA_OPENMP_THREADS=@ncores@
2+
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)

Diff for: tests/testthat/test-errors.R

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#' srr_stats (tests)
22
#' @srrstatsVerbose TRUE
3+
#' @srrstats {G5.2} *Appropriate error and warning behaviour of all functions
4+
#' should be explicitly demonstrated through tests. In particular,*
35
#' @srrstats {G5.2b} Here we cover errors as broadly as possible conditions,
46
#' and we write intentionally bad examples to compare the result with expected
57
#' values and inputs.

Diff for: tests/testthat/test-feglm.R

+13-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,19 @@
88
#' @srrstats {G5.4b} We determine correctess for GLMs by comparison, checking
99
#' the estimates versus base R and hardcoded values obtained with Alpaca
1010
#' (Stammann, 2018).
11-
#' @srrstats {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:*
12-
#' @srrstats {G5.8b} *Data of unsupported types (e.g., character or complex numbers in for functions designed only for numeric data)*
13-
#' @srrstats {RE7.2} Demonstrate that output objects retain aspects of input data such as row or case names (see **RE1.3**).
14-
#' @srrstats {RE7.3} Demonstrate and test expected behaviour when objects returned from regression software are submitted to the accessor methods of **RE4.2**--**RE4.7**.
11+
#' @srrstats {G5.8} **Edge condition tests** *to test that these conditions
12+
#' produce expected behaviour such as clear warnings or errors when confronted with data with extreme properties including but not limited to:*
13+
#' @srrstats {G5.8b} *Data of unsupported types (e.g., character or complex
14+
#' numbers in for functions designed only for numeric data)*
15+
#' @srrstats {G5.7} **Algorithm performance tests** *to test that implementation
16+
#' performs as expected as properties of data change. For instance, a test may
17+
#' show that parameters approach correct estimates within tolerance as data
18+
#' size increases, or that convergence times decrease for higher convergence
19+
#' thresholds.*
20+
#' @srrstats {RE7.2} Demonstrate that output objects retain aspects of input
21+
#' data such as row or case names (see **RE1.3**).
22+
#' @srrstats {RE7.3} Demonstrate and test expected behaviour when objects
23+
#' returned from regression software are submitted to the accessor methods of **RE4.2**--**RE4.7**.
1524
#'
1625
#' @noRd
1726
NULL

Diff for: tests/testthat/test-felm.R

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#' srr_stats (tests)
22
#' @srrstatsVerbose TRUE
33
#' @srrstats {G5.4b} See test-feglm.R
4+
#' @srrstats {G5.7} See test-feglm.R
5+
#' @srrstats {G5.9} **Noise susceptibility tests** *Packages should test for
6+
#' expected stochastic behaviour, such as through the following conditions:*
7+
#' #' @srrstats {G5.9a} *Adding trivial noise (for example, at the scale of
8+
#' `.Machine$double.eps`) to data does not meaningfully change results*
49
#' @noRd
510
NULL
611

Diff for: tests/testthat/test-fenegbin.R

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#' srr_stats (tests)
22
#' @srrstatsVerbose TRUE
33
#' @srrstats {G5.4b} See test-feglm.R
4+
#' @srrstats {G5.7} See test-feglm.R
45
#' @noRd
56
NULL
67

Diff for: tests/testthat/test-fepoisson.R

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#' srr_stats (tests)
22
#' @srrstatsVerbose TRUE
33
#' @srrstats {G5.4b} See test-feglm.R
4+
#' @srrstats {G5.7} See test-feglm.R
5+
#' @srrstats {G5.9} **Noise susceptibility tests** *Packages should test for
6+
#' expected stochastic behaviour, such as through the following conditions:*
7+
#' #' @srrstats {G5.9a} *Adding trivial noise (for example, at the scale of
8+
#' `.Machine$double.eps`) to data does not meaningfully change results*
49
#' @noRd
510
NULL
611

@@ -56,7 +61,9 @@ test_that("fepoisson is similar to fixest", {
5661
#' the slopes do not change. See test-feglm.R.
5762
#' @srrstats {RE7.1a} Model fitting is at least as fast or (preferably) faster
5863
#' than testing with equivalent noisy data (see RE2.4b).*
59-
#'
64+
#' @srrstats {G5.12} The commented time test takes around 1 minute, which is
65+
#' too long for CRAN, but it shows that the algorithm speed is robust to noise
66+
#' and it it marginally slower with noise.
6067
#' @noRd
6168
NULL
6269

@@ -76,6 +83,18 @@ test_that("fepoisson estimation is the same adding noise to the data", {
7683
expect_equal(coef(m1), coef(m2))
7784
expect_equal(fixed_effects(m1), fixed_effects(m2))
7885

86+
# n <- 10e5
87+
88+
# set.seed(123)
89+
90+
# d <- data.frame(
91+
# x = rnorm(n),
92+
# y = rpois(n, 1),
93+
# f = factor(rep(1:10, 10e4))
94+
# )
95+
96+
# d$y2 <- d$y + pmax(rnorm(nrow(d)), 0) * .Machine$double.eps
97+
7998
# t1 <- rep(NA, 10)
8099
# t2 <- rep(NA, 10)
81100
# for (i in 1:10) {

0 commit comments

Comments
 (0)