arima.sim               package:stats               R Documentation

_S_i_m_u_l_a_t_e _f_r_o_m _a_n _A_R_I_M_A _M_o_d_e_l

_D_e_s_c_r_i_p_t_i_o_n:

     Simulate from an ARIMA model.

_U_s_a_g_e:

     arima.sim(model, n, rand.gen = rnorm, innov = rand.gen(n, ...),
               n.start = NA, start.innov = rand.gen(n.start, ...),
               ...)

_A_r_g_u_m_e_n_t_s:

   model: A list with component 'ar' and/or 'ma' giving the AR and MA
          coefficients respectively.  Optionally a component 'order'
          can be used. An empty list gives an ARIMA(0, 0, 0) model,
          that is white noise.

       n: length of output series, before un-differencing.

rand.gen: optional: a function to generate the innovations.

   innov: an optional times series of innovations.  If not provided,
          'rand.gen' is used.

 n.start: length of 'burn-in' period.  If 'NA', the default, a
          reasonable value is computed.

start.innov: an optional times series of innovations to be used for the
          burn-in period.  If supplied there must be at least 'n.start'
          values (and 'n.start' is by default computed inside the
          function).

     ...: additional arguments for 'rand.gen'.  Most usefully, the
          standard deviation of the innovations generated by 'rnorm'
          can be specified by 'sd'.

_D_e_t_a_i_l_s:

     See 'arima' for the precise definition of an ARIMA model.

     The ARMA model is checked for stationarity.

     ARIMA models are specified via the 'order' component of 'model',
     in the same way as for 'arima'.  Other aspects of the 'order'
     component are ignored, but inconsistent specifications of the MA
     and AR orders are detected.  The un-differencing assumes previous
     values of zero, and to remind the user of this, those values are
     returned.

     Random inputs for the 'burn-in' period are generated by calling
     'rand.gen'.

_V_a_l_u_e:

     A time-series object of class '"ts"'.

_S_e_e _A_l_s_o:

     'arima'

_E_x_a_m_p_l_e_s:

     require(graphics)

     arima.sim(n = 63, list(ar = c(0.8897, -0.4858), ma = c(-0.2279, 0.2488)),
               sd = sqrt(0.1796))
     # mildly long-tailed
     arima.sim(n = 63, list(ar=c(0.8897, -0.4858), ma=c(-0.2279, 0.2488)),
               rand.gen = function(n, ...) sqrt(0.1796) * rt(n, df = 5))

     # An ARIMA simulation
     ts.sim <- arima.sim(list(order = c(1,1,0), ar = 0.7), n = 200)
     ts.plot(ts.sim)

