# Two-sided Median¶

Two-sided Median algorithm computes the median

$m_n^k = \text{Median}\{Y_{n-k}, \ldots, Y_{n-1}, Y_{n+1}, \ldots, Y_{n+k} \}.$

$$Y_n$$ is the observed point and $$2k$$ is the size of the neighborhood window. If

$|m_n^k - Y_n| \geq \tau \, \text{,}$

$$Y_n$$ is treated as a value outside the region of interest.

Input Parameters

Parameter Type Constraint Description Remarks
$$Y$$ $$Y \in \mathbb R^N$$ $$N \in \mathbb{N}, N \geq 3$$ Input data vector of length $$N$$
$$\tau$$ $$\tau \in \mathbb R^+$$   User-specified threshold

Output Parameters

Parameter Type Constraint Description Remarks
$$\hat{Y}$$ $$\hat{Y} \in \mathbb R^N$$   Values in the $$Y$$ list which are outside the region of interest are marked

Single Steps using the Algorithm

References

• S. Basu, M. Meckesheimer, Automatic outlier detection for time series: an application to sensor data, Knowledge and Information Systems, vol. 11, Issue 2, pp 137-154, 2007.