This function generates synthetic time series data from an autoregressive (AR) model.
Arguments
- time
Integer. Number of time points to simulate.
- burn_in
Integer. Number of burn-in periods before recording data.
- constant
Numeric. The constant term of the AR model.
- coef
Numeric vector. Autoregressive coefficients.
- sd
Numeric. The standard deviation of the random process noise.
Details
The SimAR() function generates synthetic time series data
from an autoregressive (AR) model.
The generated data follows the AR(p) model,
where p is the number of coefficients specified in coef.
The generated time series data includes a constant term
and autoregressive terms based on the provided coefficients.
Random noise, sampled from a normal distribution with mean 0
and standard deviation sd, is added to the time series.
A burn-in period is specified to exclude initial data points
from the output.
The steps in generating the autoregressive time series with burn-in are as follows:
Set the order of the AR model to
pbased on the length ofcoef.Create a vector data of size
time + burn_into store the generated AR time series data.Create a vector data of size
time + burn_inof random process noise from a normal distribution with mean 0 and standard deviationsd.Generate the autoregressive time series with burn-in using the formula: $$ Y_t = \mathrm{constant} + \sum_{i = 1}^{p} \left( \mathrm{coef}_i * Y_{t - i} \right) + \mathrm{noise}_t $$ where \(Y_t\) is the time series data at time \(t\), \(\mathrm{constant}\) is the constant term, \(\mathrm{coef}_i\) are the autoregressive coefficients, \(Y_{t - i}\) are the lagged data points up to order
p, and \(\mathrm{noise}_t\) is the random noise at time \(t\).Remove the burn-in period from the generated time series data.
See also
Other Simulation of Autoregressive Data Functions:
CheckARCoef(),
CheckVARCoef(),
SimARCoef(),
SimMVN(),
SimPD(),
SimVARCoef(),
SimVARExo(),
SimVARZIPExo(),
SimVARZIP(),
SimVAR(),
SimVariance(),
YXExo(),
YX()