1
$\begingroup$

I am working with four different time series which have the same first and last dates, but a different number of observations. One time series (svq) includes weekend data, the other three don't include weekend data, but seem to be missing a few days each. I can get the Intersection of "Dates" common to all four series and map each index over the common dates to get a matching set of values, but that is perhaps not the best way to get those values. Can someone suggest a better way?

enter image description here

$\endgroup$
4
  • $\begingroup$ Perhaps you could use TimeSeriesResample[{<time series>}, "Intersection"] $\endgroup$
    – user42582
    Commented May 16, 2018 at 19:49
  • $\begingroup$ "doesn't perform as expected is due to poor programming or incomplete understanding of the underlying task" - I get it $\endgroup$ Commented May 16, 2018 at 20:18
  • 1
    $\begingroup$ for the record, I wasn't aware you could do this with TimeSeriesResample until I read this question; that's the reason I like mma.se; it forces you to be honest with what you know and learn the rest $\endgroup$
    – user42582
    Commented May 16, 2018 at 20:40
  • $\begingroup$ I didn't really understand the full capabilities of the function. TimeSeriesResample[ ts , {starttime,endtime,"BusinessDay"} also worked. $\endgroup$ Commented May 17, 2018 at 20:14

1 Answer 1

3
$\begingroup$

Compare and contrast the following example series:

ts1 = TimeSeries[{1, 2, 3, 4}, {{1, 2, 3, 4}}]
ts1 // ListLinePlot[#, Mesh -> Full] &

Blockquote

ts2 = TimeSeries[{5, 4, 3, 2, 1}, {{1, 1.3, 2, 3.5, 4}}];
ts2 // ListLinePlot[#, Mesh -> Full] &

Blockquote

Using

TimeSeriesResample[{ts1, ts2}, "Intersection"] // ListLinePlot[#, Mesh -> Full] &

we obtain the values at common dates:

Blockquote

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.