# algS: 'Algorithm S' - robust estimate of pooled standard deviation In metRology: Support for Metrological Applications

## Description

‘Algorithm S’ calculates a robust estimate of pooled standard deviation from a set of standard deviations

## Usage

 ```1 2 3``` ``` algS(s, degfree, na.rm = FALSE, prob.eta = 0.9, is.range = FALSE, tol = .Machine\$double.eps^0.25, maxiter = 25, verbose = FALSE) ```

## Arguments

 `s` A vector of standard deviations or, if `is.range` is `TRUE`, ranges. `degfree` Scalar number of degrees of freedom associated with all values in `s`. If a vector is supplied, `median(degfree)` will be used. `na.rm` a logical value indicating whether 'NA' values should be stripped before the computation proceeds. `prob.eta` prob.eta is set to specify the lower tail area of the chi-squared distribution used as a cut-off. `is.range` if is.range is TRUE, s is interpreted as a vector of positive differences of duplcate observations and degfree is set to 1 `tol` Convergence tolerance Iteration continues until the relative change in estimated pooled sd drops below `tol`. `maxiter` Maximum number of iterations permitted. `verbose` Controls information displayed during iteration; see Details.

## Details

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(sum(w)^2)/p

where p is the number of standard deviations and ξ is calculated as

xi = 1/sqrt(pchisq(degfree*eta^2, degfree + 2) + (1-prob.eta)*eta^2)

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.

## Value

A scalar estimate of poooled standard deviation.

## Author(s)

S L R Ellison s.ellison@lgc.co.uk

## References

ISO 5725-5:1998 Accuracy (trueness and precision) of measurement methods and results - Part 5: Alternative methods for the determination of the precision of a standard measurement method

`algA`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10``` ```#example from ISO 5725-5:1998 (cell ranges for percent creosote) cdiff <- c(0.28, 0.49, 0.40, 0.00, 0.35, 1.98, 0.80, 0.32, 0.95) algS(cdiff, is.range=TRUE) #Compare with the sd of the two values (based on the range) c.sd <- cdiff/sqrt(2) algS(c.sd, degfree=1, verbose=TRUE) ```

metRology documentation built on May 2, 2019, 12:20 p.m.