| BA.plot {MethComp} | R Documentation |
Computes limits of agreement and produces a Bland-Altman plot of differences
versus averages for two methods of measurement. The function is just a wrapper
allowing a dataframe with columns item, meth and y (and possibly repl) to be
used as input to a Bland-Altman plot, using BlandAltman.
BA.plot( y1, y2, meth.names = NULL,
mean.repl = FALSE, comp.levels=1:2, ...)
y1 |
Measurements by method 1. Alternatively a dataframe with columns
meth, item, y, and possibly repl. |
y2 |
Corresponding measurements by method 2. Ignored if y1
is a dataframe. |
meth.names |
Names for the two methods. Used for annotation of the plot.
If not supplied and y1 is a dataframe this is derived from the
factor level names of meth. |
mean.repl |
Logical. If there are replicate measurements by each method
should the means by item and meth be formed before further ado.
WARNING: This will give too narrow limits of agreement. |
comp.levels |
Levels of the meth factor to compare. May be used to
switch the order of the methods compared by specifying comp.meth=2:1. |
... |
Further arguments passed on the the BlandAltman
function. |
A list with 2 elements:
lim.agree |
A matrix of limits of agreement as rows and estimate and c.i. as columns. |
p.value |
P-value for the hypothesis that the mean difference is 0. Usually a lame thing to use. |
Side effect: A Bland-Altman plot is produced using the function
BlandAltman.
Bendix Carstensen, Steno Diabetes Center, http://www.biostat.ku.dk/~bxc
JM Bland and DG Altman: Statistical methods for assessing agreement between two methods of clinical measurement, Lancet, i, 1986, pp. 307-10
data( ox )
str( ox )
# A wrong and a correct plot of the data.
par( mfrow=c(1,2), mar=c(4,4,1,4) )
BA.plot( ox, mean.repl=TRUE , ymax=30 ) # Too narrow limits
BA.plot( ox, mean.repl=FALSE, ymax=30 ) # (Almost) correct limits
# The same illustrating the use of method names
par( mfrow=c(1,2), mar=c(4,4,1,4) )
BA.plot( ox, mean.repl=TRUE , meth.names=c("one","two"), ymax=30 )
BA.plot( ox, mean.repl=FALSE, meth.names=c("one","two"), ymax=30 )