Description Usage Arguments Details Value Author(s) References See Also Examples
mandel.k
calculates Mandel's k statistics for replicate observations.
Mandel's k an indicator of precision compared to the pooled standard deviation across
all groups.
1 2 3 4 5 6 7 8 9 10 | mandel.k(x, g = NULL, m = NULL, na.rm = T, rowname = NULL,
method=c("classical", "robust"), n = NA, ...)
## Default S3 method:
mandel.k(x, g = NULL, m = NULL, na.rm = T, rowname = NULL,
method=c("classical", "robust"), n = NA, ...)
## S3 method for class 'ilab'
mandel.k(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 other methods. Currently not implemented. |
mandel.k
is a convenience wrapper for mandel.kh(..., type="k"). 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 k is an indicator of relative dispersion 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 k is given by:
k=√{\frac{s_{ij}^2}{∑_{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 k is calculated by replacing the classical pooled standard
deviation with the robust pooled standard deviation calculated by algorithm S (see algS
).
mandel.k 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.h
, 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 | data(RMstudy)
#Data frame examples: note no secondary grouping factor
h <- with(RMstudy, mandel.k(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.k(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.k(RM.ilab))
#Robust variant
krob <- with(RMstudy, mandel.kh(RMstudy[2:9], g=Lab, type="k", method="robust"))
plot(krob, las=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.