BaringhausHenzeTest[data]
用 Baringhaus–Henze 检验来检验数据是否遵循 MultinormalDistribution.
BaringhausHenzeTest[data,MultinormalDistribution[μ,Σ]]
检验数据是否遵循平均向量为 μ 、协方差矩阵为 Σ 的分布.
BaringhausHenzeTest[data,"property"]
返回 "property" 的值.
BaringhausHenzeTest
BaringhausHenzeTest[data]
用 Baringhaus–Henze 检验来检验数据是否遵循 MultinormalDistribution.
BaringhausHenzeTest[data,MultinormalDistribution[μ,Σ]]
检验数据是否遵循平均向量为 μ 、协方差矩阵为 Σ 的分布.
BaringhausHenzeTest[data,"property"]
返回 "property" 的值.
更多信息和选项
- BaringhausHenzeTest 执行一个拟合优度检验, 零假设
下从 MultinormalDistribution 中提取 data ,而备择假设
下则不是. - BaringhausHenzeTest 也叫做 Baringhaus–Henze–Epps–Pulley 多变量正态性检验或者 BHEP 检验.
- 默认情况下,一个概率值或
-值被返回. - 一个小的
-值意味着 data 不大可能来自一个多变量正态分布. - data 可以是单变量 {x1,…,xn} 或多变量 {{x1,y1,…},…,{xn,yn,…}}.
- Baringhaus–Henze 检验实际上使用基于去相关标准化 data 的经验特征函数和标准的多变量高斯特征函数 Tβ=Expectation[n Abs[Ψemp[t]-Ψst[t]]2,{t1,…,td}] 之间的
距离的检验统计量 Tβ ,其中 =ProductDistribution[{NormalDistribution[0,β],d}]. » - 参数 β 为正且决定了经验分布的平滑性. 它是自动确定的,但是可以使用 Method 设置来更改.
- BaringhausHenzeTest[data,MultinormalDistribution[μ,Σ],"HypothesisTestData"] 返回一个可以通过 htd["property"] 形式提取额外检验结果及属性的 HypothesisTestData 对象 htd .
- BaringhausHenzeTest[data,MultinormalDistribution[μ,Σ],"property"] 可用于直接给出 "property" 的值.
- 与报告检验结果相关的属性包括:
-
"PValue"
-值"PValueTable" "PValue" 的格式化形式 "ShortTestConclusion" 检验结果的简短说明 "TestConclusion" 检验结果的说明 "TestData" 检验统计量和
-值"TestDataTable" "TestData" 的格式化形式 "TestStatistic" 检验统计量 "TestStatisticTable" 格式化的"TestStatistic" - 下列属性与执行哪种检验无关.
- 与数据分布相关的属性包括:
-
"FittedDistribution" 数据的拟合分布 "FittedDistributionParameters" 数据的分布参数 - 可以给出下列选项:
-
Method Automatic 用于计算
-值的方法SignificanceLevel 0.05 进行诊断并报告的临界值 - 对于一个拟合优度检验,选择临界值
使得只在
的情况下拒绝
. 用于 "TestConclusion" 和 "ShortTestConclusion" 属性的
值由 SignificanceLevel 选项来控制. 默认情况下
被设为 0.05. » - 通过设置 Method->"MonteCarlo",在
下使用拟合分布生成一些长度相同的数据集作为输入
. 然后用 BaringhausHenzeTest[si,"TestStatistic"] 中的 EmpiricalDistribution 来估计
-值. » - 设置 Method{method,"SmoothingParameter"β} 允许自定义平滑参数 β. 默认情况下,
,这种情况下的检验亦被称作 Henze-Zirkler 检验. »
范例
打开所有单元 关闭所有单元基本范例 (3)
data = RandomVariate[BinormalDistribution[1 / 2], 1000];BaringhausHenzeTest[data]从 Baringhaus–Henze 检验中提取检验统计量:
data = RandomVariate[MultinormalDistribution[{1, 2, 3}, {{2, 1, 0}, {1, 3, -1}, {0, -1, 1}}], 1000];BaringhausHenzeTest[data, "TestStatistic"]data = RandomVariate[ProductDistribution[BinormalDistribution[2 / 3], BinormalDistribution[-1 / 2]], 1000];BaringhausHenzeTest[data, "TestDataTable"]范围 (6)
检验 (3)
执行一个单变量正态性 Baringhaus–Henze 检验:
data1 = RandomVariate[NormalDistribution[], 1000];
data2 = RandomVariate[StudentTDistribution[4], 1000];BaringhausHenzeTest[data1]BaringhausHenzeTest[data2]执行一个多变量正态性 Baringhaus–Henze 检验:
data1 = RandomVariate[MultinormalDistribution[{0, 0, 0}, {{3, 2, 1}, {2, 4, 0}, {1, 0, 2}}], 1000];
data2 = RandomVariate[MultivariateTDistribution[{{3, 2, 1}, {2, 4, 0}, {1, 0, 2}}, 6], 1000];BaringhausHenzeTest[data1]BaringhausHenzeTest[data2]为重复提取属性创建一个 HypothesisTestData 对象:
data = RandomVariate[BinormalDistribution[-0.5], 10^3];ℋ = BaringhausHenzeTest[data, "HypothesisTestData"]ℋ["Properties"]报告 (3)
data = RandomVariate[BinormalDistribution[.5], 10^3];ℋ = BaringhausHenzeTest[data, "HypothesisTestData"];ℋ["TestDataTable"]ℋ["PValueTable"]ℋ["TestStatisticTable"]为定制报告从 Baringhaus–Henze 检验表中找出相应条目:
data1 = RandomVariate[BinormalDistribution[.5], 10^3];
data2 = RandomVariate[BinormalDistribution[.5], 10^3];ℋ1 = BaringhausHenzeTest[data1, "TestData"]ℋ2 = BaringhausHenzeTest[data2, "TestData"]BarChart[{Labeled[ℋ1, "Set 1"], Labeled[ℋ2, "Set 2"]}, ChartLabels -> {"Statistic", "p‐value"}]使用 "ShortTestConclusion" 和 "TestConclusion" 报告检验结论:
data = BlockRandom[SeedRandom[1];RandomVariate[StudentTDistribution[4], {100, 2}]];ℋ = BaringhausHenzeTest[data, "HypothesisTestData"];ℋ["ShortTestConclusion"]ℋ["TestConclusion"]//TraditionalFormℋ = BaringhausHenzeTest[data, "HypothesisTestData", SignificanceLevel -> .001];ℋ["ShortTestConclusion"]ℋ["TestConclusion"]//TraditionalForm选项 (3)
Method (2)
设置用于 Baringhaus–Henze 检验的平滑参数 β:
BlockRandom[SeedRandom["fixed"];data = RandomVariate[BinormalDistribution[2 / 3], 1000];]pvls = Table[{beta, BaringhausHenzeTest[data, Method -> {Automatic, "SmoothingParameter" -> beta}]}, {beta, {0.05, 0.1, 0.25, 0.5, 1, 1.5, 2, 3, 5}}];ListLinePlot[pvls, FrameLabel -> {"β", "P-Value"}, Frame -> True, AxesOrigin -> {0, 0}, PlotRange -> All]data = RandomVariate[BinormalDistribution[.5], 1000];pts = Table[{i, BaringhausHenzeTest[data, Method -> {"MonteCarlo", "RandomSeed" -> i, "MonteCarloSamples" -> 100}]}, {i, Range[1, 10]}];Show[ListLinePlot[pts, PlotRange -> {Min[pts[[All, 2]]], Max[pts[[All, 2]]]}, FrameLabel -> {"Seed", "P-Value"}, Frame -> True, AxesOrigin -> {0, 0}]]BaringhausHenzeTest[data, Method -> {"MonteCarlo", "MonteCarloSamples" -> 100, "SmoothingParameter" -> 0.25}]BaringhausHenzeTest[data, Method -> {Automatic, "SmoothingParameter" -> 0.25}]SignificanceLevel (1)
设置用于 "TestConclusion" 和 "ShortTestConclusion" 的显著性水平:
data = BlockRandom[SeedRandom[2];RandomVariate[StudentTDistribution[5], {100, 2}]];BaringhausHenzeTest[data, "ShortTestConclusion", SignificanceLevel -> .1]BaringhausHenzeTest[data, "ShortTestConclusion", SignificanceLevel -> .25]BaringhausHenzeTest[data, "TestConclusion"]//TraditionalForm应用 (4)
Baringhaus–Henze 检验的功效曲线(当
为假是将其拒绝的机率):
data = Table[RandomVariate[MultivariateTDistribution[IdentityMatrix[2], 3], {1000, i}], {i, n = Range[10, 50, 5]}];ℋ = Map[BaringhausHenzeTest, data, {2}];pC = Interpolation[Transpose[{n, Table[Probability[x ≤ 0.05, xi], {i, ℋ}]}], InterpolationOrder -> 1];Plot[pC[x], {x, 10, 50}, PlotRange -> {0, 1}, Ticks -> {n, Automatic}, AxesOrigin -> {7, 0}, AxesLabel -> {"Sample Size", "Power"}]当分布为MultivariateTDistribution、检验水平是 0.05 且样本量是43时估计 Baringhaus–Henze 检验的功效:
pC[43.]proc1 = RandomFunction[FractionalBrownianMotionProcess[0.1, 1., 0.6], {10, 15, 0.1}, 300];BaringhausHenzeTest[proc1["ValueList"]]proc2 = RandomFunction[GeometricBrownianMotionProcess[0.1, 0.6, 1.], {10, 15, 0.1}, 300];BaringhausHenzeTest[Differences /@ Log[proc2["ValueList"]]]proc3 = RandomFunction[CoxIngersollRossProcess[0.1, 0.6, 0.1, 1.], {10, 15, 0.1}, 300];BaringhausHenzeTest[Differences /@ Log[proc3["ValueList"]]]病人在接受某种疗法前后的体重被记录下来. 如果数据遵循多变量正态分布,那么均值的多变量检验可用作区别对照组和实验组的检验:
data = ExampleData[{"Statistics", "AnorexiaTreatment"}];ExampleData[{"Statistics", "AnorexiaTreatment"}, "ColumnDescriptions"]groups = data[[All, 1]];用 BaringhausHenzeTest 确定这三组数据是否为多变量正态分布:
BaringhausHenzeTest[g1 = Pick[data[[All, 2 ;; ]], groups, "Cont"], "ShortTestConclusion"]BaringhausHenzeTest[g2 = Pick[data[[All, 2 ;; ]], groups, "CBT"], "ShortTestConclusion"]BaringhausHenzeTest[g3 = Pick[data[[All, 2 ;; ]], groups, "FT"], "ShortTestConclusion"]Cont 和 FT 组中的数据没有被 Baringhaus–Henze 检验拒绝. 使用 TTest 检验这两组的均值是否相同:
TTest[{g1, g3}, 0, "TestDataTable"]bhep[rho_Real] := BlockRandom[SeedRandom["example"];BaringhausHenzeTest[RandomVariate[BinormalDistribution[rho], 250], ProductDistribution[{NormalDistribution[], 2}]]]LogPlot[bhep[rho], {rho, -0.5, 0.5}, PlotRange -> {0.001, 1}]属性和关系 (5)
如果应用于数据的线性变换是非奇异的,则 Baringhaus–Henze 检验是仿射不变的:
data1 = RandomVariate[NormalDistribution[], {1000, 3}];data2 = AffineTransform[{ToeplitzMatrix[3], RandomReal[1, 3]}][data1];Grid[Join[{{"BaringhausHenze Test", "statistic", "p-value"}}, MapThread[Prepend, {{BaringhausHenzeTest[data1, "TestData"], BaringhausHenzeTest[data2, "TestData"]}, {"data1", "data2"}}]], Frame -> All]Grid[Join[{{"Mardia Combined Test", "statistic", "p-value"}}, MapThread[Prepend, {{MardiaKurtosisTest[data1, "TestData"], MardiaKurtosisTest[data2, "TestData"]}, {"data1", "data2"}}]], Frame -> All]在
下检验统计量渐近地遵循 LogNormalDistribution:
SeedRandom[10];
n = 25;
t = Table[BaringhausHenzeTest[RandomVariate[
MultinormalDistribution[{0, 1}, ToeplitzMatrix[{2, 1}]], n], "TestStatistic"], {10 ^ 3}];查看检验统计量是否遵循 LogNormalDistribution 族中的某个分布:
DistributionFitTest[t, LogNormalDistribution[mu, sig], "ShortTestConclusion"]pdf = PDF[EstimatedDistribution[t, LogNormalDistribution[mu, sig]]]Show[Histogram[t, {0.05}, "PDF"], Plot[pdf[x], {x, 0, 2}]]BaringhausHenzeTest 统计量是基于样本经验特征函数和零假设下的特征函数之间的距离的:
data = RandomVariate[NormalDistribution[], {100, 2}];StandardizeAndDecorrelate[data_] := With[{c = Transpose[Subtract[Transpose[data], Mean[data]]]},
c.Inverse[CholeskyDecomposition[Mean[Outer[Times, #, #]& /@ c]]]]cf[{t1_, t2_}] = CharacteristicFunction[EmpiricalDistribution[StandardizeAndDecorrelate[data]], {t1, t2}];d[{t1_Real, t2_Real}] := Length[data]Abs[cf[{t1, t2}] - Exp[-(t1 ^ 2 + t2 ^ 2) / 2]] ^ 2NExpectation[d[{t1, t2}], {t1NormalDistribution[0, 2], t2NormalDistribution[0, 2]}]与 BaringhausHenzeTest 报告的检验统计量相比:
BaringhausHenzeTest[data, "TestStatistic", Method -> {Automatic, "SmoothingParameter" -> 2}]对具有退化样本协方差函数的样本, 检验统计量给出其最大值 4 n:
htd = BaringhausHenzeTest[ConstantArray[0, {3, 2}], "HypothesisTestData"];htd["TestStatistic"]htd["PValue"]当平滑参数 β 取较小的值时, Baringhaus–Henze 检验对尾的特性更敏感:
data = RandomVariate[MultivariateTDistribution[IdentityMatrix[3], 4], {2000, 50}];bhepP[beta_Real] := BaringhausHenzeTest[#, Method -> {Automatic, "SmoothingParameter" -> beta}]& /@ dataTable[{beta, NProbability[x < 0.05, xbhepP[beta]]}, {beta, {0.05, 0.1, 0.5, 1.0, 5.0}}]Table[NProbability[x < 0.05, xtest /@ data], {test, {MardiaCombinedTest, MardiaSkewnessTest, MardiaKurtosisTest}}]巧妙范例 (1)
bv𝒟 = TransformedDistribution[{X, (2Z - 1) X}, {XNormalDistribution[], ZBernoulliDistribution[2 / 3]}];CharacteristicFunction[MarginalDistribution[bv𝒟, 1], t] == CharacteristicFunction[MarginalDistribution[bv𝒟, 2], t] == CharacteristicFunction[NormalDistribution[], t]data = RandomVariate[bv𝒟, 1000];GraphicsRow[Show[Histogram[#, {0.2}, "PDF"], Plot[PDF[NormalDistribution[], x], {x, -3, 3}]]& /@ Transpose[data], ImageSize -> 400]BaringhausHenzeTest[data]ListPlot[data, AspectRatio -> 1, AxesLabel -> {"SubscriptBox[X, 1]", "SubscriptBox[X, 2]"}]相关指南
-
▪
- 假设检验
文本
Wolfram Research (2015),BaringhausHenzeTest,Wolfram 语言函数,https://reference.wolfram.com/language/ref/BaringhausHenzeTest.html.
CMS
Wolfram 语言. 2015. "BaringhausHenzeTest." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/BaringhausHenzeTest.html.
APA
Wolfram 语言. (2015). BaringhausHenzeTest. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/BaringhausHenzeTest.html 年
BibTeX
@misc{reference.wolfram_2026_baringhaushenzetest, author="Wolfram Research", title="{BaringhausHenzeTest}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/BaringhausHenzeTest.html}", note=[Accessed: 14-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_baringhaushenzetest, organization={Wolfram Research}, title={BaringhausHenzeTest}, year={2015}, url={https://reference.wolfram.com/language/ref/BaringhausHenzeTest.html}, note=[Accessed: 14-August-2026]}