Marcin B. has been in touch with me about providing an accessor or
function such that you could retrieve ACF/PACF values for further
analysis, and I thought I'd bring this issue to the list.
Marcin originally requested an accessor, $corrgm, and I replied by
suggesting a function, acf(y, p) [y = series, p = max lag] which
would return a column vector. The correspondence then continued
as below. Comments welcome.
On Sun, 25 Jan 2009, Marcin B�^Bażejowski wrote:
I was rather thinking about pacf() function (as a tool for
determining order of autoregressive of given proces) and my
thoughts was like thist (but it's only suggestion):
$corrgm(m,n), where "m" is a order of function and "n" is a
value of function (acf, pacf and so on).
In gretl's syntax, $foo is used strictly as an accessor for a
previously calculated result. So my thinking is that $corrgm
would have to retrieve the result from a previous "corrgm" command
(presumably, in the form of a vector of values).
This could work, but my alternative thought was to provide a
function acf() -- or corrgm(), the name doesn't matter much --
that works in a "stand-alone" manner to provide an acf vector.
This seemed a little more "natural" to me than using an accessor.
Now I take your point that one might also want the partial
autocorrelations, or for that matter the cross-correlogram of two
variables. We could do this by providing three functions, e.g.,
xcf(x, y, p)
where x and y are series and p is the maximum lag. It would be
possible to combine acf and pacf into one function by using a
third boolean parameter to distinguish the cases -- or, I suppose,
we could have a corrgm() function with returns a p x 2 matrix with
the ACF in column 1 and the PACF in column 2. I'm not sure which
of these options is best.