MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Map Correlation[] across sublists of matrices

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112490] Map Correlation[] across sublists of matrices
  • From: Garapata <warsaw95826 at mypacks.net>
  • Date: Fri, 17 Sep 2010 06:41:39 -0400 (EDT)

Hi everyone,

I have a matrix of times series data with the following dimensions:

Dimensions[timeSeriesMatrix]

{281, 5}

I want to partition the data into sliding windows of varying lengths
then find all the correlations of each window as it slides across the
data.  To make this a bit clearer=E2=80=A6

I set up the following list to hold the window lengths:

window = {2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233}

(Nothing important about the Fibonacci ratio, just using it to look at
different chunks of data.  Eventually I'll do it continuously.)

I then partition the data like this:

partitionedData = Partition[timeSeriesMatrix, #, 1] & /@ windows;

This gives me a list of sublists of matrices with the following
dimensions:

Dimensions[#] & /@ partitionedData

{{280, 2, 5}, {279, 3, 5}, {277, 5, 5}, {274, 8, 5}, {269, 13, 5},
{261, 21, 5}, {248, 34, 5}, {227, 55, 5}, {193, 89, 5}, {138, 144, 5},
{49, 233, 5}}

To explain a bit, the first sublist in partitionedData (dimensions
{280, 2, 5}) has 280 matrices each with a 2 data point "window" for 5
time series.  The last matrix has 49 matrices each with 233 data
points for the 5 time series.

Now I need to map Correlation[] across each matrix in each sublist.

The following gets me part of the way there, but I don't think I've
thought about the problem in the right way yet:

Correlation[partitionedData[[#, 1]]] & /@ Range[Length[windows]];
=E2=80=A8Dimensions[%]

{11, 5, 5}

This above only gives me the first matrix in each sublist.  I need
them all.

I think I've missed something simple.  Any suggestions much
appreciated.

Thanks to all in advance.

G

P.S., Once I have this I hope to wrap a manipulate around it with
controls to let me display and examine how the correlations change as
the different windows slide across the original time series data.  So
if anyone has some terrific short cut to do it, let me know.

Again, thanks in advance.

G


  • Prev by Date: Re: Plotting Quartic Solutions in Polar Coordinates
  • Next by Date: Re: Why Row does not format 2 plots in one row when ImageSize->Full?
  • Previous by thread: launching of remote parallel kernels hangs
  • Next by thread: Re: Map Correlation[] across sublists of matrices