Skip to content

Commit

Permalink
add configure + missing srr documentation entries
Browse files Browse the repository at this point in the history
  • Loading branch information
pachadotdev committed Nov 20, 2024
1 parent dac82ff commit 1ad5deb
Show file tree
Hide file tree
Showing 10 changed files with 168 additions and 163 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
^README\.html$
^pkgdown$
^Makefile$
^src/Makevars$
^codemeta\.json$
^CODE_OF_CONDUCT\.md$
^\.lintr$
Expand Down
1 change: 1 addition & 0 deletions cleanup
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rm -f src/Makevars configure.log
16 changes: 16 additions & 0 deletions configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

# Set the number of cores
if [ -z "$PKG_NCORES" ]; then
PKG_NCORES=$(getconf _NPROCESSORS_ONLN)
if [ -z "$PKG_NCORES" ] || [ "$PKG_NCORES" -lt 1 ]; then
PKG_NCORES=1
elif [ "$PKG_NCORES" -gt 1 ]; then
PKG_NCORES=$((PKG_NCORES - 1))
fi
fi

# Write Makevars
sed -e "s|@ncores@|$PKG_NCORES|" \
src/Makevars.in > src/Makevars

265 changes: 107 additions & 158 deletions man/figures/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/Makevars.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -DARMA_OPENMP_THREADS=@ncores@
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
2 changes: 2 additions & 0 deletions tests/testthat/test-errors.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#' srr_stats (tests)
#' @srrstatsVerbose TRUE
#' @srrstats {G5.2} *Appropriate error and warning behaviour of all functions
#' should be explicitly demonstrated through tests. In particular,*
#' @srrstats {G5.2b} Here we cover errors as broadly as possible conditions,
#' and we write intentionally bad examples to compare the result with expected
#' values and inputs.
Expand Down
17 changes: 13 additions & 4 deletions tests/testthat/test-feglm.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,19 @@
#' @srrstats {G5.4b} We determine correctess for GLMs by comparison, checking
#' the estimates versus base R and hardcoded values obtained with Alpaca
#' (Stammann, 2018).
#' @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:*
#' @srrstats {G5.8b} *Data of unsupported types (e.g., character or complex numbers in for functions designed only for numeric data)*
#' @srrstats {RE7.2} Demonstrate that output objects retain aspects of input data such as row or case names (see **RE1.3**).
#' @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**.
#' @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:*
#' @srrstats {G5.8b} *Data of unsupported types (e.g., character or complex
#' numbers in for functions designed only for numeric data)*
#' @srrstats {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.*
#' @srrstats {RE7.2} Demonstrate that output objects retain aspects of input
#' data such as row or case names (see **RE1.3**).
#' @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**.
#'
#' @noRd
NULL
Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test-felm.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#' srr_stats (tests)
#' @srrstatsVerbose TRUE
#' @srrstats {G5.4b} See test-feglm.R
#' @srrstats {G5.7} See test-feglm.R
#' @srrstats {G5.9} **Noise susceptibility tests** *Packages should test for
#' expected stochastic behaviour, such as through the following conditions:*
#' #' @srrstats {G5.9a} *Adding trivial noise (for example, at the scale of
#' `.Machine$double.eps`) to data does not meaningfully change results*
#' @noRd
NULL

Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-fenegbin.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#' srr_stats (tests)
#' @srrstatsVerbose TRUE
#' @srrstats {G5.4b} See test-feglm.R
#' @srrstats {G5.7} See test-feglm.R
#' @noRd
NULL

Expand Down
21 changes: 20 additions & 1 deletion tests/testthat/test-fepoisson.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#' srr_stats (tests)
#' @srrstatsVerbose TRUE
#' @srrstats {G5.4b} See test-feglm.R
#' @srrstats {G5.7} See test-feglm.R
#' @srrstats {G5.9} **Noise susceptibility tests** *Packages should test for
#' expected stochastic behaviour, such as through the following conditions:*
#' #' @srrstats {G5.9a} *Adding trivial noise (for example, at the scale of
#' `.Machine$double.eps`) to data does not meaningfully change results*
#' @noRd
NULL

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

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

# n <- 10e5

# set.seed(123)

# d <- data.frame(
# x = rnorm(n),
# y = rpois(n, 1),
# f = factor(rep(1:10, 10e4))
# )

# d$y2 <- d$y + pmax(rnorm(nrow(d)), 0) * .Machine$double.eps

# t1 <- rep(NA, 10)
# t2 <- rep(NA, 10)
# for (i in 1:10) {
Expand Down

0 comments on commit 1ad5deb

Please sign in to comment.