

    \filetitle{arf}{Run autoregressive function on a tseries object}{tseries/arf}

	\paragraph{Syntax}

\begin{verbatim}
X = arf(X,A,Z,RANGE,...)
\end{verbatim}

\paragraph{Input arguments}

\begin{itemize}
\item
  \texttt{X} {[} tseries {]} - Input data from which initial condition
  will be taken.
\item
  \texttt{A} {[} numeric {]} - Vector of coefficients of the
  autoregressive polynomial.
\item
  \texttt{Z} {[} numeric \textbar{} tseries {]} - Exogenous input or
  constantn in the autoregressive process.
\item
  \texttt{RANGE} {[} numeric \textbar{} Inf {]} - Date range on which
  the new time series observations will be computed; \texttt{RANGE} does
  not include pre-sample initial condition. \texttt{Inf} means the
  entire possible range will be used (taking into account the length of
  pre-sample initial condition needed).
\end{itemize}

\paragraph{Output arguments}

\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
  \texttt{X} {[} tseries {]} - Output data with new observations created
  by running an autoregressive process described by \texttt{A} and
  \texttt{Z}.
\end{itemize}

\paragraph{Description}

The autoregressive process has one of the following forms:

\begin{verbatim}
a1*x + a2*x(-1) + ... + an*x(-n) = z,
\end{verbatim}

or

\begin{verbatim}
a1*x + a2*x(+1) + ... + an*x(+n) = z,
\end{verbatim}

depending on whether the range is increasing (running forward in time),
or decreasing (running backward in time). The coefficients
\texttt{a1},\ldots{}\texttt{an} are gathered in the \texttt{A} vector,

\begin{verbatim}
A = [a1,a2,...,an].
\end{verbatim}

\paragraph{Example}

The following two lines create an autoregressive process constructed
from normally distributed residuals,

\[ x_t = \rho x_{t-1} + \epsilon_t \]

\begin{verbatim}
rho = 0.8;
X = tseries(1:20,@randn);
X = arf(X,[1,-rho],X,2:20);
\end{verbatim}


