Learn R Programming

MethComp (version 1.22.2)

BlandAltman: Bland-Altman plot of differences versus averages. Deprecated, formerly known as BA.plot, likely to disappear from the package.

Description

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.

Usage

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, ... ) AB.plot( y1, y2, meth.names = NULL, mean.repl = FALSE, conn.repl = !mean.repl, lwd.conn = 1, col.conn = "black", comp.levels = 2:1, ... )

Arguments

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 Meth object or 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.
conn.repl
Logical. Should replicates from the same item be connected?
lwd.conn
Line width of connecting lines
col.conn
Color of connecting lines
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.

Value

An object of class BA.check; list with 3 elements:
LoA
A vector of length 3 with Limits of Agreement.
p.value
P-values for three hypothese: 1) Constant variance - this is the test of 0 slope in the regression of absolute residuals on averages. 2) Constant difference - this is the test of 0 slop in the regression of differences on averages. 3) Difference equal to 0 - this is usually a lame thing to use.
reg.res
A $3x4$ matrix with (in the first row) the results from regressing the averages on the means, and in the two other rows the derived relationships between methods. In each line the intercept (alpha), slope (beta), the prediction standard deviation (pr.sd) and half the width of the prdiction interval (pr.int).

References

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: Comparing methods of measurement: Extending the LoA by regression. Stat Med. 2010 Feb 10;29(3):401-10.

See Also

BA.plot, MCmcmc.

Examples

Run this code
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 )

Run the code above in your browser using DataLab