diff --git a/NEWS.md b/NEWS.md index 94b70dd..8cc2c55 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -bssm 2.0.2 (Release date: 2023-09-04) +bssm 2.0.2 (Release date: 2023-10-18) ===================================== * Switched to markdown NEWS with a plan to be more clear about the future changes in the package. @@ -11,6 +11,8 @@ bssm 2.0.2 (Release date: 2023-09-04) * Removed explicit C++ version requirement as required by new CRAN policies. * Removed `magrittr` dependency and switched to native pipe, leading to requirement for R 4.1.0+. + * Added Sys.setenv("OMP_THREAD_LIMIT" = 2) to fix weird CRAN issues with + parallelisation on Debian. bssm 2.0.1 (Release date: 2022-05-02) ============== diff --git a/R/approx.R b/R/approx.R index d140ca9..8010682 100644 --- a/R/approx.R +++ b/R/approx.R @@ -31,6 +31,7 @@ #' @export #' @rdname gaussian_approx #' @examples +#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN #' data("poisson_series") #' model <- bsm_ng(y = poisson_series, sd_slope = 0.01, sd_level = 0.1, #' distribution = "poisson") diff --git a/R/bssm-package.R b/R/bssm-package.R index 4916aec..fb0515d 100644 --- a/R/bssm-package.R +++ b/R/bssm-package.R @@ -89,6 +89,7 @@ #' time ts ts.union tsp tsp<- sd na.omit #' @useDynLib bssm #' @examples +#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN #' # Create a local level model (latent random walk + noise) to the Nile #' # dataset using the bsm_lg function: #' model <- bsm_lg(Nile, @@ -138,6 +139,7 @@ NULL #' \url{https://stat.fi/tup/tilastotietokannat/index_en.html}. #' @keywords datasets #' @examples +#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN #' data("drownings") #' model <- bsm_ng(drownings[, "deaths"], u = drownings[, "population"], #' xreg = drownings[, "summer_temp"], distribution = "poisson", @@ -165,6 +167,7 @@ NULL #' Time Series Analysis by State Space Methods. Oxford University Press. #' https://doi.org/10.1093/acprof:oso/9780199641178.001.0001 #' @examples +#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN #' data("exchange") #' model <- svm(exchange, rho = uniform(0.97,-0.999,0.999), #' sd_ar = halfnormal(0.175, 2), mu = normal(-0.87, 0, 2)) @@ -188,6 +191,7 @@ NULL #' Scand J Statist. 1-38. https://doi.org/10.1111/sjos.12492 #' #' @examples +#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN #' # The data was generated as follows: #' set.seed(321) #' slope <- cumsum(c(0, rnorm(99, sd = 0.01))) @@ -241,6 +245,7 @@ NULL #' https://doi.org/10.32614/RJ-2021-103 #' #' @examples +#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN #' # reproducing the model: #' data("negbin_series") #' # Construct model for bssm diff --git a/R/ekpf_filter.R b/R/ekpf_filter.R index 654f1eb..4c79e75 100644 --- a/R/ekpf_filter.R +++ b/R/ekpf_filter.R @@ -21,6 +21,7 @@ ekpf_filter <- function(model, particles, ...) { #' @rdname ekpf_filter #' @examples #' \donttest{ # Takes a while +#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN #' set.seed(1) #' n <- 50 #' x <- y <- numeric(n) diff --git a/R/kfilter.R b/R/kfilter.R index ed28b8f..3ab258f 100644 --- a/R/kfilter.R +++ b/R/kfilter.R @@ -69,6 +69,7 @@ kfilter.nongaussian <- function(model, ...) { #' @export #' @examples #' \donttest{ # Takes a while on CRAN +#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN #' set.seed(1) #' mu <- -0.2 #' rho <- 0.7 @@ -138,6 +139,7 @@ ekf <- function(model, iekf_iter = 0) { #' @export #' @examples #' \donttest{ # Takes a while on CRAN +#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN #' set.seed(1) #' mu <- -0.2 #' rho <- 0.7 diff --git a/R/models.R b/R/models.R index 22956ed..fa0f6da 100644 --- a/R/models.R +++ b/R/models.R @@ -61,6 +61,7 @@ default_update_fn <- function(theta) { #' @return An object of class \code{ssm_ulg}. #' @export #' @examples +#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN #' #' # Regression model with time-varying coefficients #' set.seed(1) diff --git a/R/post_correction.R b/R/post_correction.R index 3e060a1..813c785 100644 --- a/R/post_correction.R +++ b/R/post_correction.R @@ -174,6 +174,7 @@ suggest_N <- function(model, theta, #' @export #' @examples #' \donttest{ +#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN #' set.seed(1) #' n <- 300 #' x1 <- sin((2 * pi / 12) * 1:n) diff --git a/man/bssm.Rd b/man/bssm.Rd index 09d3377..e578258 100644 --- a/man/bssm.Rd +++ b/man/bssm.Rd @@ -64,6 +64,7 @@ statistics, and further diagnostics checks can be performed with the help of the \code{posterior} and \code{coda} packages. } \examples{ +Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN # Create a local level model (latent random walk + noise) to the Nile # dataset using the bsm_lg function: model <- bsm_lg(Nile, diff --git a/man/drownings.Rd b/man/drownings.Rd index 93dacc0..ebc26a1 100644 --- a/man/drownings.Rd +++ b/man/drownings.Rd @@ -19,6 +19,7 @@ unweighted average of three weather stations: Helsinki (Southern Finland), Jyvaskyla (Central Finland), and Sodankyla (Northern Finland). } \examples{ +Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN data("drownings") model <- bsm_ng(drownings[, "deaths"], u = drownings[, "population"], xreg = drownings[, "summer_temp"], distribution = "poisson", diff --git a/man/ekf.Rd b/man/ekf.Rd index 342de6b..c215ed8 100644 --- a/man/ekf.Rd +++ b/man/ekf.Rd @@ -27,6 +27,7 @@ states \eqn{\alpha_t} given the data up to time \eqn{t}. } \examples{ \donttest{ # Takes a while on CRAN +Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN set.seed(1) mu <- -0.2 rho <- 0.7 diff --git a/man/ekpf_filter.Rd b/man/ekpf_filter.Rd index 65432d2..8621763 100644 --- a/man/ekpf_filter.Rd +++ b/man/ekpf_filter.Rd @@ -37,6 +37,7 @@ with stratification resampling, based on Van Der Merwe et al (2001). } \examples{ \donttest{ # Takes a while +Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN set.seed(1) n <- 50 x <- y <- numeric(n) diff --git a/man/exchange.Rd b/man/exchange.Rd index 97687b7..6e02533 100644 --- a/man/exchange.Rd +++ b/man/exchange.Rd @@ -16,6 +16,7 @@ Dataset containing daily log-returns from 1/10/81-28/6/85 as in Durbin and Koopman (2012). } \examples{ +Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN data("exchange") model <- svm(exchange, rho = uniform(0.97,-0.999,0.999), sd_ar = halfnormal(0.175, 2), mu = normal(-0.87, 0, 2)) diff --git a/man/gaussian_approx.Rd b/man/gaussian_approx.Rd index 88325b7..d762410 100644 --- a/man/gaussian_approx.Rd +++ b/man/gaussian_approx.Rd @@ -43,6 +43,7 @@ This function is rarely needed itself, and is mainly available for testing and debugging purposes. } \examples{ +Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN data("poisson_series") model <- bsm_ng(y = poisson_series, sd_slope = 0.01, sd_level = 0.1, distribution = "poisson") diff --git a/man/negbin_model.Rd b/man/negbin_model.Rd index b95a092..f41c930 100644 --- a/man/negbin_model.Rd +++ b/man/negbin_model.Rd @@ -13,6 +13,7 @@ iterations. Here only 2000 iterations were used in order to reduce the size of the model object in CRAN. } \examples{ +Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN # reproducing the model: data("negbin_series") # Construct model for bssm diff --git a/man/poisson_series.Rd b/man/poisson_series.Rd index 9918704..3e20cc2 100644 --- a/man/poisson_series.Rd +++ b/man/poisson_series.Rd @@ -12,6 +12,7 @@ See example for code for reproducing the data. This was used in Vihola, Helske, Franks (2020). } \examples{ +Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN # The data was generated as follows: set.seed(321) slope <- cumsum(c(0, rnorm(99, sd = 0.01))) diff --git a/man/post_correct.Rd b/man/post_correct.Rd index a382b10..ac7dad5 100644 --- a/man/post_correct.Rd +++ b/man/post_correct.Rd @@ -52,6 +52,7 @@ weighted posterior, and returns updated MCMC output where components } \examples{ \donttest{ +Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN set.seed(1) n <- 300 x1 <- sin((2 * pi / 12) * 1:n) diff --git a/man/ssm_ulg.Rd b/man/ssm_ulg.Rd index 932a0c8..b6edba0 100644 --- a/man/ssm_ulg.Rd +++ b/man/ssm_ulg.Rd @@ -99,6 +99,7 @@ and then check the expected structure of the model components from the output. } \examples{ +Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN # Regression model with time-varying coefficients set.seed(1) diff --git a/man/ukf.Rd b/man/ukf.Rd index e734474..8c7b3d1 100644 --- a/man/ukf.Rd +++ b/man/ukf.Rd @@ -32,6 +32,7 @@ states \eqn{\alpha_t} given the data up to time \eqn{t}. } \examples{ \donttest{ # Takes a while on CRAN +Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN set.seed(1) mu <- -0.2 rho <- 0.7 diff --git a/tests/test_all.R b/tests/test_all.R index cfc7d47..c2be8f2 100644 --- a/tests/test_all.R +++ b/tests/test_all.R @@ -1,2 +1,4 @@ +Sys.setenv("OMP_THREAD_LIMIT" = 2) + library("testthat") test_check("bssm") diff --git a/vignettes/bssm.Rmd b/vignettes/bssm.Rmd index c236b7e..11eff8c 100644 --- a/vignettes/bssm.Rmd +++ b/vignettes/bssm.Rmd @@ -14,6 +14,7 @@ vignette: | --- ```{r, echo = FALSE} +Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN if (!requireNamespace("rmarkdown") || !rmarkdown::pandoc_available("1.12.3")) { warning(call. = FALSE, "These vignettes assume rmarkdown and pandoc version", diff --git a/vignettes/growth_model.Rmd b/vignettes/growth_model.Rmd index 191dde3..218a375 100644 --- a/vignettes/growth_model.Rmd +++ b/vignettes/growth_model.Rmd @@ -14,6 +14,7 @@ vignette: | --- ```{r, echo = FALSE} +Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN if (!requireNamespace("rmarkdown") || !rmarkdown::pandoc_available("1.12.3")) { warning(call. = FALSE, "These vignettes assume rmarkdown and pandoc version 1.12.3. These were not found. Older versions will not work.") diff --git a/vignettes/psi_pf.Rmd b/vignettes/psi_pf.Rmd index 95c6cf8..de5a61f 100644 --- a/vignettes/psi_pf.Rmd +++ b/vignettes/psi_pf.Rmd @@ -16,6 +16,7 @@ bvignette: | ``` ```{r, echo = FALSE} +Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN if (!requireNamespace("rmarkdown") || !rmarkdown::pandoc_available("1.12.3")) { warning(call. = FALSE, "These vignettes assume rmarkdown and pandoc version 1.12.3. These were not found. Older versions will not work.") diff --git a/vignettes/sde_model.Rmd b/vignettes/sde_model.Rmd index de8fd67..86a5d03 100644 --- a/vignettes/sde_model.Rmd +++ b/vignettes/sde_model.Rmd @@ -14,6 +14,7 @@ vignette: | --- ```{r, echo = FALSE} +Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN if (!requireNamespace("rmarkdown") || !rmarkdown::pandoc_available("1.12.3")) { warning(call. = FALSE, "These vignettes assume rmarkdown and pandoc version 1.12.3. These were not found. Older versions will not work.")