sim | R Documentation |
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')
sim(x, ...)
x |
An object of class
|
... |
Additional arguments (unused). |
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.
An updated object of class iAR
, CiAR
, or BiAR
, where the series
property contains the simulated time series.
Eyheramendy_2018iAR,\insertRefElorrieta_2019iAR,\insertRefElorrieta_2021iAR
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.