Main data simulation function
require(DrBats)## Le chargement a nécessité le package : DrBats
## Le chargement a nécessité le package : rstan
## Le chargement a nécessité le package : StanHeaders
## Le chargement a nécessité le package : ggplot2
## rstan (Version 2.21.3, GitRev: 2e1f913d3ca3)
## For execution on a local, multicore CPU with excess RAM we recommend calling
## options(mc.cores = parallel::detectCores()).
## To avoid recompilation of unchanged Stan programs, we recommend calling
## rstan_options(auto_write = TRUE)
## Do not specify '-march=native' in 'LOCAL_CPPFLAGS' or a Makevars file
st_data <- drbats.simul(N = 10,
t.range = c(0, 1000),
b.range = c(0.2, 0.4),
c.range = c(0.6, 0.8),
b.sd = 0.5,
c.sd = 0.5,
y.range = c(-5, 5),
sigma2 = 0.2,
breaks = 15,
data.type = 'sparse.tend')mycol<-c("#ee204d", "#1f75fe", "#1cac78", "#ff7538", "#b4674d", "#926eae",
"#fce883", "#000000", "#78dbe2", "#6e5160", "#ff43a4")The parameters b.range and c.range dictate the location of two peaks, and b.sd and c.sd the variance of the peaks. Once the signals have been simulated, the function samples observation times over the range of possible times t.range. Few times are chosen in b.range and c.range, and many are chosen outside these ranges.
The parameter data.type specifies the type of signal to simulate: sparse will simulate a bi-modal signal that is flat between the modes. The sparse.tend option will simulate bi-modal signals with a trend, and the sparse.tend.cos will simulate periodic bi-modal signals with a trend.
matplot(t(st_data$t), t(st_data$X), type = 'l', lty = 1, lwd = 1,
xlab = 'Time', ylab = ' ', col = mycol[1:10])
points(t(st_data$t), t(st_data$X), pch = '.')