>  Docs Center  >  IDL Reference  >  Advanced Math and Stats  >  IMSL_RANDOM_ARMA

IMSL_RANDOM_ARMA

IMSL_RANDOM_ARMA

The IMSL_RANDOM_ARMA function generates a time series from a specific IMSL_ARMA model.

This routine requires an IDL Advanced Math and Stats license. For more information, contact your sales or technical support representative.

The IMSL_RANDOM_ARMA function simulates an IMSL_ARMA(p, q) process, {Wt}, for t = 1, 2, ..., n. The model is:

Let µ be the mean of the time series {Wt}. The overall constant θ0 (Const) is:

Time series whose innovations have a nonnormal distribution may be simulated by providing the appropriate innovations in INPUT_NOISE and start values in W_INIT.

The time series is generated according to the following model:

X(i) = Const + ar(0) * X(i – Ar_Lags(0)) + ... + ar(p – 1) * X(i – Ar_Lags(p – 1)) + A(I) – ma(0) * A(i – Ma_Lags(0)) – ... – ma(q – 1) * A(i – Ma_Lags(q – 1))

where the constant is related to the mean of the series:

W

as follows:

Const = W · (1 - ar(0) - ... + (-ar(q - 1)))

and where:

X(t) = W(t), t = 0, 1, ..., n − 1

and:

W(t) = W_Init(t + p), t = –p, –p + 1, ..., −2, −1

and A is either INPUT_NOISE (if INPUT_NOISE is used) or OUTPUT_NOISE (otherwise).

Examples


Example 1

In this example, IMSL_RANDOM_ARMA is used to generate a time series of length five, using an IMSL_ARMA model with three autoregressive parameters and two moving average parameters. The start values are 0.1000, 0.0500, and 0.0375.

IMSL_RANDOMOPT, SET = 123457
n = 5
nparams = [3, 2]
ar = [0.5, 0.25, 0.125]
ma = [-0.5, -0.25]
r = IMSL_RANDOM_ARMA(n, nparams, ar, ma)
PM, r, FORMAT = '(5F10.3)',$
  TITLE = ' IMSL_ARMA random deviates'
 
      IMSL_ARMA random deviates
0.637 0.317 -0.366 -2.122 -1.407

Example 2

In this example, a time series of length 5 is generated using an IMSL_ARMA model with 4 autoregressive parameters and 2 moving average parameters. The start values are 0.1, 0.05 and 0.0375.

IMSL_RANDOMOPT, SET = 123457
n = 5
nparams = [3, 2]
ar = [0.5, 0.25, 0.125]
ma = [-0.5, -0.25]
wi = [0.1, 0.05, 0.0375]
theta0 = 1
avar = 0.1
r = IMSL_RANDOM_ARMA(n, nparams, ar, ma, /ACCEPT_REJECT, $
W_INIT = wi, CONST = theta0, VAR_NOISE = avar)
PM, r, FORMAT = '(5F10.3)', $
  TITLE = ' IMSL_ARMA random deviates:'
 
      IMSL_ARMA random deviates:
1.467 1.788 2.459 3.330 3.941

Errors


Warning Errors

STAT_RNARM_NEG_VAR: VAR(a) = “Var_Noise” = #, VAR(a) must be greater than 0. The absolute value of # is used for VAR(a).

Syntax


Result = IMSL_RANDOM_ARMA(n, nparams [, ar, ma] [, /ACCEPT_REJECT] [, AR_LAGS=array] [, CONST=value] [, /DOUBLE] [, INPUT_NOISE=array] [, MA_LAGS=array] [, OUTPUT_NOISE=variable] [, /VAR_NOISE] [, W_INIT=array])

Return Value


One-dimensional array of length n containing the generated time series.

Arguments


N

Number of observations to be generated. Parameter n must be greater than or equal to one.

Nparams

One-dimensional array containing the parameters p and q consecutively. nparams[0] = p, where p is the number of autoregressive parameters. Parameter p must be greater than or equal to zero. nparams[1] = q, where q is the number of moving average parameters. Parameter q must be greater than or equal to zero.

  • If nparams[0] = 0 and nparams[1] = 0 then the AR and MA parameters should not be specified.
  • If nparams[0] > 0 and nparams[1] = 0 then the third parameter is the AR parameter.
  • If nparams[0] = 0 and nparams[1] > 0 then the third parameter is the MA parameter.
  • If nparams[0] > 0 and nparams[1] > 0 then the third parameter is the AR and the fourth parameter is the MA.

Ar

One-dimensional array of length p containing the autoregressive parameters.

Ma

One-dimensional array of length q containing the moving average parameters.

Keywords


ACCEPT_REJECT (optional)

If present and nonzero, the random noises will be generated from a normal distribution using an acceptance/rejection method. If keyword ACCEPT_REJECT is not used, the random noises will be generated using an inverse normal CDF method. This argument will be ignored if keyword INPUT_NOISE is used.

AR_LAGS (optional)

One-dimensional array of length p containing the order of the nonzero autoregressive parameters. Default: Ar_Lags = [1, 2, ..., p]

CONST (optional)

Overall constant. See the description at the beginning of this topic. Default: Const = 0

DOUBLE (optional)

If present and nonzero, double precision is used.

INPUT_NOISE (optional)

One-dimensional array of length n + max (Ar_Lags(i)) containing the random noises. Keywords INPUT_NOISE and VAR_NOISE can not be used together. Keywords INPUT_NOISE and OUTPUT_NOISE cannot be used together.

MA_LAGS (optional)

One-dimensional array of length q containing the order of the nonzero moving average parameters. Default: MA_LAGS = [1, 2, ..., q]

OUTPUT_NOISE (optional)

Named variable into which a one-dimensional array of length n + max (Ma_Lags(i)) containing the random noises is stored.

VAR_NOISE (optional)

If present (and INPUT_NOISE is not used), noise at is generated from a normal distribution with mean 0 and variance VAR_NOISE. VAR_NOISE and INPUT_NOISE cannot be used together. Default: VAR_NOISE = 1.0

W_INIT (optional)

One-dimensional array of length max (Ar_Lags(i)) containing the initial values of the time series. Default: W_Init(*) = Const/(1 – ar(0) – ar(1) – ... – ar(p − 1))

Version History


6.4

Introduced

See Also


IMSL_RANDOM



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us