[R] three related time series with different resolutions

William Simpson william.a.simpson at gmail.com
Wed Oct 21 11:34:54 CEST 2009

```PS I think one way to get the average waveforms I want from the
analysis is using cross-correlation, but again the multiple scale
problem is present.

On Wed, Oct 21, 2009 at 9:56 AM, William Simpson
<william.a.simpson at gmail.com> wrote:
> I have three time series, x, y, and z, and I want to analyse the
> relations between them. However, they have vastly different
> resolutions. I am writing to ask for advice on how to handle this
> situation in R.
>
> x is a stimulus, and y and z are responses.
>
> x is a rectangular pulse 4 sec long. Its onset and offset are known
> with sub-millisecond precision. The onset varies irregularly -- it
> doesn't fall on neat 1/2 sec or sec boundaries for example.
>
> y is a sampled continuous waveform. It is highly noisy, and it is
> actually well represented by samples 1/2 sec apart or so.
>
> z is a very short pulse -- perhaps 5 ms long -- occurring at irregular times.
>
> I have problems with how to represent these waveforms at the input
> stage (during data collection) and at the analysis stage. If I want to
> represent x and z with the sort of precision I'd like, I'd have to
> sample every ms or so. But:
> - that is massive overkill for y, because it is noisy. I will have
> maybe 500 times as many pts as I require! That makes for large data
> files, for no good reason.
> - the representations for x and z are about 99% zeros. Again, wasteful
> for storage
> - the analysis will be awkward and slow because of the huge number of pts
>
> If I sample at a rate of every 1/2 sec, z may be not detected at all,
> and the edges of x are represented very poorly.
>
> I could just save y as a separate file, with values sampled every 1/2
> sec, save x as a file containing onset and offset times, and save z as
> the times of each impulse. All three files have different lengths. If
> I save this way it is awkward keeping track of the three files for
> each run, and I'm still left with the problem of analysing them. In my
> mind they are actually three continuous waveforms, and my
> simple-minded way of analysing would be to create digitised waveform
> versions of all three (on some fine grain). If I do that I still have
> the problem of zillions of useless points clogging RAM.
>
> What do I want from the analysis?
> I want the average waveform for y that occurs for 30 sec after each x
> pulse, and the average waveform for z that occurs for 30 sec after
> each x pulse. The average waveform for y surrounding each z (maybe 30
> sec before and 10 sec after) would also be useful.
>
> Thanks very much for any suggestions about representation for data
> collection and analysis, and for data analysis methods (which will
> depend on the data representation).
>
> Bill
>

```