Michael
2012-Mar-14 15:33 UTC
[R] How to use ggplot to do the binned quantile plots(one type of scatter plot)?
How to use ggplot to do the binned quantile plots(one type of scatter plot)? Hi all, I have done scatter plot: plot(x, y). Now I wanted to do binned quantile plots... can ggplot2 help me? For example, we bin x data into 10 bins. For each bin, we draw the 10 deciles of the corresponding y data in that bin as points/dots. And then accross all bins, we would like to connect the corresponding decile points/dots together(something like equi-quantile or equi-decile curves)... How do I do that in R or ggplot2? Is there an existing function/command that can do this? Thanks a lot! [[alternative HTML version deleted]]
David Winsemius
2012-Mar-14 15:52 UTC
[R] How to use ggplot to do the binned quantile plots(one type of scatter plot)?
On Mar 14, 2012, at 11:33 AM, Michael wrote:> How to use ggplot to do the binned quantile plots(one type of > scatter plot)?More like a quantile regression plot.> > Hi all, > > I have done scatter plot: plot(x, y). > > Now I wanted to do binned quantile plots... can ggplot2 help me? > > For example, we bin x data into 10 bins. > > For each bin, we draw the 10 deciles of the corresponding y data in > that > bin as points/dots. > > And then accross all bins, we would like to connect the corresponding > decile points/dots together(something like equi-quantile or equi- > decile > curves)... > > How do I do that in R or ggplot2? Is there an existing function/ > command > that can do this?I'm not aware of it if there is. But I agree that it can be a very informative display of data. I do such plots on data structures generated using tapply with age, sex categories and quantile() to generate a value. It gets kind of hairy with the list structure that results but if you have a more simple data situation it will probably be more straightforward, and you should post it.> [[alternative HTML version deleted]]And you should learn to post in plain text> PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlAnd you should read the Posting Guide.> and provide commented, minimal, self-contained, reproducible code.And I already said that. -- David Winsemius, MD West Hartford, CT