\section*{Partial Autocorrelation Function}
Recall, in the dim past, that we saw the autocorrelation function
(acf) for an AR(1) model looked just like an exponential decline (or
an oscillatory exponential decline).  What does the ACF of an AR(2)
or AR(3) process look like?
The following graph shows plots of two AR processes,
$$ y_t = .7 y_{t-1} + .2 y_{t-2} + z_t $$
and
$$ y_t = .7 y_{t-1} + z_t $$
and their autocorrelation functions.  Notice that the ACF's have long
lags and it is not easy to diagnose anything.  
\begin{verbatim}
> tsplot(dd <- arima.sim(200, model=list(ar=c(.7, .2))))
> acf(dd)
> tsplot(dd <- arima.sim(200, model=list(ar=c(.7))))    
> acf(dd)                                           
> 
\end{verbatim}
\centerline{\psfig{figure=4acf.eps,angle=-90,width=6in}}

What about a similar set of plots for a MA(1) and MA(2) process?
\begin{verbatim}
> tsplot(dd <- arima.sim(200, model=list(ma=c(.6))))
> acf(dd)
> tsplot(dd <- arima.sim(200, model=list(ma=c(.6, .4))))
> acf(dd)
> 
\end{verbatim}
\centerline{\psfig{figure=4acfma.eps,angle=-90,width=6in}}

The two models that we fit are
$$ y_t = .6 z_{t-1} + z_t $$
and
$$ y_t = .6 z_{t-1} + .4 z_{t-2} + z_t $$

Notice that the ACF tails off after lag 1 and 2.  That is the ACF
provides a diagnostic of the order of the MA process.  A simple (too
simple!) conclusion is that if the ACF is zero beyond a certain lag,
then that is evidence for an MA process of the appropriate order.   

That turns out to be a useful observation, but it doesn't help us with
AR processes.  We need to search for a diagnostic that will help us
determine the order of an AR process---but we don't have to search all
that far.  What we need is the partial autocorrelation function
(PACF).  The conceptual idea (not computational, but that doesn't
matter) is that we take a time series and fit AR models of orders 1,
2, 3, and so on.  For the PACF at lag 1 we use the coefficient
$\alpha_1$ of the fitted AR(1) model.  At lag 2 we use the coefficient
$\alpha_2$ of the AR(2) model, and so on.  Clearly (I hope it is
clear) if we really have an AR(k) model then all of the coefficients
at lags greater than $k$ should be zero---or at least they should be
as close to zero as sampling error allows.
It works really well.
To actually calculate the PACF (and plot it in S) requires the use of
the acf function with an extra argument.
\begin{verbatim}
acf(dd,type="p")
\end{verbatim}
I have produced four plots, two of AR(2) processes and two of AR(1)
processes.  Notice that these plots look like the ACF plots of MA
processes. 
\begin{verbatim}
> acf(arima.sim(200, model=list(ar=c(.7, .2))), type="p") 
> acf(arima.sim(200, model=list(ar=c(.7, .2))), type="p")
> acf(arima.sim(200, model=list(ar=c(.7))), type="p")    
> acf(arima.sim(200, model=list(ar=c(.7))), type="p")
\end{verbatim}
\centerline{\psfig{figure=4pacfar.eps,angle=-90,width=6in}}

Maybe the PACF of a MA process will look like the ACF of an AR
process?  This sort of duality would be quite useful.  Lets look and
see.  The simulations were generated by
\begin{verbatim}
> acf( arima.sim(200, model=list(ma=c(-.9))), type="p")
> acf( arima.sim(200, model=list(ma=c(.9))), type="p") 
> acf( arima.sim(200, model=list(ma=c(.9, .6))), type="p")
> acf( arima.sim(200, model=list(ma=c(.9, .6))), type="p")
\end{verbatim}
The following plots really do look like the ACF of AR's.  There is a
mathematical duality between ACF's and PACF's, but the important thing
to note is that each of them is quite good at helping to diagnose the
order of a pure MA or a pure AR process.

\centerline{\psfig{figure=4pacfma.eps,angle=-90,width=6in}}

% Local Variables: 
% mode: latex
% eval: (LaTeX-math-mode t)
% eval: (my-latex-mode)
% eval: (read-abbrev-file "~/.abbrev_defs")
% abbrev-mode: t
% TeX-master: "class"
% End: 
