diff --git a/NEWS.md b/NEWS.md index 458d214..12601f0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,7 +11,7 @@ bssm 2.0.2 (Release date: 2023-10-18) * 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_NUM_THREADS" = 2) to fix weird CRAN issues with + * Added Sys.setenv("OMP_NUM_THREADS" = 2) to (partially) fix 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 0c6a940..d140ca9 100644 --- a/R/approx.R +++ b/R/approx.R @@ -31,7 +31,6 @@ #' @export #' @rdname gaussian_approx #' @examples -#' Sys.setenv("OMP_NUM_THREADS" = 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 27504a4..4478dc0 100644 --- a/R/bssm-package.R +++ b/R/bssm-package.R @@ -89,7 +89,6 @@ #' time ts ts.union tsp tsp<- sd na.omit #' @useDynLib bssm #' @examples -#' Sys.setenv("OMP_NUM_THREADS" = 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, @@ -139,7 +138,6 @@ NULL #' \url{https://stat.fi/tup/tilastotietokannat/index_en.html}. #' @keywords datasets #' @examples -#' Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN #' data("drownings") #' model <- bsm_ng(drownings[, "deaths"], u = drownings[, "population"], #' xreg = drownings[, "summer_temp"], distribution = "poisson", @@ -167,13 +165,14 @@ 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_NUM_THREADS" = 2) # For CRAN +#' \donttest{ # Don't test on CRAN as complains about parallelisation #' 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)) #' #' out <- particle_smoother(model, particles = 500) #' plot.ts(cbind(model$y, exp(out$alphahat))) +#' } NULL #' Simulated Poisson Time Series Data #' @@ -191,7 +190,6 @@ NULL #' Scand J Statist. 1-38. https://doi.org/10.1111/sjos.12492 #' #' @examples -#' Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN #' # The data was generated as follows: #' set.seed(321) #' slope <- cumsum(c(0, rnorm(99, sd = 0.01))) @@ -245,7 +243,6 @@ NULL #' https://doi.org/10.32614/RJ-2021-103 #' #' @examples -#' Sys.setenv("OMP_NUM_THREADS" = 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 a348496..654f1eb 100644 --- a/R/ekpf_filter.R +++ b/R/ekpf_filter.R @@ -21,7 +21,6 @@ ekpf_filter <- function(model, particles, ...) { #' @rdname ekpf_filter #' @examples #' \donttest{ # Takes a while -#' Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN #' set.seed(1) #' n <- 50 #' x <- y <- numeric(n) diff --git a/R/kfilter.R b/R/kfilter.R index 4316ec2..ed28b8f 100644 --- a/R/kfilter.R +++ b/R/kfilter.R @@ -69,7 +69,6 @@ kfilter.nongaussian <- function(model, ...) { #' @export #' @examples #' \donttest{ # Takes a while on CRAN -#' Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN #' set.seed(1) #' mu <- -0.2 #' rho <- 0.7 @@ -139,7 +138,6 @@ ekf <- function(model, iekf_iter = 0) { #' @export #' @examples #' \donttest{ # Takes a while on CRAN -#' Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN #' set.seed(1) #' mu <- -0.2 #' rho <- 0.7 diff --git a/R/models.R b/R/models.R index 85c69f3..22956ed 100644 --- a/R/models.R +++ b/R/models.R @@ -61,7 +61,6 @@ default_update_fn <- function(theta) { #' @return An object of class \code{ssm_ulg}. #' @export #' @examples -#' Sys.setenv("OMP_NUM_THREADS" = 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 7455fe6..3e060a1 100644 --- a/R/post_correction.R +++ b/R/post_correction.R @@ -174,7 +174,6 @@ suggest_N <- function(model, theta, #' @export #' @examples #' \donttest{ -#' Sys.setenv("OMP_NUM_THREADS" = 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 9aec216..09d3377 100644 --- a/man/bssm.Rd +++ b/man/bssm.Rd @@ -64,7 +64,6 @@ statistics, and further diagnostics checks can be performed with the help of the \code{posterior} and \code{coda} packages. } \examples{ -Sys.setenv("OMP_NUM_THREADS" = 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 cdfb618..93dacc0 100644 --- a/man/drownings.Rd +++ b/man/drownings.Rd @@ -19,7 +19,6 @@ unweighted average of three weather stations: Helsinki (Southern Finland), Jyvaskyla (Central Finland), and Sodankyla (Northern Finland). } \examples{ -Sys.setenv("OMP_NUM_THREADS" = 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 80142cd..342de6b 100644 --- a/man/ekf.Rd +++ b/man/ekf.Rd @@ -27,7 +27,6 @@ states \eqn{\alpha_t} given the data up to time \eqn{t}. } \examples{ \donttest{ # Takes a while on CRAN -Sys.setenv("OMP_NUM_THREADS" = 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 7ff169f..65432d2 100644 --- a/man/ekpf_filter.Rd +++ b/man/ekpf_filter.Rd @@ -37,7 +37,6 @@ with stratification resampling, based on Van Der Merwe et al (2001). } \examples{ \donttest{ # Takes a while -Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN set.seed(1) n <- 50 x <- y <- numeric(n) diff --git a/man/exchange.Rd b/man/exchange.Rd index 3e47d81..87f1e1d 100644 --- a/man/exchange.Rd +++ b/man/exchange.Rd @@ -16,7 +16,7 @@ Dataset containing daily log-returns from 1/10/81-28/6/85 as in Durbin and Koopman (2012). } \examples{ -Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN +\donttest{ # Don't test on CRAN as complains about parallelisation 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)) @@ -24,6 +24,7 @@ model <- svm(exchange, rho = uniform(0.97,-0.999,0.999), out <- particle_smoother(model, particles = 500) plot.ts(cbind(model$y, exp(out$alphahat))) } +} \references{ James Durbin, Siem Jan Koopman (2012). Time Series Analysis by State Space Methods. Oxford University Press. diff --git a/man/gaussian_approx.Rd b/man/gaussian_approx.Rd index 222cae8..88325b7 100644 --- a/man/gaussian_approx.Rd +++ b/man/gaussian_approx.Rd @@ -43,7 +43,6 @@ This function is rarely needed itself, and is mainly available for testing and debugging purposes. } \examples{ -Sys.setenv("OMP_NUM_THREADS" = 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 64abb17..b95a092 100644 --- a/man/negbin_model.Rd +++ b/man/negbin_model.Rd @@ -13,7 +13,6 @@ iterations. Here only 2000 iterations were used in order to reduce the size of the model object in CRAN. } \examples{ -Sys.setenv("OMP_NUM_THREADS" = 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 caa85da..9918704 100644 --- a/man/poisson_series.Rd +++ b/man/poisson_series.Rd @@ -12,7 +12,6 @@ See example for code for reproducing the data. This was used in Vihola, Helske, Franks (2020). } \examples{ -Sys.setenv("OMP_NUM_THREADS" = 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 579be6a..a382b10 100644 --- a/man/post_correct.Rd +++ b/man/post_correct.Rd @@ -52,7 +52,6 @@ weighted posterior, and returns updated MCMC output where components } \examples{ \donttest{ -Sys.setenv("OMP_NUM_THREADS" = 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 d590716..932a0c8 100644 --- a/man/ssm_ulg.Rd +++ b/man/ssm_ulg.Rd @@ -99,7 +99,6 @@ and then check the expected structure of the model components from the output. } \examples{ -Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN # Regression model with time-varying coefficients set.seed(1) diff --git a/man/ukf.Rd b/man/ukf.Rd index aa62875..e734474 100644 --- a/man/ukf.Rd +++ b/man/ukf.Rd @@ -32,7 +32,6 @@ states \eqn{\alpha_t} given the data up to time \eqn{t}. } \examples{ \donttest{ # Takes a while on CRAN -Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN set.seed(1) mu <- -0.2 rho <- 0.7