(To be removed) Estimate recursively parameters of ARMAX or ARMA models
thm = rarmax(z,nn,adm,adg) [thm,yhat,P,phi,psi] = rarmax(z,nn,adm,adg,th0,P0,phi0,psi0)
The parameters of the ARMAX model structure
are estimated using a recursive prediction error method.
The input-output data is contained in
which is either an
iddata object or a matrix
= [y u] where
nn is given as
nn = [na nb nc nk]
the orders of the ARMAX model, and
nk is the delay.
See What Are Polynomial Models? for more information.
z represents a time series
= [na nc],
rarmax estimates the parameters
of an ARMA model for
Only single-input, single-output models are handled by
rpem for the multiple-input case.
The estimated parameters are returned in the matrix
kth row of
the parameters associated with time
k; that is,
they are based on the data in the rows up to and including row
Each row of
thm contains the estimated parameters
in the following order:
thm(k,:) = [a1,a2,...,ana,b1,...,bnb,c1,...,cnc]
yhat is the predicted value of the output,
according to the current model; that is, row k of
the predicted value of
y(k) based on all past data.
The actual algorithm is selected with the two arguments
These are described under
The input argument
th0 contains the initial
value of the parameters, a row vector consistent with the rows of
The default value of
th0 is all zeros.
the initial and final values, respectively, of the scaled covariance
matrix of the parameters. See
The default value of
P0 is 104 times
the unit matrix. The arguments
psi contain initial and final values of the
data vector and the gradient vector, respectively. The sizes of these
depend on the chosen model orders. The normal choice of
to use the outputs from a previous call to
the same model orders. (This call could be a dummy call with default
input arguments.) The default values of
Note that the function requires that the delay
0. If you want
nk = 0,
shift the input sequence appropriately and use
nk = 1.
Compute and plot, as functions of time, the four parameters
in a second-order ARMA model of a time series given in the vector
The forgetting factor algorithm with a forgetting factor of 0.98 is
thm = rarmax(y,[2 2],'ff',0.98); plot(thm)
The general recursive prediction error algorithm (11.44), (11.47) through (11.49) of Ljung (1999) is implemented. See Recursive Algorithms for Online Parameter Estimation for more information.