WeightedData[{x1,x2,…},{w1,w2,…}]
重み wiの観測 xiを表す.
WeightedData[{x1,x2,…},fn]
重み関数 fn で観測 xiを表す.
WeightedData
WeightedData[{x1,x2,…},{w1,w2,…}]
重み wiの観測 xiを表す.
WeightedData[{x1,x2,…},fn]
重み関数 fn で観測 xiを表す.
詳細
- WeightedDataはデータを各データ点についての重みで増強する.
- データ{x1,x2,…}と重み{w1,w2,…}は同じ長さのリストでなければならない.
- 重み関数 fn はリスト{x1,x2,…}に適用され重み{w1,w2,…}の明示的なリストを返す.
- WeightedDataは以下を含む統計関数に使うことができる.
-
Mean,Variance,… 記述統計関数 EmpiricalDistribution,… ノンパラメトリック分布推定 EstimatedDistribution,… パラメトリック分布推定 - WeightedData[{x1,x2,…}]は重みが等しいデータを与える.
- WeightedDataの特性はWeightedData[…]["property"]を指定して求めることができる.
- 使用可能な特性のリストはWeightedData[…]["Properties"]を使って求めることができる.
- WeightedDataの特性
-
"EmpiricalPDF" データ値と推定される重み "InputData" 加重されていない入力データの値 "MetaDataRules" メタ情報の規則を含むリスト "Weights" データの重みを含むリスト
例題
すべて開く すべて閉じる例 (1)
data = {8, 3, 5, 4, 9, 0, 4, 2, 2, 3};
w = {0.15, 0.09, 0.12, 0.10, 0.16, 0., 0.11, 0.08, 0.08, 0.09};𝒜 = WeightedData[data, w]加重平均(Mean)と加重標準偏差(StandardDeviation)を計算する:
Mean[𝒜]StandardDeviation[𝒜]スコープ (10)
data = {8, 3, 5, 4, 9, 0, 4, 2, 2, 3};
w = {0.15, 0.09, 0.12, 0.10, 0.16, 0., 0.11, 0.08, 0.08, 0.09};𝒜 = WeightedData[data, w];Table[{i, i[𝒜]}, {i, {Mean, Median, Variance, StandardDeviation, Kurtosis, Skewness, InterquartileRange}}]//Gridx = {{1, 2}, {4, 5}, {5, 6}, {7, 3}};
w = {.5, .25, .1, 1};𝒜 = WeightedData[x, w]Mean[𝒜]Covariance[𝒜]Correlation[𝒜]x = RandomInteger[{1, 25}, 5000];𝒜 = Table[WeightedData[x, Function@@{t, t^i}], {i, Range[0, 4]}];N[Mean /@ 𝒜]N[Variance /@ 𝒜]Plot[Evaluate@Table[PDF[SmoothKernelDistribution[w], a], {w, 𝒜}], {a, -3, 30}, PlotRange -> All, PlotLegends -> Map[Row[{"t --> ", #}]&, t ^ Range[0, 4]]]data = RandomVariate[NormalDistribution[0, 1], 50];
w = data ^ 2;𝒜 = WeightedData[data, w]dists = Table[𝒟[𝒜], {𝒟, {EmpiricalDistribution, HistogramDistribution, SmoothKernelDistribution}}];Table[Plot[CDF[i, x], {x, -3, 3}, PlotLabel -> Row[{"Mean: ", Mean[i]}], Exclusions -> None], {i, dists}]data = RandomReal[{0, 100}, 1000];
w = PDF[ExponentialDistribution[1 / 20], #]&;𝒜 = WeightedData[data, w]𝒟1 = EstimatedDistribution[𝒜, ExponentialDistribution[a]]𝒟2 = EmpiricalDistribution[𝒜];Plot[{CDF[𝒟1, x], CDF[𝒟2, x]}, {x, 0, 50}, Exclusions -> None, PlotStyle -> {Thick, Automatic}, PlotLegends -> {"𝒟1", "𝒟2"}]WeightedDataオブジェクトから入力データを抽出する:
𝒜 = WeightedData[Automatic, {{4.3424867371049345, 84.95915906432668, 54.62083275189872,
60.351715598529864, 74.13571604649297, 60.94262726482822, 66.51118636065769, 64.48764263803247,
71.21344855673459, 82.3471338515244, 99.98746459746363, 17.1 ... 584268284, 0.004700837378501972,
0.008097966826215594, 0.0027249292830005016, 0.029142913216900736, 0.005685347349364164,
0.02694522380487357, 0.013049595682933283, 0.0005752644284236291, 0.0013256312483065082,
0.0004190555990108067}}];d = 𝒜["InputData"];𝒟1 = HistogramDistribution[d];𝒟2 = HistogramDistribution[𝒜];Table[Plot[PDF[𝒟, x], {x, 0, 100}, Filling -> Axis, Exclusions -> None, PlotRange -> {0, .04}], {𝒟, {𝒟1, 𝒟2}}]WeightedDataオブジェクトから重みを得る:
𝒜 = WeightedData[Automatic, {{4.3424867371049345, 84.95915906432668, 54.62083275189872,
60.351715598529864, 74.13571604649297, 60.94262726482822, 66.51118636065769, 64.48764263803247,
71.21344855673459, 82.3471338515244, 99.98746459746363, 17.1 ... 584268284, 0.004700837378501972,
0.008097966826215594, 0.0027249292830005016, 0.029142913216900736, 0.005685347349364164,
0.02694522380487357, 0.013049595682933283, 0.0005752644284236291, 0.0013256312483065082,
0.0004190555990108067}}];w = 𝒜["Weights"];ListLinePlot[Sort@Transpose[{𝒜["InputData"], w}]]経験的PDFから加重平均を計算する:
𝒜 = WeightedData[Automatic, {{4.3424867371049345, 84.95915906432668, 54.62083275189872,
60.351715598529864, 74.13571604649297, 60.94262726482822, 66.51118636065769, 64.48764263803247,
71.21344855673459, 82.3471338515244, 99.98746459746363, 17.1 ... 584268284, 0.004700837378501972,
0.008097966826215594, 0.0027249292830005016, 0.029142913216900736, 0.005685347349364164,
0.02694522380487357, 0.013049595682933283, 0.0005752644284236291, 0.0013256312483065082,
0.0004190555990108067}}];{d, pdf} = 𝒜["EmpiricalPDF"];d.pdf加重平均はMeanを使って直接計算することもできる:
Mean[𝒜]等間隔TimeSeriesの加重平均を求める:
ts = TimeSeries[Table[{t, 2t + RandomVariate[NormalDistribution[0, 0.3]]}, {t, {0., 0.15, 0.2, 0.5, 0.75, 1., 1.5, 2}}]]wm = Mean[WeightedData[ts]]vm = Mean[ts]ListLinePlot[ts, Frame -> True, PlotMarkers -> {Automatic, Tiny},
GridLines -> {None, {{vm, Dashed}, {wm, Dotted}}},
FrameTicks -> {{Automatic, {{vm, " value mean"}, {wm, " weighted mean"}}}, {Automatic, Automatic}}]data = Quantity[{7, 3, 5, 4, 9, 0, 4, 2, 2, 3}, "Meters"];
w = {0.12, 0.09, 0.12, 0.10, 0.16, 0., 0.11, 0.08, 0.08, 0.09};𝒜 = WeightedData[data, w];Table[{i, i[𝒜]}, {i, {Mean, Median, Variance, StandardDeviation, Kurtosis, Skewness, InterquartileRange}}]//TableFormアプリケーション (2)
data = RandomReal[{-5, 5}, 10 ^ 4];𝒜 = WeightedData[data, PDF[NormalDistribution[], #]&];𝒟 = HistogramDistribution[𝒜, 50];m = Mean[𝒜];
sd = StandardDeviation[𝒜];
Plot[PDF[𝒟, x], {x, -4, 4}, Exclusions -> None, Filling -> Axis, Epilog -> Inset[TableForm[{{"Mean:", m}, {"SD:", sd}}], {Right, Top}, {Right, Top}]]BlockRandom[SeedRandom[40];
data = RandomVariate[WeibullDistribution[2.3, 0.8], 30]];mleP = {α, β} /. FindDistributionParameters[data, WeibullDistribution[α, β]]重み付き分数ランダムブートストラップを適用し,単位母数のあるDirichletDistributionからサンプルを取った重みで重み付き推定を繰り返すことで信頼区間を推定する:
weightSample[n_Integer] := RandomVariate[DirichletDistribution[ConstantArray[1, n + 1]]]frwData[data_] := WeightedData[data, weightSample[Length[data]]]frwPs = Table[{α, β} /. FindDistributionParameters[frwData[data], WeibullDistribution[α, β]], 1000];ListPlot[frwPs, Epilog -> {Directive[PointSize[Large], Orange], Point[mleP]}]EstimatedDistribution[frwPs, BinormalDistribution[{αμ, βm}, {αv, βv}, ρ]]特性と関係 (3)
等しい重みのWeightedData:
data = {8, 3, 5, 4, 9, 0, 4, 2, 2, 3};
wd = WeightedData[data]EmpiricalDistribution[data] === EmpiricalDistribution[wd]記述統計はもとになるEmpiricalDistributionに基づいている:
𝒜 = WeightedData[{{-30, -30}, {10, 10}, {20, 20}}, {1, 7, 2}];𝒟 = EmpiricalDistribution[𝒜];{Mean[𝒜], Mean[𝒟]}{Variance[𝒜], Variance[𝒟]}WeightedDataはTimeSeriesオブジェクトに使うことができる:
ts = TimeSeries[vals = {x1, x2, x3, x4}, {times = {0, 1 / 3, 1 / 2, 1}}];
wm = Mean[WeightedData[ts]]weights = MovingAverage[ArrayPad[Differences[times], {1, 1}, "Fixed"], 2]Normalize[weights, Total].valsevals = ArrayPad[vals, {1, 1}, "Fixed"]etimes = ArrayPad[times, {1, 1}, "ReflectedDifferences"]if = Interpolation[Transpose[{etimes, evals}], InterpolationOrder -> 1];{tmin, tmax} = {Mean[Take[etimes, 2]], Mean[Take[etimes, -2]]}(1/tmax - tmin)Integrate[if[t], {t, tmin, tmax}]//Expand関連するガイド
-
▪
- 記述統計 ▪
- ノンパラメトリック統計分布
テキスト
Wolfram Research (2012), WeightedData, Wolfram言語関数, https://reference.wolfram.com/language/ref/WeightedData.html.
CMS
Wolfram Language. 2012. "WeightedData." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/WeightedData.html.
APA
Wolfram Language. (2012). WeightedData. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WeightedData.html
BibTeX
@misc{reference.wolfram_2026_weighteddata, author="Wolfram Research", title="{WeightedData}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/WeightedData.html}", note=[Accessed: 16-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_weighteddata, organization={Wolfram Research}, title={WeightedData}, year={2012}, url={https://reference.wolfram.com/language/ref/WeightedData.html}, note=[Accessed: 16-November-2026]}