|
In this section we focus our attention on the class of linear models, i.e. models driven by a general dynamic relationship of the form
A process is called an autoregressive process of order
, AR(
), if it is
driven by the relation
A sample of observations of an AR(
) process can be generated using the command
genar
, which has the following syntax:
y = genar(eps, starval, phi)where
In the following example a sample of 250 observations of an AR()
process is generated.
In this example, x is a vector of 250 independent realizations
of standardized normal random variable.
randomize (0) eps = normal(250) starval = 0 phi = 0.5 y = genar(eps,starval,phi)
In the following example, using the function
spec
, the typical spectrum of an autoregressive process
is displayed.
Note that the lowest frequencies have the highest contribution
to the variation of the process.
spec
also displays the
periodogram of the series. Type the instruction
spec(y)to obtain the plots in Figure 9.5.
A process is called a
moving average process of order
, MA(
), if it is
driven by the relation
The structures of the autoregressive (AR) process and the moving average (MA) process may be combined into an autoregressive moving average process
A sample of observations of an ARMA(
) process can be generated using
genarma
, which has the following syntax:
y = genarma(a,b,eps)where
In the following example a sample of 250 observations of an
ARMA() with Gaussian innovations process is generated:
randomize(0) a = 0.5 b = 0.3 eps = normal(250) y = genarma(a,b,eps)
The parameters of an ARMA() process may be estimated using
armalik
, which has the following syntax:
est = armalik(y)where
To estimate the parameters of our generated ARMA(1,1) process, type:
est1 = armalik(y) est1{1} est1{2}
Contents of a [1,] 0.49957 [2,] 0.25991 Contents of stderr [1,] 0.057633 [2,] 0.064244
The parameters of a general ARMA() process can be estimated
by
armacls
. This quantlet minimizes the
conditional sum of squares and has the following syntax:
est = armacls(y,p,q)where
est2 = armacls(y,1,1) est2
Contents of est2.y.minimum [1,] 0.49504 [2,] 0.28265 Contents of est2.y.iter [1,] 20 Contents of est2.y.converged [1,] 1 Contents of est2.wnv [1,] 0.90943