sim {iAR} | R 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
|
... |
Additional arguments for generating irregular times. This is used only if no time points have been provided in the
|
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 BiAR 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
Eyheramendy S, Elorrieta F, Palma W (2018). “An irregular discrete time series model to identify residuals with autocorrelation in astronomical light curves.” Monthly Notices of the Royal Astronomical Society, 481(4), 4311-4322. ISSN 0035-8711, doi:10.1093/mnras/sty2487, https://academic.oup.com/mnras/article-pdf/481/4/4311/25906473/sty2487.pdf.,Elorrieta, F, Eyheramendy, S, Palma, W (2019). “Discrete-time autoregressive model for unequally spaced time-series observations.” A&A, 627, A120. doi:10.1051/0004-6361/201935560.,Elorrieta F, Eyheramendy S, Palma W, Ojeda C (2021). “A novel bivariate autoregressive model for predicting and forecasting irregularly observed time series.” Monthly Notices of the Royal Astronomical Society, 505(1), 1105-1116. ISSN 0035-8711, doi:10.1093/mnras/stab1216, https://academic.oup.com/mnras/article-pdf/505/1/1105/38391762/stab1216.pdf.
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")