| BlandAltman {MethComp} | R Documentation |
For two vectors of equal length representing measurements of the same quantity by two different methods, the differences are plotted versus the average. The limits of agreement (prediction limits for the differences) are plotted, optionally a regression of differences of means is given too.
BlandAltman(x, y,
x.name = NULL,
y.name = NULL,
maintit = "",
cex = 1,
pch = 16,
col.points = "black",
col.lines = "blue",
limx = NULL,
limy = NULL,
ymax = NULL,
eqax = FALSE,
xlab = NULL,
ylab = NULL,
print = TRUE,
reg.line = FALSE,
digits = 2,
mult = FALSE,
alpha,
... )
BA.plot( y1, y2,
meth.names = NULL,
mean.repl = FALSE,
comp.levels = 1:2,
... )
x |
Numerical vector of measurements by 1st method. |
y |
Numerical vector of measurements by 2nd method. Must of same
length as x. |
x.name |
Label for the 1st method (x). |
y.name |
Label for the 2nd method (y). |
maintit |
Main title for the plot |
cex |
Character expansion for the points. |
pch |
Plot symbol for points. |
col.points |
Color for the points. |
col.lines |
Color for the lines indicating limits of agreement. |
limx |
x-axis limits. |
limy |
y-axis limits. |
ymax |
Scalar. The y-axis will extend from -ymax to +ymax. |
eqax |
Logical. Should the range on x- and y- axes be the same? |
xlab |
x-axis label. |
ylab |
y-axis label. |
print |
Logical: Should the limits of agreement and the c.i.s of these be printed? |
reg.line |
If TRUE, the regression line of x-y on
(x+y)/2 is drawn. If numerical the regression
equation is printed with the given number of digits
after the decimal points. |
digits |
How many decimal places should be used when printing limits of agreement? Used both for the printing of results and for annotation of the plot. |
mult |
Logical. Should data be log-transformed and reporting be on a multiplicative scale? |
alpha |
1 minus confidence level used when computing confidence intervals and limits of agreement, i.e. the t(1-alpha/2) quantile is used. If not supplied the standard value of 2 is used for computing LoA. |
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 names are
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 from BA.plot to
BlandAltman and possibly further to the plot
function. The arguments passed to BlandAltman are
used for fine-tuning the appearance of the plot. |
A list with 2 elements:
lim.agree |
A vector of length 3 with Limits of Agreement. |
p.value |
P-value for the hypothesis that the mean difference is 0. Usually a lame thing to use. |
Bendix Carstensen bxc@steno.dk, 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-310.
JM Bland and DG Altman. Measuring agreement in method comparison studies. Statistical Methods in Medical Research, 8:136-160, 1999.
B Carstensen. Limits of agreement: How to use the regression of differences on averages. Preprint, Department of Biostatistics, University of Copenhagen, http://cms.ku.dk/sund-sites/ifsv-sites/english/about/departments/biostatistics/reports/2008/researchreport08-06.pdf
data( ox ) par( mfrow=c(1,2) ) # Wrong to use mean over replicates mtab <- with( ox, tapply( y, list(item, meth), mean ) ) CO <- mtab[,"CO"] pulse <- mtab[,"pulse"] BlandAltman( CO, pulse ) # (almost) Right to use replicates singly par( mfrow=c(1,1) ) oxw <- to.wide( ox ) CO <- oxw[,"CO"] pulse <- oxw[,"pulse"] BlandAltman( CO, pulse, mult=TRUE ) BlandAltman( CO, pulse, eqax=TRUE ) data( plvol ) BA.plot( plvol ) BA.plot( plvol, reg.line=TRUE ) BA.plot( plvol, reg.line=2 )