Learn R Programming

rafalib (version 1.0.0)

maplot: Bland Altman plot aka MA plot

Description

Takes two vectors x and y and plots M=y-x versus A=(x+y)/2. If the vectors a more longer than length n the data is sampled to size n. A smooth curve is added to show trends.

Usage

maplot(x, y, n = 10000, subset = NULL, xlab = NULL, ylab = NULL, curve.add = TRUE, curve.col = 2, curve.span = 1/2, curve.lwd = 2, curve.n = 2000, ...)

Arguments

x
a numeric vector
y
a numeric vector
n
a numeric value. If length(x) is larger than n, the x and y are sampled down.
subset
index of the points to be plotted
xlab
a title for the x axis
ylab
a title for the y axis
curve.add
if TRUE a smooth curve is fit to the data and displayed. The function loess is used to fit the curve.
curve.col
a numeric value that determines the color of the smooth curve
curve.span
is passed on to loess as the span argument
curve.lwd
the line width for the smooth curve
curve.n
a numeric value that determines the sample size used to fit the curve. This makes fitting the curve faster with large datasets
...
further arguments passed to plot

Examples

Run this code
n <- 10000
signal <- runif(n,4,15)
bias <- (signal/5 - 2)^2
x <- signal + rnorm(n)
y <- signal + bias + rnorm(n)
maplot(x,y)

Run the code above in your browser using DataLab