# Formatting Time-series data for Cross-correlation

In an experiment we measured 100 response times for each subject. The data has the following format:

ID    Trial    ResponseTime    ResponseTime(Z)
1     1            1000             ...
1     2            1200
1     3            1100
.     .               .
.     .               .
.     .               .
2     1             700
2     2             900
2     3             800


In SPSS I would like to compute the cross-correlation between participants' performance for the (z-transformed) time series:

Trial (x)    1    2    3
ID1 (y1)    1000 1200 1100
ID2 (y2)    700   900  800


Upon visual inspection the time-series appear similar but lagged. I wish to use the SPSS cross-correlations command, but need to reformat the data prior to input to allow comparisons across trials between subjects. How should I reformat the data?

Solutions in SPSS, R, or MATLAB are welcome.

SORT CASES BY Trial .