# Ensemble averaging with non-identical (time) stamps

I have data which could be interpreted as time series, but with non-identical time stamps. Their format is:

xVal = {{x1,x2,x3}, {x4,x5,x6}, ...}
yVal = {{y1,y2,y3}, {y4,y5,y6}, ...}


where x1 and x4 (and all the other indexes of x values) may not coincide. Then I plot all this lists in yVal in dependence on xVal like this

 ListPlot[
Table[Table[{xValues[[i, j]], yValues[[i, j]]}, {j,
Length[xValues[[i]]]}], {i, Length[xValues]}],
AxesLabel -> {"x", "y"},
PlotLabel -> "Plot of two lists against each other"]


The question is: Can I create ensemble average of these datasets and plot it?

After a few hours of trying I came to the next solution:

1. To flatten data
   flattenedXValues = Flatten[x, 1];

flattenedYValues = Flatten[y, 1];

1. Function which does what I want
  TimeRegression[x_, y_, n_] := Module[{xPoints, yVals = {}},
minX = Min[x];
maxX = Max[x];
xinter =
Table[N[{minX + (i - 1)*(maxX - minX)/n,
minX + i*(maxX - minX)/n}], {i, Range[1, n]}];
For[i = 1, i <= Length[xinter], i++,
indexes =
Flatten@Position[
x, _?(IntervalMemberQ[Interval[xinter[[i]]], #] &)];
yMean = If[Length[indexes] > 0, Mean[y[[indexes]]], Null];
yStd =
If[Length[y[[indexes]]] < 2, Null,
StandardDeviation[y[[indexes]]]];
AppendTo[yVals, Around[yMean, yStd]];
];
xPoints =
Around, {Mean /@ xinter,
ConstantArray[(maxX - minX)/n, Length[xinter]]}];
{xPoints, yVals}
]

1. After I have something like this:

Is there a way maybe to do it easier?

Do you mean something like this?

xVal = {{x1, x2, x3}, {x4, x5, x6}};
yVal = {{y1, y2, y3}, {y4, y5, y6}};

Transpose[{Mean /@ xVal, Mean /@ yVal}]


{{1/3 (x1 + x2 + x3), 1/3 (y1 + y2 + y3)}, {1/3 (x4 + x5 + x6), 1/3 (y4 + y5 + y6)}}

• No, not exactly. I posted below, what exactly I wanted. Commented Mar 4 at 10:09