什么是具有统计显着性的延迟变化?
考虑这样的情况:我有四个相同的路由器 A、B、C 和 D,运行 busybox 和 ptpd。 A和B通过电缆1连接; C 和 D 通过电缆 2 连接。我在路由器 A 和 C 上有一个小 C 程序,它通过 UDP 向对面路由器发送一个非常小的数据包,我使用 pcap 来检测数据包发送的时间,以及时间它到达另一端,并计算一千个这样的测试的平均值和偏差。
如何判断这些电缆是否不同? 显然,如果一个是500μs,另一个是10ms,它们是不同的。但是,如果一个结果的平均值为 200μs,标准偏差为 8,而另一个结果的平均值为 210μs,标准偏差为 10,该怎么办?它们不同的可能性有多大?我应该做哪些计算来测试这个?而且,从更技术性的角度来说,延迟的预期变化是多少?
我知道任何中间交换机、集线器、路由器等都会增加延迟和可变性,但如果它们通过单根电缆直接连接,正常方差是多少?
编辑:只是为了澄清一点 - 这不仅仅是一个统计问题。我可以使用 t 检验来确定差异的概率(谢谢),但我还想知道有多少差异通常可以归因于网络设备的不同质量。例如,如果两个平均值的平均值为 208.4 和 208.5,我会怀疑无论 t 检验可能会说什么,电缆都是相同的,差异来自于测试机器。还是我错了?电缆是否经常会有微小变化?我不知道 - 延迟之间的正常差异是多少?我需要进行哪些测试来区分电缆和设备的差异? (我无法切换电缆)
Consider the case where I have four identical routers, A, B, C, and D, running busybox and ptpd. A and B are connected by cable 1; C and D are connected by cable 2. I have a small C program on routers A and C that sends a very small packet over UDP to the opposite router, and I use pcap to detect the times that the packet was sent, and the times it arrived at the other end, and calculate the average and deviation for a thousand of these tests.
How do I tell if these cables are different?
Obviously if one is 500μs and the other is 10ms, they're different. But what if the results for one have average 200μs with standard deviation 8, and the results for the other have average 210μs and standard deviation 10. How probable is it that they are different? What calculations should I do to test this? And, on a more technical note, what is the expected variability in latency?
I understand any intermediate switches, hubs, routers etc will add to the latency and the variability of it, but if they are directly connected by a single cable, what is a normal variance?
Edit: Just to clarify a point - this isn't just a statistics question. I can use a t-test to determine probability of difference (thanks), but I'd also like to know how much variance can normally be attributed to different qualities in the network equipment. For example, if the average of the two means are 208.4 and 208.5, I would suspect that whatever the t-test might say, the cables are the same and the difference comes from the test machines. Or am I wrong? Do cables often vary by small amounts? I don't know - What's a normal variance between latencies? What test do I need to distinguish between a difference in the cables, and the equipment? (I can't switch the cables)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先,您需要了解统计假设检验的入门知识。
然后,有多种方法可以回答您的问题,但最经典的方法是考虑观察到的延迟是一个实数变量(我们将其称为时间 T),它具有由每根电缆的行为解释的非随机分量(让我们称这些为 C,代表电缆)和一个您无法解释的随机分量,它可能来自随机波动或您忘记考虑的其他因素(让我们称这些为 E,代表错误)。
然后,您将对电缆 AB 进行一系列观察,您的模型为:
您认为电缆的贡献保持固定,只有随机变量 E1 发生变化。
您还将对电缆 CD 进行一系列观察,您的模型是:
您认为电缆的贡献保持固定,只有随机变量 E2 发生变化。
现在,你已经基本解决了。您将确保消除所有系统影响,因此 E1 和 E2 确实是波动。在这些条件下,您可以假设它们是正态分布(高斯分布)。
使用此模型,您可以使用独立的双样本 t 检验来检查 C1 和 C2 是否与您事先设置的任何置信度不同。
First, you need a primer on statistical hypothesis testing.
Then, there are several ways to answer your question, but the most classical one is to consider that the observed latency is a real variable (let's call those T, for time) which has a non-random component explained by the behaviour of each cable (let's call those C, for cable) and a random component which you cannot explain, which may come from random fluctuations or other things you forgot to take into account (let's call those E, for error).
Then, you will make a series of observations, for cable A-B, and your model is:
Where you believe the contribution of the cable remains fixed and only the random variable E1 is changing.
You will also make a series of observations for cable C-D, and your model is:
Where you believe the contribution of the cable remains fixed and only the random variable E2 is changing.
Now, you are pretty much solved. You'll ensure all systematic influences are eliminated, so E1 and E2 are really fluctuations. Under those conditions, you can assume they are normal (Gaussian).
Using this model you can use the independent two-sample t-test to check if C1 and C2 are different to any confidence you set beforehand.
您想要的是两个样本 t 检验。您无需对您担心的典型方差做出任何假设,它们已内置于测试中。请在此处找到相应的 Wiki 页面。然而,统计上的不同并不一定等同于经济上的不同。您可以确认两个路由器之间的延迟时间确实不同,但差异足够大吗?在不了解更多情况的情况下很难说清楚你的情况,但要小心不要在统计杂草中走得太远。
What you want is a two-sample t-test. You don't need to make any of the assumptions about typical variance that you are worried about, they are built into the test. Please find the appropriate Wiki page here. Statistically different, however, isn't necessarily the same as economically different. You can confirm that the latency times between the two routers are indeed different, but different by enough to matter? Hard to say without knowing more what about your situation, but be wary of getting too far in the statistical weeds.
老实说,我认为统计数据不会对你在这里所做的事情有很大贡献。收集数据的成本基本上为零,并且您可以收集任意大量的数据。通过每条电缆发射几百万/十亿个数据包,然后在两个具有相同比例的直方图上绘制延迟。如果您看不出差异,则可能没有任何意义。
摘要统计数据会破坏信息。无论如何,人们想要使用它们的原因有很多,但我认为它们在这里不会那么有用。如果你想学习统计数据,我当然对此表示赞赏 - 我认为统计素养对于那些希望能够辨别别人何时向他们胡说八道的人来说是一项基本技能。但如果您只是想了解这两条电缆之间的延迟差异,一对精心制作的直方图将提供更多信息。
I honestly don't think statistics will contribute a great deal to what you're doing here. Your cost of collecting a datum is essentially zero, and you can collect arbitrarily huge volumes of it. Fire off a few million/billion packets through each cable and then plot the latencies on two histograms with the same scale. If you can't see a difference, there probably isn't a meaningful one.
Summary statistics destroy information. There are a lot of reasons why one might want to use them anyway, but I don't think they'll be all that useful here. If you want to learn the stats, I certainly applaud that - I think statistical literacy is a fundamental skill for people who want to be able to tell when somebody is feeding them a line of bullshit. But if you just want to understand the differences in latencies between these two cables, a well-done pair of histograms will be vastly more informative.