sim: Simulate Time Series for Multiple iAR Models

simR Documentation

Simulate Time Series for Multiple iAR Models

Description

Simulates a time series for irregular autoregressive (iAR) models, including: 1. Normal iAR model ('iAR') 2. T-distribution iAR model ('iAR-T') 3. Gamma-distribution iAR model ('iAR-Gamma')

Usage

sim(x, ...)

Arguments

x

An object of class iAR, CiAR, or BiAR, containing the model specification and parameters:

  • For iAR (irregular AR models), the model family could be "norm", "t", or "gamma", where:

    • family: The distribution family of the iAR model (one of "norm", "t", or "gamma").

    • coef: The coefficient(s) of the iAR model.

    • times: A numeric vector specifying the time points of the series.

    • df: Degrees of freedom for the t-distribution (only for family = "t").

    • sigma: The scale parameter for the t-distribution (only for family = "t").

    • mean: The mean parameter for the gamma distribution (only for family = "gamma").

    • variance: The variance parameter for the gamma distribution (only for family = "gamma").

  • For CiAR (complex irregular autoregressive models):

    • coef: The real and imaginary parts of the CiAR model's coefficients.

    • times: A numeric vector specifying the time points of the series.

    • rho: The correlation parameter for the CiAR model.

    • c: The scale parameter for the CiAR model.

  • For BiAR (bi-AR models):

    • coef: The coefficients of the BiAR model (real and imaginary).

    • times: A numeric vector specifying the time points of the series.

    • rho: The correlation parameter for the BiAR model.

    • series_esd: The series for the error structure (optional, used internally).

...

Additional arguments (unused).

Details

This function simulates time series based on the specified model and its parameters. Depending on the class of the input object:

  • For iAR models, it supports three distribution families:

  • "norm" for normal distribution.

  • "t" for t-distribution.

  • "gamma" for gamma distribution.

  • For CiAR models, it uses complex autoregressive processes to generate the time series.

  • For BiAR models, it simulates a bi-AR process using specified coefficients and correlation.

The coefficients and any family-specific parameters must be set before calling this function.

Value

An updated object of class iAR, CiAR, or BiAR, where the series property contains the simulated time series.

References

\insertRef

Eyheramendy_2018iAR,\insertRefElorrieta_2019iAR,\insertRefElorrieta_2021iAR

Examples

# Example 1: Simulating a normal iAR model
library(iAR)
n=100
set.seed(6714)
o=iAR::utilities()
o<-gentime(o, n=n)
times=o@times
model_norm <- iAR(family = "norm", times = times, coef = 0.9,hessian=TRUE)
model_norm <- sim(model_norm)
plot(model_norm, type = "l", main = "Simulated iAR-Norm Series")

# Example 2: Simulating a CiAR model
set.seed(6714)
model_CiAR <- CiAR(times = times,coef = c(0.9, 0))
model_CiAR <- sim(model_CiAR)
plot(model_CiAR , type = "l", main = "Simulated CiAR Series")

# Example 3: Simulating a BiAR model
set.seed(6714)
model_BiAR <- BiAR(times = times,coef = c(0.9, 0.3), rho = 0.9)
model_BiAR <- sim(model_BiAR)
plot(times, model_BiAR@series[,1], type = "l", main = "Simulated BiAR Series")


iAR documentation built on April 4, 2025, 2:21 a.m.

Related to sim in iAR...