Learn R Programming

metRology (version 0.9-28-1)

algS: ‘Algorithm S’ - robust estimate of pooled standard deviation

Description

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

Usage

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.

Value

A scalar estimate of poooled standard deviation.

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 \(\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.

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

See Also

algA

Examples

Run this code
# NOT RUN {
#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)


# }

Run the code above in your browser using DataLab