qblandaltman(.data, alpha = getOption("qwraps2_alpha", 0.05),
generate_data = TRUE)qblandaltman_build_data_frame(.data, alpha = getOption("qwraps2_alpha", 0.05))
data.frame
with two columns. If a data.frame
with more than two columns is used only the first two columns will be used.qblandaltman_build_data_frame
is done automatically for you. If
FALSE, then you should explicitly call qblandaltman_build_data_frame
before calling qblandaltman
.data.frame
with two columns, the function returns a ggplot
version of a Bland Altman plot with the specified confidence intervals.Two ways to call the plotting function. If you submit a data.frame
qblandaltman
then the data needed to produce the Bland Altman plot is
automatically generated by a call to qblandaltman_build_data_frame
.
Alternatively, you may call qblandaltman_build_data_frame
directly and
then call qblandaltman
. This might be helpful if you are putting
multiple Bland Altman plots together into one ggplot object. See Examples.
Bland, J. Martin, and DouglasG Altman. "Statistical methods for assessing agreement between two methods of clinical measurement." The lancet 327, no. 8476 (1986): 307-310.
# load ggplot2 and the diamonds data set
library(ggplot2)
data(diamonds, package = "ggplot2")
# compare a simple regression to random noise
dat <-
data.frame(fitted(lm(price ~ poly(carat, 4), data = diamonds)), # fitted values
diamonds$price + rnorm(nrow(diamonds), sd = 0.2), # observed with noise
pi) # extra column
qblandaltman(dat)
# simple example
dat <- data.frame(eval1 = rpois(100, 3), eval2 = rpois(100, 3.4))
qblandaltman(dat)
last_plot() + theme_bw()
# Two plots in one ggplot object
set.seed(42)
dat1 <- data.frame(eval1 = rnorm(100), eval2 = rt(100, df = 1))
dat2 <- data.frame(eval1 = rpois(50, 3), eval2 = rpois(50, 4))
# individual plots
qblandaltman(dat1)
qblandaltman(dat2)
# combined plots
dat <- rbind(cbind(set = "rnorm", qblandaltman_build_data_frame(dat1)),
cbind(set = "rpois", qblandaltman_build_data_frame(dat2)))
qblandaltman(dat, generate_data = FALSE) + facet_wrap( ~ set)
Run the code above in your browser using DataLab