Learn R Programming

tfarima (version 0.4.1)

sim.tfm: Simulate Time Series from ARIMA or Transfer Function Models

Description

Generates random time series from ARIMA (um) or transfer function (tfm) models.

Usage

# S3 method for tfm
sim(
  mdl,
  n = 100,
  z0 = NULL,
  n0 = 0,
  a = NULL,
  seed = NULL,
  envir = parent.frame(),
  ...
)

sim(mdl, ...)

# S3 method for um sim( mdl, n = 100, z0 = NULL, n0 = 0, a = NULL, seed = NULL, envir = parent.frame(), ... )

Value

A ts object with the simulated time series.

Arguments

mdl

An object of class um or tfm.

n

Number of observations to simulate.

z0

Initial conditions for nonstationary series. Default is NULL (zero initial conditions).

n0

Number of initial observations to discard as burn-in. Default is 0.

a

Optional vector of innovations with length n + n0. If NULL, innovations are drawn from \(N(0, \sigma^2)\).

seed

Random seed for reproducibility.

envir

Environment for argument evaluation. Default is parent.frame().

...

Additional arguments.

See Also

sim.um, sim.tfm

Examples

Run this code
# AR(1) model
mdl1 <- um(ar = "1 - 0.8B", sig2 = 1)
z1 <- sim(mdl1, n = 100, seed = 123)

# ARIMA(0,1,1) with burn-in
mdl2 <- um(i = 1, ma = "1 - 0.5B", sig2 = 1)
z2 <- sim(mdl2, n = 100, n0 = 50, seed = 456)

Run the code above in your browser using DataLab