robustBAplot: R function to plot a robust version of the Bland-Altman plot

View source: R/robust_BA_plot.R

robustBAplotR Documentation

R function to plot a robust version of the Bland-Altman plot

Description

The function allows to plot a robust version of the Bland-Altman plot.

Usage

robustBAplot(
  a,
  b,
  z = 1.96,
  methAlab = "Method A",
  methBlab = "Method B",
  cex = 0.6
)

Arguments

a

Vector storing the first set of measurements to be compared.

b

Vector storing the second set of measurements to be compared.

z

Value for the confidence interval for the median difference; set by default to 1.96 (corresponding to 95 percent CI).

methAlab

Label to be used in the returned chart to refer to the method yielding the first set of measurements.

methBlab

Label to be used in the returned chart to refer to the method yielding the second set of measurements.

cex

Size of the data points.

Details

The function returns a chart based on robust (i.e. resistant to outlying values) measures of central tendency and variability: median and Median Absolute Deviation (MAD) (Wilcox R R. 2001. "Fundamentals of modern statistical methods: Substantially improving power and accuracy". New York: Springer) instead of mean and standard deviation.

The x-axis displays the median of the two variables being compared, while the y-axis represents their difference. A solid horizontal line represents the bias, i.e. the median of the differences reported on the y-axis. Two dashed horizontal lines represent the region in which 95percent of the observations are expected to lie; they are set at the median plus or minus z*(MAD/0.6745).

Examples

#create a first toy vector
a <- rnorm(30,10,1)

#create a second toy vector
b <- a*runif(30,1,1.5)

robustBAplot(a,b)


GmAMisc documentation built on March 18, 2022, 6:32 p.m.