- using R Under development (unstable) (2026-06-02 r90096 ucrt)
- using platform: x86_64-w64-mingw32
- R was compiled by
gcc.exe (GCC) 14.3.0
GNU Fortran (GCC) 14.3.0
- running under: Windows Server 2022 x64 (build 20348)
- using session charset: UTF-8
* current time: 2026-06-03 12:34:31 UTC
- using option '--no-vignettes'
- checking for file 'surveillance/DESCRIPTION' ... OK
- this is package 'surveillance' version '1.25.0'
- checking package namespace information ... OK
- checking package dependencies ... INFO
Package suggested but not available for checking: 'INLA'
- checking if this is a source package ... OK
- checking if there is a namespace ... OK
- checking for hidden files and directories ... OK
- checking for portable file names ... OK
- checking whether package 'surveillance' can be installed ... OK
See the install log for details.
- used C compiler: 'gcc.exe (GCC) 14.3.0'
- used C++ compiler: 'g++.exe (GCC) 14.3.0'
- checking installed package size ... INFO
installed size is 6.5Mb
sub-directories of 1Mb or more:
R 1.7Mb
doc 2.2Mb
- checking package directory ... OK
- checking 'build' directory ... OK
- checking DESCRIPTION meta-information ... OK
- checking top-level files ... OK
- checking for left-over files ... OK
- checking index information ... OK
- checking package subdirectories ... OK
- checking code files for non-ASCII characters ... OK
- checking R files for syntax errors ... OK
- checking whether the package can be loaded ... [2s] OK
- checking whether the package can be loaded with stated dependencies ... [2s] OK
- checking whether the package can be unloaded cleanly ... [2s] OK
- checking whether the namespace can be loaded with stated dependencies ... [2s] OK
- checking whether the namespace can be unloaded cleanly ... [2s] OK
- checking loading without being on the library search path ... [2s] OK
- checking whether startup messages can be suppressed ... [2s] OK
- checking use of S3 registration ... OK
- checking dependencies in R code ... OK
- checking S3 generic/method consistency ... OK
- checking replacement functions ... OK
- checking foreign function calls ... OK
- checking R code for possible problems ... [44s] OK
- checking Rd files ... [7s] OK
- checking Rd metadata ... OK
- checking Rd cross-references ... OK
- checking for missing documentation entries ... OK
- checking for code/documentation mismatches ... OK
- checking Rd \usage sections ... OK
- checking Rd contents ... OK
- checking for unstated dependencies in examples ... OK
- checking contents of 'data' directory ... OK
- checking data for non-ASCII characters ... [3s] OK
- checking data for ASCII and uncompressed saves ... OK
- checking R/sysdata.rda ... OK
- checking line endings in C/C++/Fortran sources/headers ... OK
- checking pragmas in C/C++ headers and code ... OK
- checking compiled code ... OK
- checking sizes of PDF files under 'inst/doc' ... OK
- checking installed files from 'inst/doc' ... OK
- checking files in 'vignettes' ... OK
- checking examples ... [42s] ERROR
Running examples in 'surveillance-Ex.R' failed
The error most likely occurred in:
> ### Name: hhh4_simulate
> ### Title: Simulate '"hhh4"' Count Time Series
> ### Aliases: simulate.hhh4
> ### Keywords: datagen
>
> ### ** Examples
>
> data(influMen)
> # convert to sts class and extract meningococcal disease time series
> meningo <- disProg2sts(influMen)[,2]
>
> # fit model
> fit <- hhh4(meningo, control = list(
+ ar = list(f = ~ 1),
+ end = list(f = addSeason2formula(~1, period = 52)),
+ family = "NegBin1"))
> plot(fit)
>
> # simulate from model (generates an "sts" object)
> simData <- simulate(fit, seed=1234)
>
> # plot simulated data
> plot(simData, main = "simulated data", xaxis.labelFormat=NULL)
>
> # use simplify=TRUE to return an array of simulated counts
> simCounts <- simulate(fit, seed=1234, simplify=TRUE)
> dim(simCounts) # nTime x nUnit x nsim
[1] 312 1 1
> ## Don't show:
> stopifnot(observed(simData) == c(simCounts))
> ## End(Don't show)
> # plot the first year of simulated counts (+ initial + observed)
> plot(simCounts[1:52,,], type = "time", xaxis.labelFormat = NULL)
> # see help(plot.hhh4sims) for other plots, mainly useful for nsim > 1
>
> # simulate from a Poisson instead of a NegBin model
> # keeping all other parameters fixed at their original estimates
> coefs <- replace(coef(fit), "overdisp", 0)
> simData2 <- simulate(fit, seed=123, coefs = coefs)
> plot(simData2, main = "simulated data: Poisson model", xaxis.labelFormat = NULL)
>
> # simulate from a model with higher autoregressive parameter
> coefs <- replace(coef(fit), "ar.1", log(0.9))
> simData3 <- simulate(fit, seed=321, coefs = coefs)
> plot(simData3, main = "simulated data: lambda = 0.5", xaxis.labelFormat = NULL)
>
>
> ## more sophisticated: simulate beyond initially observed time range
>
> # extend data range by one year (non-observed domain), filling with NA values
> nextend <- 52
> timeslots <- c("observed", "state", "alarm", "upperbound", "populationFrac")
> addrows <- function (mat, n) mat[c(seq_len(nrow(mat)), rep(NA, n)),,drop=FALSE]
> extended <- Map(function (x) addrows(slot(meningo, x), n = nextend), x = timeslots)
> # create new sts object with extended matrices
> meningo2 <- do.call("sts", c(list(start = meningo@start, frequency = meningo@freq,
+ map = meningo@map), extended))
>
> # fit to the observed time range only, via the 'subset' argument
> fit2 <- hhh4(meningo2, control = list(
+ ar = list(f = ~ 1),
+ end = list(f = addSeason2formula(~1, period = 52)),
+ family = "NegBin1",
+ subset = 2:(nrow(meningo2) - nextend)))
> # the result is the same as before
> stopifnot(all.equal(fit, fit2, ignore = c("stsObj", "control")))
> ## Don't show:
> # one-week-ahead prediction only "works" for the first non-observed time point
> # because the autoregressive component relies on non-missing past counts
> oneStepAhead(fit2, tp = rep(nrow(meningo2)-nextend, 2), type = "final", verbose = FALSE)
$pred
meningococcus
313 11.45203
$observed
meningococcus
313 NA
$psi
-log(overdisp)
312 3.012411
$allConverged
[1] TRUE
attr(,"class")
[1] "oneStepAhead"
> # however, methods won't work as observed is NA
> ## End(Don't show)
> # long-term probabilistic forecast via simulation for non-observed time points
> meningoSim <- simulate(fit2, nsim = 100, seed = 1,
+ subset = seq(nrow(meningo)+1, nrow(meningo2)),
+ y.start = tail(observed(meningo), 1))
> apply(meningoSim, 1:2, function (ysim) quantile(ysim, c(0.1, 0.5, 0.9)))
Error in x@observed[i, j, drop = FALSE] : subscript out of bounds
Calls: apply ... subset_hhh4sims_attributes -> suppressMessages -> withCallingHandlers -> [ -> [
Execution halted
- checking for unstated dependencies in 'tests' ... OK
- checking tests ... [23s] OK
Running 'tinytest.R' [23s]
- checking for unstated dependencies in vignettes ... OK
- checking package vignettes ... OK
- checking running R code from vignettes ... SKIPPED
- checking re-building of vignette outputs ... SKIPPED
- checking PDF version of manual ... [30s] OK
- checking HTML version of manual ... [62s] OK
- DONE
Status: 1 ERROR