BlandAltmanPlot: Bland-Altman plot function

View source: R/BlandAltmanPlot.R

BlandAltmanPlotR Documentation

Bland-Altman plot function

Description

Bland-Altman plot function

Usage

BlandAltmanPlot(
  var1,
  var2,
  with_gradient = FALSE,
  line_color = c("blue", "lightblue"),
  extremum_pctg = TRUE
)

Arguments

var1

a vector of numerics for the 1rst group to be compared.

var2

a vector of numerics for the 2nd group to be compared.

with_gradient

a logical indicating if you have a lot of measures, use with_gradient=TRUE to have gradient scale and not points. Default value is FALSE.

line_color

a vector of color for the three lines : average difference and upper and lower limits of the confidence interval for the average difference.

extremum_pctg

a logical indicating if you want to add the percentage of points outside the confidence interval for the upper and lower limits. Default is TRUE.

Value

a ggplot2 object

Examples

 
library(ggplot2)

#Small sample
#Generate data
x <- rnorm(30)
y <- rnorm(30, mean = 5, sd = 3)
#Plotting
BlandAltmanPlot(var1 = x, var2 = y) 
#Add color by group 
gr  <- c(rep("G1", 15), rep("G2", 15))
BlandAltmanPlot(var1 = x, var2 = y) + geom_point(aes(color = gr))

#High sample
#Generate data
x <- rnorm(10000)
y <- rnorm(10000, mean = 5, sd = 3)
#Plotting with gradient
BlandAltmanPlot(var1 = x, var2 = y, with_gradient = TRUE)

sistmr documentation built on March 24, 2022, 9:05 a.m.