[R] using acf() for multiple columns

rcoder mpdotbook at gmail.com
Wed Aug 6 22:12:35 CEST 2008


Hi everyone,

I'm trying to use the acf() function to calculate the autocorrelation of
each column in a matrix. The trouble is that I can only seem to get the
function to work if I extract the data in the column into a separate matrix
and then apply the acf() function to this column.

I have something like this: acf(mat,lag.max=10,na.action=na.pass)

...but I would really like to apply the function to 'mat' where 'mat' is a
matrix as opposed to a vector. The function actually doesn't return an acf
coefficient, but instead plots the data. So, in addition to handling
matrices with multiple columns, would anyone know how to coerce the function
to output the underlying data?

Finally, when working with a matrix, is there a way I can specify how many
plots I can display after the function executes? I managed to generate a
multiple plot when I was experimenting, but the titles suggested the acf was
calculated between adjacent columns in the matrix, which is something I was
puzzled about.

Thanks,

rcoder
-- 
View this message in context: http://www.nabble.com/using-acf%28%29-for-multiple-columns-tp18858672p18858672.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list