blandAltman: Bland-Altman plot to assess agreement between two continuous...

View source: R/blandAltman.R

blandAltmanR Documentation

Bland-Altman plot to assess agreement between two continuous variables

Description

Agreement between two continuous measurements is usually assessed by plotting the difference vs. the mean of the two measurements, the so-called Bland-Altman plot. Methods can be used interchangeably if all observations in the Bland-Altman lie between the mean +/- two standard deviations, provided that differences in this range were not clinically important. Note that the function requires pairwise observations.

Usage

blandAltman(
  x,
  y,
  conf.level = 0.95,
  group = NULL,
  xlab = "average of measurements",
  ylab = "difference of measurements",
  main = "",
  ylim = NULL,
  plot = TRUE
)

Arguments

x

Measurements of first method.

y

Measurements of second method. Must have the same length as x.

conf.level

Confidence level for confidence intervals around the limits of agreement. The default value is 0.95.

group

Factor that enables different colors for points (e.g. to group observations by observation date).

xlab

Label for x-axis.

ylab

Label for y-axis.

main

Title of the plot.

ylim

Vector of length 2 containing upper and lower limits of the y-axis.

plot

If TRUE, the plot is generated.

Value

A list containing the following elements:

difference.mean

Mean difference.

difference.sd

Standard deviation of differences.

difference.se

Standard error of mean differences.

upper.agreement.limit

Upper limit of agreement.

lower.agreement.limit

Lower limit of agreement.

agreement.limit.se

Standard error of limits of agreement.

t.value

t-quantile used for computation of limits of agreement.

Author(s)

Kaspar Rufibach, kaspar.rufibach@gmail.com

References

Bland, J.M. and Altman, D.G. (1986). Statistical methods for assessing agreement between two methods of clinical measurement. Lancet, 1, 307–310.

Examples


n <- 50
meas1 <- rnorm(n, 20, 4)
meas2 <- meas1 + rnorm(n, 0.5, 1)
time <- sample(c(rep(1, n / 2), rep(2, n / 2)))

blandAltman(x = meas1, y = meas2, conf.level = 0.95,
            xlab = "mean of measurements", ylab = "difference of measurements", 
            main = "Assess agreement between measurement 1 and measurement 2")

blandAltman(x = meas1, y = meas2, conf.level = 0.95, group = time,
            xlab = "mean of measurements", ylab = "difference of measurements",
            main = "Assess agreement between measurement 1 and measurement 2")


felix-hof/biostatUZH documentation built on Sept. 27, 2024, 1:48 p.m.