Algorithm S is suggested by ISO 5725-5:1998 as a robust estimator of
pooled standard deviation \(s_{pool}\) from standard deviations of
groups of size \(\nu+1\).
The algorithm calculates a ‘limit factor’, \(\eta\), set to
qchisq(prob.eta, degfree)
. Following an initial estimate of
\(s_{pool}\) as median(s)
, the standard deviations \(s_i\)
are replaced with \(w_i=min(\eta*s_{pool}, s_i)\)
and an updated value for \(s_{pool}\) calculated as
$$\xi*\sqrt{\frac{\sum_{i=1}^{p} (w_i)^2}{p}}$$
where \(p\) is the number of standard deviations and \(\xi\) is calculated as
$$\xi=\frac{1}{\sqrt{\chi_{p-1}^{2}\left(\nu\eta^{2}+\left(1-p_{\eta}\right)\eta^{2}\right)}}$$
If the \(s_i\) are ranges of two values, ISO 5725 recommends
carrying out the above iteration on the ranges and then dividing by
\(\sqrt{\nu+1}\); in the implementation here, this
is done prior to returning the estimate.
If verbose
is non-zero, the current iteration number
and estimate are printed; if verbose>1
, the current set
of truncated values \(w\) is also printed.