On Tue, 3 Feb 2009, Allin Cottrell wrote:
It's now implemented in CVS, up to a point. Note that the old
CVS
functions acf() and xcf() are gone. We now have one function,
corrgm(). This has the semantics Jack describes. Absent the
third argument, ACF and PACF are combined, in adjacent pairs of
columns in the output matrix. (There's just one pair of columns
in the output if arg1 is a series or column vector, but k >= 1
pairs if arg1 is a general matrix or list.)
Two possible (mututally exclusive) refinements: one is implied by the
attached patch: when arg1 is multiple, the 2*n columns of the output
vector are sorted so that the first n columns contain the ACFs and columns
from n+1 to 2*n contain the PACFs. This would make it easier (IMO) to
retrieve the results.
Alternatively (but this is more complex to code and arguably less
intuitive), we may exploit the 3rd argument like we do with mols() for
residuals: corrgm() would always return the ACFs in a p \times n matrix.
If the partial autocorrelations are wanted too, you use a pointer to a
matrix, as in
list X = 1 2 3
matrix pacf
acf = corrgm(X, 10, &pacf)
The advantage I see in this is that, like Sven said, you don't have to
wast CPU on the PACFs if you don't need them. Opinions?
The "up to a point" bit is that when the third argument is
given
(i.e. cross-correlogram is wanted), only the following two cases
are implemented so far:
* arg1 = series, arg3 = series
* arg1 = column vector, arg3 = column vector
Implementing the remaining cross-cases (general matrix or list for
arg1; mixed data types between arg1 and arg3) would be nice, but
would involve a good deal of painful tedium (particularly with
regard to proper error checking), so not done yet.
No big deal IMO, as long as arg1 can be multiple (eg islist(arg1) ->
arg3 is series and ismatrix(arg1) -> arg3 is vector).
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti