# On IoT-Friendly Skewness Monitoring for Skewness-Aware Online Edge Learning
## 3 Three Versions of Running Skewness and Efficient Calculation Methods
### Cumulative Sample Skewness (CSS)
#### 3.1.2 Calculation of Cumulative Sample Variance (CSV)  
In practice, standard deviation is commonly used to measure how far a set of data spread out from their average value. In order to make the derivation concise, this research focuses on sample variance instead of sample standard deviation, as shown in the equation  
\begin{table}
\begin{tabular}{c l} \hline \hline
**Notation** & **Explanation** \\ \hline \(n\) & Amount of observations (samples) within a time series. \\ \([n]_{k}\) & The most recent \(k\) items from a time series of \(n\) samples, and \(n\geqslant k>0\). \\ \(s_{n}\) & Sample standard deviation of \(n\) observation values \(x_{1},x_{2},\ldots,x_{n}\). \\ \(\bar{s}_{n}^{2}\) & Sample variance of \(n\) observation values \(x_{1},x_{2},\ldots,x_{n}\). \\ \(s_{n}^{2}|_{k}\) & Sample variance of the most recent \(k\) out of \(n\) observation values \\ \(s_{n(n)}^{2}\) & Exponentially weighted sample variance of a time series of \(n\) observation values. \\ \(S_{n}\) & Sample skewness of \(n\) observation values \(x_{1},x_{2},\ldots,x_{n}\). \\ \(S_{[n]_{k}}\) & Sample skewness of the most recent \(k\) out of \(n\) observation values \\ \(S_{[n]_{k}}\) & \(x_{n-k+1},x_{n-k+2},\ldots,x_{n}\). \\ \(S_{[n]}\) & Exponentially weighted sample skewness of a time series of \(n\) observation values. \\ \(x_{i}\) & The \(i\)th observation value within a time series, and \(i>0\). \\ \(x_{o}\) & Value of the oldest observation within the most recent \(k\) out of \(n\) observation values. \\ \(\bar{x}_{n}\) & Sample mean of a time series of \(n\) observation values \(x_{1},x_{2},\ldots,x_{n}\). \\  & Sample mean of the most recent \(k\) out of \(n\) observation values \\ \(\bar{x}_{[n]_{k}}\) & \(x_{n-k+1},x_{n-k+2},\ldots,x_{n}\). \\ \(\bar{x}_{w(n)}\) & Exponentially decreasing weights. \\ \(\alpha\), \(\beta\) & constant coefficients between 0 and 1 for discounting the contribution of older data. \\ \(\mathbb{S}_{n}\) & Auxiliary variable that carries the crucial information of the third Central Moment. \\ \(\mathbb{S}_{[n]_{k}}\) & Auxiliary variable that is associated with, and is to update, \(S_{[n]_{k}}\). \\ \(\mathbb{V}_{n}\) & Auxiliary variable that carries the crucial information of the second Central Moment. \\ \(\mathbb{V}_{[n]_{k}}\) & Auxiliary variable that is associated with, and is to update, \(s_{[n]_{k}}^{2}\). \\ C2, C3 & Auxiliary variables (similar to \(\mathbb{V}_{n}\) and \(\mathbb{S}_{n}\)) that are used in the Go Library. \\ \(M2\), \(M3\) & Auxiliary variables (similar to \(\mathbb{V}_{n}\) and \(\mathbb{S}_{n}\)) that are used in GNU Scientific Library. \\ \hline \hline \end{tabular}
\end{table}
Table 1: Notations used in the rest of this paper.  
system (3). Note that the sample standard deviation can conveniently be obtained by taking the square root of the sample variance.  
\[\begin{split}& s_{n}^{2}=\frac{\mathbb{V}_{n}}{n-1},\qquad\mathbb{ V}_{0}=\mathbb{V}_{1}=0,\ n>1\\ &\mathbb{V}_{n+1}=\mathbb{V}_{n}+(x_{n+1}-\bar{x}_{n+1})(x_{n+1}- \bar{x}_{n})\end{split} \tag{3}\]  
where \(s_{n}\) is the sample standard deviation of \(n\) observation values \(x_{1},x_{2},\ldots,x_{n}\). The sample variance \(s_{n}^{2}\) is defined as a proportional function of the auxiliary variable \(\mathbb{V}_{n}\) that can be calculated in a recursive way, while \(\mathbb{V}_{n}\) essentially carries the crucial information of the second Central Moment, i.e., \(\sum_{i=1}^{n}(x_{i}-\bar{x}_{n})^{2}\).  
Despite the usage of different notations, Equation System (3) is the same as the algorithm proposed by [PERSON] in 1962 [38]. However, [PERSON]'s algorithm does not seem to be widely recognised and employed, possibly because \"it is not obvious that the method is correct even in exact arithmetic\" [39]. As a result, the straightforward but inefficient formula of recursive variance is still frequently shared in the community [40; 41; 42]. Therefore, we have managed to go through the derivation of Equation System (3) and shared the details as proof in Appendix A.2.