# Randomized Control of Time Series Data

I am trying to randomize the order of a time series data set. I generated my data as:

    ts5 = RandomFunction[FractionalBrownianMotionProcess[.5], {0, 999, 1}]


Now I need to create a randomized control of this data: essentially, I need to treat the y and t values as their own lists and only randomize the y values while keeping the t values in the same order (0-999).

However, I have not found a way to separate the data, and the built in random functions are unable to preform this task (or so says my Google Fu).

Any help would be much appreciated.

• Welcome! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
– user9660
Commented May 13, 2016 at 16:45
• Your ts5 data is wrapped in a TemporalData object. You can use First@ts5["Paths"] to get a {{t0, y0}, {t1, y1}...} regular list of pairs. Commented May 13, 2016 at 16:50
• Thank you @MarcoB! I will update my post with my new attempt. Commented May 13, 2016 at 16:59

Extract the path from the TemporalData object, then isolate the $y$ values and produce a random permutation using RandomSample; finally add back the $t$ values:

ts5List = First@ts5["Paths"];
scrambled = Transpose@{ts5List[[All, 1]], RandomSample[ts5List[[All, 2]], Length[ts5List]]}

ListPlot[scrambled]


• This is exactly what I needed. Commented May 13, 2016 at 17:07
• @FoxForceFive glad to be of help! Commented May 13, 2016 at 18:10

Working from what @MarcoB suggested, I came up with:

    ts5randomized = RandomSample[ts5["Values"]];
ts5randomizeSeries = TimeSeries[ts5randomized, {0, 999, 1}]
ListLinePlot[ts5randomizeSeries]


This appears to be what I needed. Thanks again @MarcoB!