File: eqqplot.R

package info (click to toggle)
matchit 2.4-13-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,040 kB
  • ctags: 51
  • sloc: makefile: 24; csh: 13
file content (15 lines) | stat: -rw-r--r-- 534 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
eqqplot <- function(x, y, plot.it = TRUE, xlab = deparse(substitute(x)),
                    ylab = deparse(substitute(y)), ...)
{ ## empirical quantile-quantile plot; hacked from qqplot() in stats.
  sx <- sort(x)
  sy <- sort(y)
  lenx <- length(sx)
  leny <- length(sy)
  if (leny < lenx)
    sx <- approx(1:lenx, sx, n = leny, method = "constant")$y
  if (leny > lenx)
    sy <- approx(1:leny, sy, n = lenx, method = "constant")$y
  if (plot.it)
    plot(sx, sy, xlab = xlab, ylab = ylab, ...)
  invisible(list(x = sx, y = sy))
}