sim_gctsc: Simulate from Gaussian and t Copula Time Series Models

sim_gctscR Documentation

Simulate from Gaussian and t Copula Time Series Models

Description

These functions simulate time series data from Gaussian and t copula models with various discrete marginals and an ARMA dependence structure.

Usage

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
)

Arguments

mu

Mean parameter(s) for Poisson-, ZIP-, and negative binomial-type marginals. Must satisfy \mu > 0. May be specified as a scalar or as a numeric vector of length nsim to allow time-varying means.

tau

Numeric vector of ARMA dependence coefficients, ordered as c(phi_1, ..., phi_p, theta_1, ..., theta_q), where \phi_i are autoregressive (AR) coefficients and \theta_j are moving-average (MA) coefficients. The model ARMA(0, 0) is not supported.

arma_order

Integer vector c(p, q) specifying the AR and MA orders.

nsim

Positive integer giving the number of time points to simulate.

family

Character string specifying the copula family: "gaussian" or "t".

df

Degrees of freedom for the t copula. Must be a single numeric value greater than 2. Required only when family = "t".

seed

Optional integer used to set the random seed.

dispersion

Overdispersion parameter for negative binomial marginals. Must satisfy \kappa > 0, where \mathrm{Var}(Y) = \mu + \kappa \mu^2. May be a scalar or a numeric vector of length nsim.

pi0

Zero-inflation probability for ZIP, ZIB, and ZIBB marginals. Must satisfy 0 \le \pi_0 < 1. May be a scalar or a numeric vector of length nsim.

prob

Success probability parameter(s) for binomial-type marginals. Must satisfy 0 < p < 1. May be a scalar or a numeric vector of length nsim.

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 0 < \rho < 1, where \mathrm{Var}(Y) = n p (1-p)\{1 + (n-1)\rho\} and n is the number of trials. May be a scalar or a numeric vector of length nsim.

Details

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.

Value

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.

Examples

# 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)


gctsc documentation built on March 20, 2026, 9:11 a.m.