I have a system that has people going through a sensor for in, a sensor for out.
I'm measuring ins and outs through the day, every day.
It happens as the sum of ins and the sum of outs are roughly equal, but not exactly equal (sometimes up to 5% error margin). I can't control that because that's how the sensor works.
My data is captured every minute, and the data model is such (for one day):
timestamp (t) in (i) out (o)
t1 i1 o1
t2 i2 o2
.. .. ..
tN iN oN
I'd like to compute the average time a person spends in the system. If my system was perfect (sum of ins = sum of outs), the formula would be
Sum(t*(o-i))/sum(i) over all rows
But because of that system imperfection, I can't find a good formula for an estimator of the average time spent in the system
Any thoughts?
Cheers!
You would hope that $\sum_j o_j \approx \sum_j i_j$, that nobody leaves before they arrive (for example there is nobody in the building before the start or after the end), and that the errors in the sensor are unbiased.
If so, one approach might be $\dfrac{\sum_j t_j o_j}{\sum_j o_j} -\dfrac{\sum_j t_j i_j}{\sum_j i_j}$ which is the apparent average time people went out minus the apparent average time people went in.