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 $degfree$. 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{degfree+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.