[R] percentile-percentile plot

Jean Eid jeaneid at chass.utoronto.ca
Wed Apr 7 02:12:29 CEST 2004


Thank you Duncan,



On Tue, 6 Apr 2004, Duncan Murdoch wrote:

> On Tue, 6 Apr 2004 13:33:58 -0400, Jean Eid
> <jeaneid at chass.utoronto.ca> wrote :
>
> >Hi,
> >
> >Is there a function that does percentile-percentile plot. I do not mean
> >the qqplot. I need to plot the percentiles rather than points themselves.
> >I am hoping for a plot that tells me that the x percentile of one data set
> >corresponds to the y percentile of the other. for example a point on the
> >plot of (.5, .2) will tell me that the 50th percentile of the first data
> >and the 20th percentile of the second data are equal.
> >
> >Is there any function that does this?
>
> I think you'll have to write your own.  Here's a rough start:
>
> ppplot <- function(x,y) {
>   x <- sort(x)
>   y <- sort(y)
>   px <- ppoints(x)
>   py <- ppoints(y)
>   plot(px, approx(y, py, x)$y)
> }
>
> This function messes up if the distributions are too different; you'll
> need to fix up the approx call somehow.
>
> Duncan Murdoch
>
>




More information about the R-help mailing list