bland.altman.plot {BlandAltmanLeh} | R Documentation |
Produce Bland-Altman Plot Bland-AltmanPlots for assessing agreement between two measuring methods or repeatability (test-retest agreement) of measurements. Using either base graphics or ggplot2.
Description
Produce Bland-Altman Plot
Bland-AltmanPlots for assessing agreement between two measuring methods or repeatability (test-retest agreement) of measurements. Using either base graphics or ggplot2.
Usage
bland.altman.plot(group1, group2, two = 1.96, mode = 1,
graph.sys = "base", conf.int = 0, silent = TRUE, sunflower = FALSE,
geom_count = FALSE, ...)
Arguments
group1 |
Measurements with first method or first measurement |
group2 |
Measurements with second method or second measurement |
two |
Lines are drawn "two" standard deviations from mean differences. This defaults to 1.96 for proper 95 percent confidence interval estimation but can be set to 2.0 for better agreement with e. g. the Bland Altman publication. |
mode |
if 1 then difference group1 minus group2 is used, if 2 then group2 minus group1 is used. Defaults to 1. |
graph.sys |
Graphing system within R. This defaults to "base" but can be
one out of |
conf.int |
Defaults to 0 which draws the usual Bland Altman plot which contains no confidence intervalls. Change to .95 for 95 percent confidence intervalls to be drawn. |
silent |
logical. If graph.sys=="base" and silent==TRUE then no return value. If graph.sys=="base" and silent==FALSE then returns statistics. |
sunflower |
logical. If TRUE, the plot will be based on a sunflower plot
and ties will be marked accordingly. Try with data with ties. Works only with
|
geom_count |
logical. If TRUE, the dots will get larger the more frequent
given pair is. Use in presence of ties. Works only with
|
... |
passed on to graphics functions if |
Value
Depends on graphic system chosen. In case of "base" depending on whether
silent==TRUE. If silent==TRUE then no returns. If silent==FALSE than returns
list of statistics as returned by bland.altman.stats()
. In case the
graphics system is "ggplot2" than the graphic object is returned so that it
can be printed or altered.
Author(s)
Bernhard Lehnert <bernhard.lehnert@uni-greifswald.de>
See Also
Examples
bland.altman.plot(rnorm(20), rnorm(20), xlab="mean measurement",
ylab="differences", main="Example plot")
bland.altman.plot(rnorm(20), 2+.8*rnorm(20), xlab="mean measurement",
ylab="differences", conf.int=.95)
bland.altman.plot(rnorm(200), 2+.8*rnorm(200), xlab="mean measurement",
ylab="differences", conf.int=.95)
# this is what fig.2 in Bland&Altman1986 would have looked like
PEFR1 <- bland.altman.PEFR[,1]
PEFR2 <- bland.altman.PEFR[,3]
bland.altman.plot(PEFR1, PEFR2, silent=TRUE, xlim=c(0,800),
xlab="Average PEFR by two meters",
ylab="Difference in PEFR (large-mini)")
# and this is the same but with additional 95 percent CIs
data(bland.altman.PEFR)
bland.altman.plot(PEFR1, PEFR2, silent=TRUE, conf.int=.95, xlim=c(0,800))
# an example with many ties and the 'sunflower'-option
a <- rep(c(1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,5,6,6),2)
b <- rep(c(1,1,1,2,2,2,3,1,4,2,5,3,3,3,3,3),3)
bland.altman.plot(a,b,sunflower=TRUE, xlab="Mean",ylab="Difference",
main="discrete values lead to ties")
library(ggplot2)
a <- bland.altman.plot(rnorm(20), rnorm(20), graph.sys="ggplot2", conf.int=.9)
print(a + xlab("you can change this later") + ggtitle("Title goes here"))