Language Reference

FARMASIM Call

CALL FARMASIM (series, d <, phi> <, theta> <, mu> <, sigma> <, n> <, p> <, q> <, initial> <, seed> ) ;

This subroutine is supported by the IML procedure and the iml action.

The FARMASIM subroutine generates an ARFIMA(p comma d comma q) process. The input arguments to the FARMASIM subroutine are as follows:

d

specifies a fractional differencing order. This argument is required; the value of d should be in the open interval left-parenthesis negative 1 comma 1 right-parenthesis excluding zero.

phi

specifies an m Subscript p-dimensional vector that contains the autoregressive coefficients, where m Subscript p is the number of the elements in the subset of the AR order. The default is zero.

theta

specifies an m Subscript q-dimensional vector that contains the moving average coefficients, where m Subscript q is the number of the elements in the subset of the MA order. The default is zero.

mu

specifies a mean value. The default is zero.

sigma

specifies a variance of the innovation series. The default is one.

n

specifies the length of the series. The value of n should be greater than or equal to the AR order. The default is n equals 100 is used.

p

specifies the subset of the AR order. See the FARMACOV subroutine for additional details.

q

specifies the subset of the MA order. See the FARMACOV subroutine for additional details.

initial

specifies the initial values of random variables. The initial value is used for the nonstationary process. If initialequals a 0, then y Subscript negative p plus 1 Baseline comma ellipsis comma y 0 take the same value a 0. If the initial option is not specified, the initial values are set to zero.

seed

is a scalar that contains the random number seed. At the first execution of the subroutine, the seed variable is used as follows:

If seed > 0, the input seed is used for generating the series.

If seed = 0, the system clock is used to generate the seed.

If seed < 0, the value (negative 1)times(seed) is used for generating the series.

If the seed is not supplied, the system clock is used to generate the seed.

On subsequent calls of the subroutine in the DO-loop-like environment, the seed variable is used as follows: If seed > 0, the seed remains unchanged. In other cases, after each execution of the subroutine, the current seed is updated internally.

The FARMASIM subroutine returns the following value:

series

is an n vector that contains the generated ARFIMA(p comma d comma q) process.

As an example, consider the following ARFIMA(1 comma 0.3 comma 1) process:

left-parenthesis 1 minus 0.5 upper B right-parenthesis left-parenthesis 1 minus upper B right-parenthesis Superscript 0.3 Baseline left-parenthesis y Subscript t Baseline minus 10 right-parenthesis equals left-parenthesis 1 plus 0.1 upper B right-parenthesis epsilon Subscript t

In this process, epsilon Subscript t Baseline tilde NID left-parenthesis 0 comma 1.2 right-parenthesis. The following statements generate this process:

d = 0.3;
phi = 0.5;
theta = -0.1;
mu    = 10;
sigma = 1.2;
call farmasim(yt, d, phi, theta, mu, sigma, 10) seed=1234;
print yt;

Figure 154: Data Simulated from a ARFIMA Process

yt
12.17358
13.954495
15.817231
15.94882
12.25926
13.641022
13.399623
11.930759
10.049435
9.1445036


The FARMASIM subroutine generates a time series of length n from an ARFIMA(p comma d comma q) model. If the process is stationary and invertible, the initial values y Subscript negative p plus 1 Baseline comma ellipsis comma y 0 are produced by using covariance matrices obtained from FARMACOV. If the process is nonstationary, the time series is recursively generated by using the user-defined initial value or the zero initial value.

To generate an ARFIMA(p comma d comma q) process with d element-of left-bracket 0.5 comma 1 right-parenthesis, x Subscript t is first generated for d prime element-of left-parenthesis negative 0.5 comma 0 right-parenthesis, where d prime equals d minus 1 and then y Subscript t is generated by y Subscript t Baseline equals y Subscript t minus 1 Baseline plus x Subscript t.

To generate an ARFIMA(p comma d comma q) process with d element-of left-parenthesis negative 1 comma negative 0.5 right-bracket, a two-step approximation based on a truncation of the expansion left-parenthesis 1 minus upper B right-parenthesis Superscript d is used; the first step is to generate an ARFIMA(0 comma d comma 0) process x Subscript t Baseline equals left-parenthesis 1 minus upper B right-parenthesis Superscript negative d Baseline epsilon Subscript t, with truncated moving average weights; the second step is to generate y Subscript t Baseline equals phi left-parenthesis upper B right-parenthesis Superscript negative 1 Baseline theta left-parenthesis upper B right-parenthesis x Subscript t.

Last updated: July 20, 2026