R/altmanbland.R

Defines functions altmanbland

Documented in altmanbland

#' altman-bland plot
#' @description
#' plots abs(x-y) against (y+x)/2
#' @param x - input intensities
#' @param y - input intensities
#' @param main plotting parameters
#' @param pch - plot character
#' @param log - should the x y axis be log transformed possible values "x" "y" or "xy"
#' @importFrom stats lowess
#' @export
#' @examples
#' x <- seq(1:300)/10
#' x <- x + rnorm(length(x),0,0.5)
#' y <- seq(1:300)/10
#' y <- y + rnorm(length(y),0,0.5)
#' altmanbland(y,x)
#'
altmanbland = function(x,y,main="",pch=".",log=""){
  nas <- (is.na(x) || is.na(y))
  x <- x[!nas]
  y <- y[!nas]
  
  mean  = (x+y)/2
  absdiff = abs( x-y )
  plot(mean,absdiff,log=log,xlab="(y+x)/2",ylab="abs(x-y)",pch="x",cex=0.5,main=main)
  lines(lowess(mean,absdiff),col=2,lwd=2)
}

Try the quantable package in your browser

Any scripts or data that you put into this service are public.

quantable documentation built on May 2, 2019, 4:05 p.m.