TimeSeriesThread[f,{tes1,tes2,…}]
関数 f を用いて時系列または事象系列のデータ tesiを組み合せる.
TimeSeriesThread
TimeSeriesThread[f,{tes1,tes2,…}]
関数 f を用いて時系列または事象系列のデータ tesiを組み合せる.
詳細とオプション
- TimeSeriesThreadは,一般に,複数の時系列または事象系列の値を組み合せるために使われる.
- 以下は,時系列または事象系列のデータ tesiの可能な形式である.
-
TimeSeries[…] 連続時間の順序付きサンプルデータ EventSeries[…] 値を伴う時間的事象の集合 TemporalData[…] 時点と値のペアから構成される1つ以上のパス {{t1,x1},{t2,x2},…} 時点と値のペアのリスト - 集合{tes1,tes2,…}は,TemporalData[{tes1,tes2,…}]としても同様に与えることができる.
- 成分を持つ時系列に対しては,関数 f で tesi の成分"com"を使用するために#[[i,"com"]]を用いる. »
- tesiに対する時点が等しくない場合は,すべての時点の和集合を使って各 tesiがリサンプリングされる. »
- TimeSeriesThreadのオプション
-
ResamplingMethod Automatic 経路のリサンプリングに使用するメソッド - すべての tesiが同数のパスを含む必要がある.複数のパスの場合,TimeSeriesThreadはパスごとに縫い込まれる.
例題
すべて開く すべて閉じる例 (4)
ts1 = TimeSeries[{Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], Subscript[x, 4], Subscript[x, 5]}, {1}];
ts2 = TimeSeries[{Subscript[y, 1], Subscript[y, 2], Subscript[y, 3], Subscript[y, 4], Subscript[y, 5]}, {1}];TimeSeriesThread[Total, {ts1, ts2}]//Normalts1 = TimeSeries[{Subscript[x, 0], Subscript[x, 1], Subscript[x, 3]}, {{0, 1, 3}}];
ts2 = TimeSeries[{Subscript[y, 1], Subscript[y, 2], Subscript[y, 3]}, {{1, 2, 3}}];TimeSeriesThread[f, {ts1, ts2}]//Normal//Simplifygoog = FinancialData["GOOGL", {DateObject[{2025}]}];
appl = FinancialData["AAPL", {DateObject[{2025}]}];TimeSeriesThread[Apply[Subtract], {goog, appl}]DateListPlot[%]ts1 = TimeSeries[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3}, {}, None}, "ElementType" -> "Integer64"]],
TabularColumn[Association["Data" -> {{4, 5, 6}, {}, None}, "ElementType" ->
"Integer64"]]}}]]]], {Today}];
ts2 = TimeSeries[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "String"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{11, 21, 31}, {}, None}, "ElementType" ->
"Integer64"]], TabularColumn[Association["Data" -> {{3, {0, 3, 6, 9}, "catfoxdog"}, {},
None}, "ElementType" -> "String"]]}}]]]], {Today}];TimeSeriesThread[#[[1, "b"]] + #[[2, "a"]]&, {ts1, ts2}]//Tabularスコープ (8)
基本的な用法 (4)
合計10のシミュレーションによるBernoulliProcess経路:
td = RandomFunction[BernoulliProcess[1 / 4], {25}, 10];sum = TimeSeriesThread[Total, td];ListPlot[sum, Filling -> Axis]ts = TimeSeries[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3}, {}, None}, "ElementType" -> "Integer64"]],
TabularColumn[Association["Data" -> {{4, 5, 6}, {}, None}, "ElementType" ->
"Integer64"]]}}]]]], {Today}]TimeSeriesThread[Mean @* First, {ts}]//Normaldata = RandomFunction[WienerProcess[], {0, 1, .01}, 10 ^ 3];max = TimeSeriesThread[Max, data];
min = TimeSeriesThread[Min, data];ListLinePlot[{max, min}, PlotLegends -> {"max", "min"}]data = RandomFunction[WienerProcess[], {0, 1, .01}, 500];μ = TimeSeriesThread[Mean, data];
σ = TimeSeriesThread[StandardDeviation, data];conf = TimeSeriesThread[{#[[1]] - 1.95#[[2]], #[[1]] + 1.95#[[2]]}&, {μ, σ}];Show[ListLinePlot[data, PlotStyle -> Opacity[.1]], ListLinePlot[conf, PlotStyle -> StandardGreen]]データの型 (4)
ts1 = {{1, a}, {2, b}, {3, c}};
ts2 = {{1, d}, {2, e}, {3, f}};TimeSeriesThread[Total, {ts1, ts2}]2つのTimeSeriesの差を得る:
ts1 = TimeSeries[{Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], Subscript[x, 4], Subscript[x, 5], Subscript[x, 6]}];
ts2 = TimeSeries[{Subscript[y, 1], Subscript[y, 2], Subscript[y, 3], Subscript[y, 4], Subscript[y, 5], Subscript[y, 6]}];TimeSeriesThread[Subtract@@#&, {ts1, ts2}]["Path"]TemporalDataのさまざまな経路の標準偏差を求める:
data = RandomFunction[WienerProcess[], {0, 1, .001}, 100]ListLinePlot[data, PlotStyle -> Thin]TimeSeriesThread[StandardDeviation, data];ListLinePlot[%]2つのEventSeries間の最大値を求める:
es1 = TemporalData[EventSeries, {{{2, 1, 6, 5, 7, 4}}, {{{1, 2, 5, 10, 12, 15}}}, 1, {"Discrete", 1},
{"Discrete", 1}, 1, {ResamplingMethod -> None}}, False, 10.];es2 = TemporalData[EventSeries, {{{3, 2, 10, 4, 11, 7}}, {{{1, 2, 5, 10, 12, 15}}}, 1, {"Discrete", 1},
{"Discrete", 1}, 1, {ResamplingMethod -> None}}, False, 10.];max = TimeSeriesThread[Max, {es1, es2}];ListPlot[#, Filling -> Axis]& /@ {es1, es2, max}オプション (1)
ResamplingMethod (1)
ts1 = TimeSeries[{1, 3, 5, 7, 9}, {1}];
ts2 = TimeSeries[{2, 3, 4, 5, 6}, {{1, 1.5, 3.5, 4, 5}}];int0 = TimeSeriesThread[Total, {ts1, ts2}, ResamplingMethod -> "Interpolation"];int0//Normalint1 = TimeSeriesThread[Total, {ts1, ts2}, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}];int1//NormalListLinePlot[{int0, int1}, PlotLegends -> {"interpolation order 0", "interpolation order 1"}]アプリケーション (4)
data = RandomFunction[WienerProcess[], {0, 1, .001}, 100];ListLinePlot[data, PlotStyle -> Thin]TimeSeriesThread[Mean, data];ListLinePlot[%]tspec = {0, 3, .01};
jump = RandomFunction[PoissonProcess[3], tspec];
diff = RandomFunction[WienerProcess[1.9, 1], tspec];
data = TimeSeriesThread[Total, {jump, diff}];ListPlot[{data, jump, diff}, PlotStyle -> {Thick, Dashed, Dashed}, PlotLegends -> {"jump-diffusion", "jumps", "diffusion"}]sunpos = SunPosition[DateRange[Today - Quantity[2, "Months"], Today, {12, "Hour"}], CelestialSystem -> "Equatorial"]moonpos = MoonPosition[DateRange[Today - Quantity[2, "Months"], Today, {12, "Hour"}], CelestialSystem -> "Equatorial"]AngularDistance[{ϕ1_, θ1_}, {ϕ2_, θ2_}] := InverseHaversine[Haversine[ϕ1 - ϕ2] + Cos[ϕ1]Cos[ϕ2]Haversine[θ1 - θ2]] / Degreeangdist = TimeSeriesThread[AngularDistance[First[#], Last[#]]&, {sunpos, moonpos}]DateListPlot[angdist]MaleLaborForce = EntityValue[Entity["Country", "France"], EntityProperty["Country", "LaborForce", {"Date" -> All, "Gender" -> "Male"}]];Rates = EntityValue[Entity["Country", "France"], EntityProperty["Country", "UnemploymentRate", {"Date" -> All, "Gender" -> "Male"}]];Rates["Values"]MaleUnemploymentRate = QuantityMagnitude[Rates] / 100;MaleUnemploymentRate["Values"]MaleUnemployment = TimeSeriesThread[Times@@#&, TimeSeriesResample[TemporalData[{MaleLaborForce, MaleUnemploymentRate}], "Intersection"]];DateListPlot[MaleUnemployment, FrameLabel -> Automatic]特性と関係 (3)
EventSeriesとTimeSeriesを縫い込むことができる:
es = EventSeries[{Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], Subscript[x, 4], Subscript[x, 5]}, {1}];
ts = TimeSeries[{Subscript[y, 1], Subscript[y, 2], Subscript[y, 3], Subscript[y, 4], Subscript[y, 5]}, {3}];TimeSeriesThread[f, {es, ts}]TimeSeriesThread[f, {ts, es}]TimeSeriesThreadを単一の時系列上で動作しているTimeSeriesMapと比較する:
ts = TimeSeries[{Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], Subscript[x, 4], Subscript[x, 5]}, {1}];TimeSeriesThread[f, ts]["Path"]TimeSeriesMap[f, ts]["Path"]時系列が整列されている場合,TimeSeriesThreadの値はMapThreadを用いて計算できる:
ts1 = TimeSeries[{Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], Subscript[x, 4], Subscript[x, 5]}, {3}];
ts2 = TimeSeries[{Subscript[y, 1], Subscript[y, 2], Subscript[y, 3], Subscript[y, 4], Subscript[y, 5]}, {3}];TimeSeriesThread[Apply[f], {ts1, ts2}]//Values//NormalMapThread[f, {Values[ts1], Values[ts2]}]考えられる問題 (1)
整列していない事象系列を縫い込むと,結果にMissingが含まれるかもしれない:
es1 = EventSeries[{Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], Subscript[x, 4], Subscript[x, 5]}, {1}];
es2 = EventSeries[{Subscript[y, 1], Subscript[y, 2], Subscript[y, 3], Subscript[y, 4], Subscript[y, 5]}, {3}];TimeSeriesThread[f, {es1, es2}]//NormalMissingをResamplingMethodオプションでどのように置換するかを指定する:
TimeSeriesThread[f, {es1, es2}, ResamplingMethod -> {"Constant", 0}]//Normalおもしろい例題 (1)
dates = DateRange[DateObject[{2014, 1, 1, 12}], DateObject[{2014, 1, 31, 12}], 1];mp = MoonPhase[dates, "Icon"];
sf = MoonPhase[dates, "Fraction"];phases = TimeSeriesThread[#&, {mp, sf}]Labeled[Grid[Partition[Framed[Labeled[ImageResize[First[#2], 45], DateString[#1, {"DayNameShort", " ", "DayShort"}]], Background -> Lighter[ColorData["StarryNightColors", Last[#2]], .3]] & @@@ phases["Path"], 7, 7, 4, ""], Frame -> All, Spacings -> {0, 0}], "January 2014", Top]テキスト
Wolfram Research (2014), TimeSeriesThread, Wolfram言語関数, https://reference.wolfram.com/language/ref/TimeSeriesThread.html (2026年に更新).
CMS
Wolfram Language. 2014. "TimeSeriesThread." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2026. https://reference.wolfram.com/language/ref/TimeSeriesThread.html.
APA
Wolfram Language. (2014). TimeSeriesThread. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TimeSeriesThread.html
BibTeX
@misc{reference.wolfram_2026_timeseriesthread, author="Wolfram Research", title="{TimeSeriesThread}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/TimeSeriesThread.html}", note=[Accessed: 02-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_timeseriesthread, organization={Wolfram Research}, title={TimeSeriesThread}, year={2026}, url={https://reference.wolfram.com/language/ref/TimeSeriesThread.html}, note=[Accessed: 02-September-2026]}