Learn R Programming

bssm (version 2.0.2)

negbin_series: Simulated Negative Binomial Time Series Data

Description

See example for code for reproducing the data. This was used in Helske and Vihola (2021).

Arguments

Format

A time series mts object with 200 time points and two series.

References

Helske J, Vihola M (2021). bssm: Bayesian Inference of Non-linear and Non-Gaussian State Space Models in R. The R Journal (2021) 13:2, 578-589. https://doi.org/10.32614/RJ-2021-103

See Also

negbin_model

Examples

Run this code
# The data was generated as follows:
set.seed(123)
n <- 200
sd_level <- 0.1
drift <- 0.01
beta <- -0.9
phi <- 5

level <- cumsum(c(5, drift + rnorm(n - 1, sd = sd_level)))
x <- 3 + (1:n) * drift + sin(1:n + runif(n, -1, 1))
y <- rnbinom(n, size = phi, mu = exp(beta * x + level))

Run the code above in your browser using DataLab