baplot | R Documentation |
Produce classical parametric as well as nonparametric Bland-Altman plots including confidence intervals for the mean of the differences and the lower and upper limit of agreement.
baplot(x, y, loa.level = 0.95, conf.level = 0.95,
xlab = "Mean", ylab = "Difference",
title = "Bland-Altman Plot", xlim = NULL, ylim = NULL,
type = c("parametric", "nonparametric"),
loa.type = c("unbiased", "biased"), ci.diff = TRUE, ci.loa = TRUE,
ci.type = c("exact", "approximate", "boot"),
bootci.type = NULL, R = 9999, print.res = TRUE,
color.low = "#4575B4", color.upp = "#D73027",
alpha = 1, shape = 19, na.rm = TRUE, ...)
x |
numeric, measurements of method 1. |
y |
numeric, measurements of method 2. |
loa.level |
single numeric, level of the level of agreement. |
conf.level |
single numeric, significance level. |
xlab |
label of x-axis. |
ylab |
label of y-axis. |
title |
title of plot. |
xlim |
optional numeric vector of length 2, limits of x-axis. |
ylim |
optional numeric vector of length 2, limits of y-axis. |
type |
single character, either |
loa.type |
single character, either |
ci.diff |
single logical, plot confidence interval for the mean of the differences. |
ci.loa |
single logical, plot confidence intervals for the lower and upper limit of agreement. |
ci.type |
single character, either |
bootci.type |
single character, type of bootstrap interval; see |
R |
single numeric, number of bootstrap replicates. |
print.res |
single logical, print results of computations in addition to plotting. |
color.low |
single color (character), color for lower limit of agreement. |
color.upp |
single color (character), color for upper limit of agreement. |
alpha |
blending factor (default: no blending. |
shape |
point shape used. |
na.rm |
single logical, remove |
... |
further arguments passed to function |
The plot generates a ggplot2
object that is shown.
Setting type = "parametric"
(default), a classical Bland-Altman plot
with mean of the differences and standard lower and upper limit of agreement
(mean +/- 1.96 SD) will be generated (loa.level = 0.95
);
see Altman and Bland (1983,1986).
Setting type = "nonparametric"
, a nonparametric Bland-Altman plot with
median of the differences and empirical 2.5% and 97.5% quantiles
(loa.level = 0.95
) as lower and upper limit of agreement will be generated.
By changing loa.level
the lower and upper limit of agreement will
correspond to the (1-loa.level)/2
and the 1 - (1-low.level)/2
quantile.
Setting loa.type = "unbiased"
, the unbiased estimator of the standard
deviation will be used; see Shieh (2018).
Setting loa.type = "biased"
, the standard deviation will be estimated
by function sd
.
Setting ci.type = "exact"
, the exact confidence intervals of Shieh (2018)
will be used for the lower and upper limit of agreement.
Setting ci.type = "approximate"
, the approximate confidence intervals
of Bland and Altman (1986, 1999) will be used.
Setting ci.type = "boot"
, bootstrap confidence intervals will be used.
In the case of parametric Bland-Altman plots, the studentized bootstrap method will
be used by default. In the case of nonparametric Bland-Altman plots, the
bootstrap percentile method will be used by default.
The argument bootci.type
can be set to "stud"
(studentized bootstrap),
"perc"
(bootstrap percentile) or "bca"
(adjusted bootstrap percentile).
Object of class gg
and ggplot
.
Matthias Kohl Matthias.Kohl@stamats.de
Altman DG, Bland JM (1983). Measurement in Medicine: the Analysis of Method Comparison Studies. The Statistician 32:307-317.
Bland JM, Altman DG (1986). Statistical methods for assessing agreement between two methods of clinical measurement. Lancet 327(8476):307-10
Bland JM, Altman DG (1999). Measuring agreement in method comparison studies. Stat Methods Med Res 8:135-160.
Shieh G (2018). The appropriateness of Bland-Altman's approximate confidence intervals for limits of agreement. BMC Med Res Methodol 18:45.
data(fingsys)
## classical parametric Bland-Altman plot with exact confidence intervals
baplot(x = fingsys$armsys, y = fingsys$fingsys,
xlab = "Mean of arm and finger [mm Hg]",
ylab = "Difference (arm - finger) [mm Hg]")
## nonparametric Bland-Altman plot with exact confidence intervals
baplot(x = fingsys$armsys, y = fingsys$fingsys, type = "nonparametric",
xlab = "Mean of arm and finger [mm Hg]",
ylab = "Difference (arm - finger) [mm Hg]",
title = "Nonparametric Bland-Altman Plot")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.