Description Usage Arguments Details Value Author(s) References See Also Examples
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. Works with Meth
and MethComp
objects too.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | BA.plot( y1, y2, meth.names = NULL,
wh.comp = 1:2,
pl.type = "BA",
dif.type = "const",
sd.type = "const",
model = if( inherits(y1,"Meth") & has.repl(y1) ) "linked"
else NULL,
eqax = FALSE,
axlim = if( is.data.frame(y1) ) range(y1$y) else range(c(y1,y2)),
diflim = NULL,
grid = TRUE,
h.grid = TRUE,
col.grid = grey(0.9),
points = TRUE,
col.points = "black",
cex.points = 1,
pch.points = 16,
lwd = c(3,1,1),
col.lines = "blue",
repl.conn = FALSE,
col.conn = col.points,
lwd.conn = 1,
xlab = NULL,
ylab = NULL,
eqn = FALSE,
col.eqn = col.lines,
font.eqn = 2,
digits = 2,
Transform = if( mult ) "log" else NULL,
mult = FALSE,
alpha = NULL,
... )
|
y1 |
Numerical vector of measurements by 1st method. Can also be a
|
y2 |
Numerical vector of measurements by 2nd method. Must of same
length as |
meth.names |
Label for the method names. |
wh.comp |
Which methods should be compared. Either numerical or character. |
pl.type |
What type of plot should be made, |
dif.type |
How should difference depend on the
averages. |
sd.type |
How should the standard deviation depend on the
averages. |
model |
Should a variance component model be used to compute
the limits of agreement? If |
eqax |
Should the axes be identical? If a Bland-Altman plot
is drawn, the axis for the differences will have the same extent as the
axis for the averages, but centered on 0 (see |
axlim |
The limits of the axes. |
diflim |
The limits of the difference axis. |
grid |
Should there be a grid? If numeric, how many gridlines? If a vector of length>1, it will be taken as the position of the vertical gridlines. |
h.grid |
Position of the horizontal gridlines. Ignored if |
col.grid |
Color of the gridlines. |
points |
Logical. Should the observed points be drawn? |
col.points |
What color should they have? |
cex.points |
How large should they be? |
pch.points |
What plot character for the points |
lwd |
Numerical vector of 3, giving the width of the conversion line (mean difference) and the limits of agreement. |
col.lines |
What color should the lines have. |
repl.conn |
Should replicate measurements be connected (within items)? |
col.conn |
Color of connecting lines. |
lwd.conn |
Width of connecting lines. |
xlab |
x-axis label. |
ylab |
y-axis label. |
eqn |
Logical. Should the equations linking the methods be shown on the plot? If a Bland-Altman plot is made, both the equations linking the methods and the equation for the differences versus the averages are shown. |
col.eqn |
Color for equations |
font.eqn |
Font for equations |
digits |
How many digits after the decimal point should be used when showing the equations. |
Transform |
Transformation applied to data prior to analysis. Plots are made on the original scale after back-transformation. |
mult |
Logical. If TRUE, ratios of measurement instead of
differences will be plotted in the Bland-Altman plot on a logarithmic
axis, and limits of agreement will be given on this scale?
This gives the same analysis as using |
alpha |
1 minus the confidence level. If |
... |
Further parameters passed on to |
A plot of the relationship between the methods is produced;
either a Bland-Altman plot of the differences versus averages, or a 45
degree rotation as a conversion between the methods. If
model=NULL
a simple regression of averages on differences is
made by calling DA.reg
, and the specified conversion plotted.
An object of class MethComp
and either DA.reg
(if
model=NULL
) or BA.est
(if model
is character).
Bendix Carstensen bxc@steno.dk, http://BendixCarstensen.com.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | data( ox )
ox <- Meth( ox )
# The simplest possible Bland-Altman plot
BA.plot( ox )
## With bells and whistles, comparing the naive and model
par( mfrow=c(2,2) )
BA.plot( ox, model=NULL, repl.conn=TRUE, col.lines="blue",
axlim=c(0,100), diflim=c(-50,50), xaxs="i", yaxs="i",
las=1, eqn=TRUE, dif.type="lin", pl.type="BA", sd.type="lin",
grid=1:9*10, digits=3,font.eqn=1)
par(new=TRUE)
BA.plot( ox, model="linked", repl.conn=TRUE, col.lines="red",
axlim=c(0,100), diflim=c(-50,50), xaxs="i", yaxs="i",
las=1, eqn=FALSE, dif.type="lin", pl.type="BA", sd.type="lin",
grid=1:0*10, digits=3)
BA.plot( ox, model=NULL, repl.conn=TRUE, col.lines="blue",
axlim=c(0,100), diflim=c(-50,50), xaxs="i", yaxs="i",
las=1, eqn=TRUE, dif.type="lin", pl.type="conv", sd.type="lin",
grid=1:9*10, digits=3,font.eqn=1)
par(new=TRUE)
BA.plot( ox, model="linked", repl.conn=TRUE, col.lines="red",
axlim=c(0,100), diflim=c(-50,50), xaxs="i", yaxs="i",
las=1, eqn=FALSE, dif.type="lin", pl.type="conv", sd.type="lin",
grid=1:9*10, digits=3)
# The same again, but now logit-transformed
BA.plot( ox, model=NULL, repl.conn=TRUE, col.lines="blue",
axlim=c(0,100), diflim=c(-50,50), xaxs="i", yaxs="i",
las=1, eqn=TRUE, dif.type="lin", pl.type="BA", sd.type="lin",
grid=1:9*10, digits=3,font.eqn=1,Transform="pctlogit")
par(new=TRUE)
BA.plot( ox, model="linked", repl.conn=TRUE, col.lines="red",
axlim=c(0,100), diflim=c(-50,50), xaxs="i", yaxs="i",
las=1, eqn=FALSE, dif.type="lin", pl.type="BA", sd.type="lin",
grid=1:0*10, digits=3,Transform="pctlogit")
BA.plot( ox, model=NULL, repl.conn=TRUE, col.lines="blue",
axlim=c(0,100), diflim=c(-50,50), xaxs="i", yaxs="i",
las=1, eqn=TRUE, dif.type="lin", pl.type="conv", sd.type="lin",
grid=1:9*10, digits=3,font.eqn=1,Transform="pctlogit")
par(new=TRUE)
BA.plot( ox, model="linked", repl.conn=TRUE, col.lines="red",
axlim=c(0,100), diflim=c(-50,50), xaxs="i", yaxs="i",
las=1, eqn=FALSE, dif.type="lin", pl.type="conv", sd.type="lin",
grid=1:9*10, digits=3,Transform="pctlogit")
|
Loading required package: nlme
The following variables from the dataframe
"ox" are used as the Meth variables:
meth: meth
item: item
repl: repl
y: y
#Replicates
Method 1 2 3 #Items #Obs: 354 Values: min med max
CO 1 4 56 61 177 22.2 78.6 93.5
pulse 1 4 56 61 177 24.0 75.0 94.0
Relationships between methods:
CO-pulse = -1.919+0.059(CO+pulse)/2 (17.602-0.162Avg.)
CO = -1.977+1.061pulse (16.892-0.159pulse)
pulse = 1.864+0.943CO (-18.399+0.166CO)
Variable SD not possible, use DA.reg() or specify model=FALSE
Relationships between methods:
CO-pulse = -1.919+0.059(CO+pulse)/2 (17.602-0.162Avg.)
CO = -1.977+1.061pulse (16.892-0.159pulse)
pulse = 1.864+0.943CO (-18.399+0.166CO)
Variable SD not possible, use DA.reg() or specify model=FALSE
Relationships between methods:
CO-pulse = 0.036+0.105(CO+pulse)/2 (0.348-0.038Avg.)
CO = 0.038+1.111pulse (0.360-0.041pulse)
pulse = -0.034+0.900CO (-0.338+0.035CO)
Warning message:
In log(p/(100 - p)) : NaNs produced
Variable SD not possible, use DA.reg() or specify model=FALSE
Warning message:
In log(p/(100 - p)) : NaNs produced
Relationships between methods:
CO-pulse = 0.036+0.105(CO+pulse)/2 (0.348-0.038Avg.)
CO = 0.038+1.111pulse (0.360-0.041pulse)
pulse = -0.034+0.900CO (-0.338+0.035CO)
Warning message:
In log(p/(100 - p)) : NaNs produced
Variable SD not possible, use DA.reg() or specify model=FALSE
Warning message:
In log(p/(100 - p)) : NaNs produced
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.