Description Usage Arguments Details Value Author(s) References See Also Examples
mandel.h
calculates Mandel's h statistics for replicate observations.
Mandel's h is an indication of relative deviation from the mean value.
1 2 3 4 5 6 7 8 9 10 | mandel.h(x, g = NULL, m = NULL, na.rm = T, rowname = NULL,
method=c("classical", "robust"), n = NA, ...)
## Default S3 method:
mandel.h(x, g = NULL, m = NULL, na.rm = T, rowname = NULL,
method=c("classical", "robust"), n = NA, ...)
## S3 method for class 'ilab'
mandel.h(x, g = NULL, m = NULL, na.rm = T, rowname = NULL,
method=c("classical", "robust"), n = NA, ...)
|
x |
An R object (see Details below), which contains replicate observations or,
if |
g |
A primary grouping factor, usually corresponding to Laboratory in an
inter-laboratory study. If not present, |
m |
A secondary grouping factor, usually corresponding to test item
or measured quantity. |
na.rm |
A logical value indicating whether 'NA' values should be
stripped before the computation proceeds. Passed to functions
such as |
rowname |
A single character label for the primary grouping factor (e.g. "Lab", "Organisation"). |
method |
Character scalar giving the calculation method. |
n |
scalar number of observations per group. Required only if |
... |
Additional parameters passed to |
mandel.h
is a convenience wrapper for mandel.kh(..., type="h"). It is generic,
with methods for numeric vectors, arrays, data frames, matrices and objects of class
'ilab'
. All parameters are passed to mandel.kh
.
Mandel's h is an indicators of relative deviation for grouped sets of observations. Given a set of observations x[i,j,l] where i, j, l denotes observation l, l=1, 2, ... n for measurand or test item j and group (usually laboratory) i, i=1, 2, ... p, Mandel's h is given by:
h=\frac{\bar{x_{ij}}-\bar{x_j}}{s_j}
where s_j=√{∑_{i=1}^p{\frac{(\bar{x_{ij}}-\bar{x_j})}{p-1}}}
If x
is a vector, one-dimensional array or single-column matrix, values are aggregated
by g
and, if present, by m
. If x
is a data frame or matrix, each column
is aggregated by g
and m
silently ignored if present. In all cases, if g
is NULL
or missing, each row (or value, if a vector) in x
is taken as a pre-calculated mean (for Mandel's h) or standard deviation (for Mandel's k).
If x
is an object of class 'ilab'
, g
defaults to '$org'
and
m
to $measurand
.
The returned object includes a label ('grouped.by'
) for the primary grouping factor.
For the 'ilab'
method, this is "Organisation"
. For other methods, If rowname
is
non-null, rowname
is used. If rowname
is NULL, the default is deparse(substitute(g))
;
if g
is also NULL or missing, "Row" is used.
If method="robust"
, Mandel's h is replaced by a robust z score calculated by
replacing \bar{x_j} and s_j with the robust estimates of location and scale
obtained using Huber's estimate with tuning constant k
set to 1.5 (unless otherwise
specified in ...
).
mandel.h returns an object of class "mandel.kh"
, which is a data frame consisting
of the required Mandel's statistics and in which each row corresponds to a level of g
and each column to a level of m
or (if x
was a matrix or data frame) to the
corresponding column in x
. In addition to the class, the object has attributes:
"h"
or "k"
Character scalar giving the label used for the grouping
factor g
; see Details above for the defaults.
Number of observations per group (n
if specified
S Ellison s.ellison@lgc.co.uk
Accuracy (trueness and precision) of measurement methods and results – Part 2: Basic method for the determination of repeatability and reproducibility of a standard measurement method. ISO, Geneva (1994).
mandel.k
, mandel.kh
;
pmandelh
, pmandelk
for probabilities, quantiles etc.;
plot.mandel.kh
, barplot.mandel.kh
for plotting methods.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | data(RMstudy)
#Data frame examples: note no secondary grouping factor
h <- with(RMstudy, mandel.h(RMstudy[2:9], g=Lab))
plot(h, las=2)
#Vector variant
RMstk <- stack(RMstudy[,2:9])
names(RMstk) <- c("x", "meas")
#names replace 'values' and 'ind'
RMstk$Lab <- rep(RMstudy$Lab, 8)
h2 <- with(RMstk, mandel.h(x, g=Lab, m=meas, rowname="Laboratory"))
#Note use of rowname to override g
plot(h2, las=2)
#ilab method
RM.ilab <- with(RMstk, construct.ilab(org=Lab, x=x, measurand=meas,
item=factor(rep("CRM", nrow(RMstk))) ) )
plot(mandel.h(RM.ilab))
#Robust variant
hrob <- with(RMstudy, mandel.kh(RMstudy[2:9], g=Lab, type="h", method="robust"))
plot(hrob, las=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.