| sim_gctsc | R Documentation |
These functions simulate time series data from Gaussian and t copula models with various discrete marginals and an ARMA dependence structure.
sim_poisson(
mu,
tau,
arma_order,
nsim,
family = c("gaussian", "t"),
df = NULL,
seed = NULL
)
sim_negbin(
mu,
dispersion,
tau,
arma_order,
nsim = 100,
family = c("gaussian", "t"),
df = NULL,
seed = NULL
)
sim_zip(
mu,
pi0,
tau,
arma_order,
nsim = 100,
family = c("gaussian", "t"),
df = NULL,
seed = NULL
)
sim_binom(
prob,
size,
tau,
arma_order,
nsim = 100,
family = c("gaussian", "t"),
df = NULL,
seed = NULL
)
sim_bbinom(
prob,
rho,
size,
tau,
arma_order,
nsim = 100,
family = c("gaussian", "t"),
df = NULL,
seed = NULL
)
sim_zib(
prob,
pi0,
size,
tau,
arma_order,
nsim = 100,
family = c("gaussian", "t"),
df = NULL,
seed = NULL
)
sim_zibb(
prob,
rho,
pi0,
size,
tau,
arma_order,
nsim = 100,
family = c("gaussian", "t"),
df = NULL,
seed = NULL
)
mu |
Mean parameter(s) for Poisson-, ZIP-, and negative
binomial-type marginals. Must satisfy |
tau |
Numeric vector of ARMA dependence coefficients, ordered as
|
arma_order |
Integer vector |
nsim |
Positive integer giving the number of time points to simulate. |
family |
Character string specifying the copula family:
|
df |
Degrees of freedom for the t copula. Must be a single numeric
value greater than 2. Required only when |
seed |
Optional integer used to set the random seed. |
dispersion |
Overdispersion parameter for negative binomial marginals.
Must satisfy |
pi0 |
Zero-inflation probability for ZIP, ZIB, and ZIBB marginals.
Must satisfy |
prob |
Success probability parameter(s) for binomial-type marginals.
Must satisfy |
size |
Number of trials for binomial-type marginals; a positive integer scalar. |
rho |
Intra-class correlation parameter for beta-binomial and ZIBB
marginals. Must satisfy |
Marginal types:
Poisson: Counts with mean \mu.
Negative binomial (NB): Overdispersed counts with mean \mu and dispersion parameter \kappa.
Binomial: Number of successes in n trials with success probability p.
Beta–-binomial (BB): Binomial with success probability p following a beta distribution, allowing intra-cluster correlation \rho.
Zero–inflated Poisson (ZIP): Poisson with extra probability \pi_0 of an excess zero.
Zero–inflated binomial (ZIB): Binomial with extra probability \pi_0 of an excess zero.
Zero–inflated beta–binomial (ZIBB): Beta–binomial with extra probability \pi_0 of an excess zero.
Parameterization notes:
Negative binomial uses dispersion (\kappa) to model
overdispersion: larger dispersion increases variance for a fixed mean.
Beta–binomial and ZIBB use rho as the overdispersion parameter:
\rho is the intra-class correlation, with \rho \to 0
giving the binomial model.
Zero–inflated marginals include a separate pi0 parameter that
controls the extra probability mass at zero.
A list with components:
y: Simulated time series data.
z: Latent Gaussian process values.
marginal: Marginal distribution name.
parameters: List of parameters used.
cormat: ARMA structure.
# Poisson example
sim_poisson(mu = 10, tau = c(0.2, 0.2),
arma_order = c(1, 1), nsim = 100,
family = "gaussian", seed = 42)
# Negative Binomial example
sim_negbin(mu = 10, dispersion = 2, tau = c(0.5, 0.5),
arma_order = c(1, 1),family = "gaussian",
nsim = 100, seed =1)
# Zero Inflated Beta-Binomial example with seasonal covariates
n <- 100
xi <- numeric(n)
zeta <- rnorm(n)
for (j in 3:n) {
xi[j] <- 0.6 * xi[j - 1] - 0.4 * xi[j - 2] + zeta[j]
}
prob <- plogis(0.2 + 0.3 * sin(2 * pi * (1:n) / 12) +
0.5 * cos(2 * pi * (1:n) / 12) + 0.3 * xi)
sim_zibb(prob, rho = 1/6, pi0 = 0.2, size = 24, tau = 0.5,
arma_order = c(1, 0),family = "t", df = 10, nsim = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.