mandel.kh
can be called directly, but is usually intended to be called via
convenience functions mandel.h
or mandel.k
.
mandel.kh
is a generic, with methods for numeric vectors, arrays, data
frames, matrices and objects of class 'ilab'
.
Mandel's statistics are simple indicators of relative deviation or precision for grouped
sets of observations. Given a set of observations \(x_{ijl}\) 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\) and \(k\) are given by:
$$h=\frac{\bar{x_{ij}}-\bar{x_j}}{s_j}$$
where
\( s_j=\sqrt{\sum_{i=1}^p{\frac{(\bar{x_{ij}}-\bar{x_j})}{p-1}}}\)
and
$$k=\sqrt{\frac{s_{ij}^2}{\sum_{i=1}^p{s_{ij}^2/p}}}$$
where \(s_{ij}\) is the standard deviation of values \(x_{ijk}\) over \(k=1, 2, ..., n\).
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 (or as included in ...
), and Mandel's \(k\) is calculated by replacing the
classical pooled standard deviation in the denominator with the robust pooled standard deviation
calculated by algorithm S (see algS
).