Commit f9511abf authored by Joanne Hugé's avatar Joanne Hugé

Properly compute variance when an offset is added

parent e398ce7c
......@@ -356,11 +356,12 @@ class MeasureSet:
sum_prop = sum(prop)
avg = sum(map(lambda x: abs(x[0] - self.middle)*x[1], enumerate_prop)) / sum_prop
avg_centered = sum(map(lambda x: x[0]*x[1], enumerate_prop)) / sum_prop
var = 0
for x, p in enumerate_prop:
var += p * x**2
var /= sum_prop
var -= (avg + self.middle)**2
var -= avg_centered**2
self.avg.append(avg)
self.var.append(var)
......
......@@ -59,7 +59,7 @@ Min | Max | Avg
Min | Max | Avg | Var
----------- | ---------- | ---------- | ----------
**jitter** | **jitter** | **jitter** | **jitter**
-100.0000us | 186.0000us | 39.1402us | 152.1151us
-100.0000us | 186.0000us | 39.1402us | 252.7494us
![alt text](graphs/packet_jitterjitter.png "packet_jitter Graph")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment