Re: [R] How do I do a pretty scatter plot using ggplot2?

2012-03-11 Thread Michael
Could you please show me an example for my two cases?

Thanks a lot!

On Sun, Mar 11, 2012 at 3:55 AM, Jim Lemon  wrote:

>  On 03/10/2012 11:37 AM, Michael wrote:
>
>> Hi all,
>>
>> I am trying hard to do the following and have already spent a few hours in
>> vain:
>>
>> I wanted to do the scatter plot.
>>
>> But given the high dispersion on those dots, I would like to bin the
>> x-axis
>> and then for each bin of the x-axis, plot the quantiles of the y-values of
>> the data points in each bin:
>>
>> 1. Uniform bin size on the x-axis;
>> 2. Equal number of observations in each bin;
>>
>> How to do that in R? I guess for the sake of prettyness, I'd better do it
>> in ggplot2?
>>
>> Hi Michael,
> While it is not in ggplot2, a variation on the count.overplot function
> might do what you want. This function displays counts of closely spaced
> points rather than the points, but it applies the same area of aggregation
> across the whole plot. Getting the equal x bins is easy, and I assume that
> you mean equal observations within each bin, not across all bins. If you
> are stuck, I can probably hack up something from count.overplot.
>
> Jim
>
>

[[alternative HTML version deleted]]

__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How do I do a pretty scatter plot using ggplot2?

2012-03-11 Thread Jim Lemon

On 03/10/2012 11:37 AM, Michael wrote:

Hi all,

I am trying hard to do the following and have already spent a few hours in
vain:

I wanted to do the scatter plot.

But given the high dispersion on those dots, I would like to bin the x-axis
and then for each bin of the x-axis, plot the quantiles of the y-values of
the data points in each bin:

1. Uniform bin size on the x-axis;
2. Equal number of observations in each bin;

How to do that in R? I guess for the sake of prettyness, I'd better do it
in ggplot2?


Hi Michael,
While it is not in ggplot2, a variation on the count.overplot function 
might do what you want. This function displays counts of closely spaced 
points rather than the points, but it applies the same area of 
aggregation across the whole plot. Getting the equal x bins is easy, and 
I assume that you mean equal observations within each bin, not across 
all bins. If you are stuck, I can probably hack up something from 
count.overplot.


Jim

__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How do I do a pretty scatter plot using ggplot2?

2012-03-10 Thread Michael
Thanks a lot!

Could you please elaborate on this one?

"What I'd really do, if you had lots of data, would be to bin x into
small contiguous bins and to calculate quantiles for each of those
bins and to plot smoothers across the quantiles (using bin medians as
the x axis) "

On Fri, Mar 9, 2012 at 9:21 PM, R. Michael Weylandt <
[email protected]> wrote:

> Could you just add a log scale to the y dimension?
>
> DAT <- data.frame(x = runif(1000, 0, 20), y = rnorm(1000))
>
> plot(y ~ x, data = DAT, log = "y")
>
> That lessens large dispersion (in some circumstances) but I'm not
> really sure what that has to do with smoothingdo you mean
> "smoothing" in the technical sense (loess, splines, and friends) or in
> some graphical sense?
>
> Still not sure what this has to do with quantile plots: they are
> usually diagnostic tools for examining distributional shape/fit.
>
> Here's two (related) ideas:
>
> i) If you have categorical x data, boxplots:
> http://had.co.nz/ggplot2/geom_boxplot.html
>
> ii) If you have continuous x data, quantile "envelopes":
> http://had.co.nz/ggplot2/stat_quantile.html
>
> # In ggplot2
>
> DAT <- data.frame(x = runif(1000, 0, 20), y = rnorm(1000))
> DAT$xbin <- with(DAT, cut(x, seq(0, 20, 2)))
>
> p <- ggplot(DAT, aes(x = x, y = y)) + geom_point(alpha = 0.2) +
> stat_quantile(aes(colour = ..quantile..), quantiles = seq(0.05, 0.95,
> by=0.05)) + facet_wrap(~ xbin, scales = "free")
> print(p)
>
> What I'd really do, if you had lots of data, would be to bin x into
> small contiguous bins and to calculate quantiles for each of those
> bins and to plot smoothers across the quantiles (using bin medians as
> the x axis) -- I'm sure that's doable in ggplot2 as well.
>
> Michael
>
> On Fri, Mar 9, 2012 at 10:00 PM, Michael  wrote:
> > The origin of this problem was that a plain scatter plot with too many
> > points with high dispersion generated too many points flying all over
> > places.
> >
> > We are trying to smooth the charts a bit...
> >
> > Any good recommendations?
> >
> > Thanks a lot!
> >
> > On Fri, Mar 9, 2012 at 8:59 PM, Michael  wrote:
> >>
> >> Sorry for the confusion Michael.
> >>
> >> I myself am trying to figure out what my boss is requesting:
> >>
> >> I am certain that I need to "plot the quantiles of each bin.  " ...
> >>
> >> But how are the quantiles plotted? Shall I specify 50% quantile, etc?
> >>
> >> Being a diligent guy I am trying my hard to do some homework and figure
> it
> >> out myself...
> >>
> >> I thought there is a standard statistical prodedure that everybody
> >> knows...
> >>
> >> Any more thoughts?
> >>
> >> Thanks a lot!
> >>
> >>
> >> On Fri, Mar 9, 2012 at 8:51 PM, R. Michael Weylandt
> >>  wrote:
> >>>
> >>> On Fri, Mar 9, 2012 at 9:28 PM, Michael  wrote:
> >>> > Thanks a lot Mike!
> >>> >
> >>>
> >>> Michael if you don't mind. (Though admittedly it leads to some degree
> >>> of confusion in a conversation like this)
> >>>
> >>> > Could you please explain your code a bit?
> >>>
> >>> Which part?
> >>>
> >>> >
> >>> > My imagination is that for each bin, I am plotting a line which is
> the
> >>> > quantile of the y-values in that bin?
> >>>
> >>> Oh, so you want a qqnorm()-esque line? How is that like a scatterplot?
> >>>
> >>> yes, that's something else entirely (and not clear from your first
> >>> post -- to my ear the "quantile" is a statistic tied to the [e]cdf)
> >>> This is actually much easier in ggplot (and certainly doable in base
> >>> as well)
> >>>
> >>> Try this,
> >>>
> >>> DAT <- data.frame(x = runif(1000, 0, 20), y = rnorm(1000)) # Not so
> >>> volatile this time
> >>> DAT$xbin <- with(DAT, cut(x, seq(0, 20, 5)))
> >>>
> >>> library(ggplot2)
> >>> p <- ggplot(DAT) + facet_wrap( ~ xbin) + stat_qq(aes(sample = y))
> >>>
> >>> print(p)
> >>>
> >>> If this isn't what you want, please spend some time to show an example
> >>> of the sort of graph you desire (it can be a bit of code or a link to
> >>> a picture or even a hand sketch hosted somewhere online)
> >>>
> >>> Out on a limb, I think you might really be thinking of something more
> >>> like this:
> >>>
> >>> p <- ggplot(DAT) + facet_wrap( ~ xbin) + geom_step(aes(x =
> >>> seq_along(y), y = sort(y)))
> >>>
> >>> and see this for more: http://had.co.nz/ggplot2/geom_step.html
> >>>
> >>> Michael Weylandt
> >>>
> >>> >
> >>> > I ran your program but couldn't figure out the meaning of the dots in
> >>> > your
> >>> > plot?
> >>> >
> >>> > Thanks again!
> >>> >
> >>> > On Fri, Mar 9, 2012 at 7:07 PM, R. Michael Weylandt
> >>> >  wrote:
> >>> >>
> >>> >> That doesn't really seem to make sense to me as a graphical
> >>> >> representation (transforming adjacent y values differently), but if
> >>> >> you really want to do so, here's what I'd do if I understand your
> goal
> >>> >> (the preprocessing is independent of the graphics engine):
> >>> >>
> >>> >> DAT <- data.frame(x = runif(1000, 0, 20), y = rcauchy(1000)^2) #
> Nice
> >>> >> and volatile!
> >>> >>
> >>> >> # split y

Re: [R] How do I do a pretty scatter plot using ggplot2?

2012-03-10 Thread Michael
Thanks Josh!

How do I make it 50% quantile in each bin instead of the mean?

Thanks a lot!

On Fri, Mar 9, 2012 at 9:11 PM, Joshua Wiley  wrote:

> Hmm, smooth the chart makes me think you are trying to find the trends:
>
>
> require(ggplot2)
> ggplot(mtcars, aes(mpg, hp)) +
>  geom_point() +
>  stat_smooth()
>
> Try it out and see what you think---it adds a locally smoothed line
> that does something like trace the means (that is a very over
> simplification, but the gist of it).
>
> Cheers,
>
> Josh
>
> On Fri, Mar 9, 2012 at 7:00 PM, Michael  wrote:
> > The origin of this problem was that a plain scatter plot with too many
> > points with high dispersion generated too many points flying all over
> > places.
> >
> > We are trying to smooth the charts a bit...
> >
> > Any good recommendations?
> >
> > Thanks a lot!
> >
> > On Fri, Mar 9, 2012 at 8:59 PM, Michael  wrote:
> >
> >> Sorry for the confusion Michael.
> >>
> >> I myself am trying to figure out what my boss is requesting:
> >>
> >> I am certain that I need to "plot the quantiles of each bin.  " ...
> >>
> >> But how are the quantiles plotted? Shall I specify 50% quantile, etc?
> >>
> >> Being a diligent guy I am trying my hard to do some homework and figure
> it
> >> out myself...
> >>
> >> I thought there is a standard statistical prodedure that everybody
> knows...
> >>
> >> Any more thoughts?
> >>
> >> Thanks a lot!
> >>
> >>
> >> On Fri, Mar 9, 2012 at 8:51 PM, R. Michael Weylandt <
> >> [email protected]> wrote:
> >>
> >>> On Fri, Mar 9, 2012 at 9:28 PM, Michael  wrote:
> >>> > Thanks a lot Mike!
> >>> >
> >>>
> >>> Michael if you don't mind. (Though admittedly it leads to some degree
> >>> of confusion in a conversation like this)
> >>>
> >>> > Could you please explain your code a bit?
> >>>
> >>> Which part?
> >>>
> >>> >
> >>> > My imagination is that for each bin, I am plotting a line which is
> the
> >>> > quantile of the y-values in that bin?
> >>>
> >>> Oh, so you want a qqnorm()-esque line? How is that like a scatterplot?
> >>>
> >>> yes, that's something else entirely (and not clear from your first
> >>> post -- to my ear the "quantile" is a statistic tied to the [e]cdf)
> >>> This is actually much easier in ggplot (and certainly doable in base
> >>> as well)
> >>>
> >>> Try this,
> >>>
> >>> DAT <- data.frame(x = runif(1000, 0, 20), y = rnorm(1000)) # Not so
> >>> volatile this time
> >>> DAT$xbin <- with(DAT, cut(x, seq(0, 20, 5)))
> >>>
> >>> library(ggplot2)
> >>> p <- ggplot(DAT) + facet_wrap( ~ xbin) + stat_qq(aes(sample = y))
> >>>
> >>> print(p)
> >>>
> >>> If this isn't what you want, please spend some time to show an example
> >>> of the sort of graph you desire (it can be a bit of code or a link to
> >>> a picture or even a hand sketch hosted somewhere online)
> >>>
> >>> Out on a limb, I think you might really be thinking of something more
> >>> like this:
> >>>
> >>> p <- ggplot(DAT) + facet_wrap( ~ xbin) + geom_step(aes(x =
> >>> seq_along(y), y = sort(y)))
> >>>
> >>> and see this for more: http://had.co.nz/ggplot2/geom_step.html
> >>>
> >>> Michael Weylandt
> >>>
> >>> >
> >>> > I ran your program but couldn't figure out the meaning of the dots in
> >>> your
> >>> > plot?
> >>> >
> >>> > Thanks again!
> >>> >
> >>> > On Fri, Mar 9, 2012 at 7:07 PM, R. Michael Weylandt
> >>> >  wrote:
> >>> >>
> >>> >> That doesn't really seem to make sense to me as a graphical
> >>> >> representation (transforming adjacent y values differently), but if
> >>> >> you really want to do so, here's what I'd do if I understand your
> goal
> >>> >> (the preprocessing is independent of the graphics engine):
> >>> >>
> >>> >> DAT <- data.frame(x = runif(1000, 0, 20), y = rcauchy(1000)^2) #
> Nice
> >>> >> and volatile!
> >>> >>
> >>> >> # split y based on some x binning and assign empirical quantiles of
> >>> each
> >>> >> group
> >>> >>
> >>> >> DAT$yquant <- with(DAT, ave(y, cut(x, seq(0, 20, 5)), FUN =
> >>> >> function(x) ecdf(x)(x)))
> >>> >>
> >>> >> # BASE
> >>> >> plot(yquant ~ x, data = DAT)
> >>> >>
> >>> >>  # ggplot2
> >>> >> library(ggplot2)
> >>> >>
> >>> >> p <- ggplot(DAT, aes(x = x, y = yquant)) + geom_point()
> >>> >> print(p)
> >>> >>
> >>> >> Michael Weylandt
> >>> >>
> >>> >> PS -- I see Josh Wiley just responded pointing out your requirements
> >>> >> #1 and #2 are incompatible: I've used 1 here.
> >>> >>
> >>> >> On Fri, Mar 9, 2012 at 7:37 PM, Michael 
> wrote:
> >>> >> > Hi all,
> >>> >> >
> >>> >> > I am trying hard to do the following and have already spent a few
> >>> hours
> >>> >> > in
> >>> >> > vain:
> >>> >> >
> >>> >> > I wanted to do the scatter plot.
> >>> >> >
> >>> >> > But given the high dispersion on those dots, I would like to bin
> the
> >>> >> > x-axis
> >>> >> > and then for each bin of the x-axis, plot the quantiles of the
> >>> y-values
> >>> >> > of
> >>> >> > the data points in each bin:
> >>> >> >
> >>> >> > 1. Uniform bin size on the x-axis;
> >>> >> > 2. Equal number of observat

Re: [R] How do I do a pretty scatter plot using ggplot2?

2012-03-09 Thread R. Michael Weylandt
Could you just add a log scale to the y dimension?

DAT <- data.frame(x = runif(1000, 0, 20), y = rnorm(1000))

plot(y ~ x, data = DAT, log = "y")

That lessens large dispersion (in some circumstances) but I'm not
really sure what that has to do with smoothingdo you mean
"smoothing" in the technical sense (loess, splines, and friends) or in
some graphical sense?

Still not sure what this has to do with quantile plots: they are
usually diagnostic tools for examining distributional shape/fit.

Here's two (related) ideas:

i) If you have categorical x data, boxplots:
http://had.co.nz/ggplot2/geom_boxplot.html

ii) If you have continuous x data, quantile "envelopes":
http://had.co.nz/ggplot2/stat_quantile.html

# In ggplot2

DAT <- data.frame(x = runif(1000, 0, 20), y = rnorm(1000))
DAT$xbin <- with(DAT, cut(x, seq(0, 20, 2)))

p <- ggplot(DAT, aes(x = x, y = y)) + geom_point(alpha = 0.2) +
stat_quantile(aes(colour = ..quantile..), quantiles = seq(0.05, 0.95,
by=0.05)) + facet_wrap(~ xbin, scales = "free")
print(p)

What I'd really do, if you had lots of data, would be to bin x into
small contiguous bins and to calculate quantiles for each of those
bins and to plot smoothers across the quantiles (using bin medians as
the x axis) -- I'm sure that's doable in ggplot2 as well.

Michael

On Fri, Mar 9, 2012 at 10:00 PM, Michael  wrote:
> The origin of this problem was that a plain scatter plot with too many
> points with high dispersion generated too many points flying all over
> places.
>
> We are trying to smooth the charts a bit...
>
> Any good recommendations?
>
> Thanks a lot!
>
> On Fri, Mar 9, 2012 at 8:59 PM, Michael  wrote:
>>
>> Sorry for the confusion Michael.
>>
>> I myself am trying to figure out what my boss is requesting:
>>
>> I am certain that I need to "plot the quantiles of each bin.  " ...
>>
>> But how are the quantiles plotted? Shall I specify 50% quantile, etc?
>>
>> Being a diligent guy I am trying my hard to do some homework and figure it
>> out myself...
>>
>> I thought there is a standard statistical prodedure that everybody
>> knows...
>>
>> Any more thoughts?
>>
>> Thanks a lot!
>>
>>
>> On Fri, Mar 9, 2012 at 8:51 PM, R. Michael Weylandt
>>  wrote:
>>>
>>> On Fri, Mar 9, 2012 at 9:28 PM, Michael  wrote:
>>> > Thanks a lot Mike!
>>> >
>>>
>>> Michael if you don't mind. (Though admittedly it leads to some degree
>>> of confusion in a conversation like this)
>>>
>>> > Could you please explain your code a bit?
>>>
>>> Which part?
>>>
>>> >
>>> > My imagination is that for each bin, I am plotting a line which is the
>>> > quantile of the y-values in that bin?
>>>
>>> Oh, so you want a qqnorm()-esque line? How is that like a scatterplot?
>>>
>>> yes, that's something else entirely (and not clear from your first
>>> post -- to my ear the "quantile" is a statistic tied to the [e]cdf)
>>> This is actually much easier in ggplot (and certainly doable in base
>>> as well)
>>>
>>> Try this,
>>>
>>> DAT <- data.frame(x = runif(1000, 0, 20), y = rnorm(1000)) # Not so
>>> volatile this time
>>> DAT$xbin <- with(DAT, cut(x, seq(0, 20, 5)))
>>>
>>> library(ggplot2)
>>> p <- ggplot(DAT) + facet_wrap( ~ xbin) + stat_qq(aes(sample = y))
>>>
>>> print(p)
>>>
>>> If this isn't what you want, please spend some time to show an example
>>> of the sort of graph you desire (it can be a bit of code or a link to
>>> a picture or even a hand sketch hosted somewhere online)
>>>
>>> Out on a limb, I think you might really be thinking of something more
>>> like this:
>>>
>>> p <- ggplot(DAT) + facet_wrap( ~ xbin) + geom_step(aes(x =
>>> seq_along(y), y = sort(y)))
>>>
>>> and see this for more: http://had.co.nz/ggplot2/geom_step.html
>>>
>>> Michael Weylandt
>>>
>>> >
>>> > I ran your program but couldn't figure out the meaning of the dots in
>>> > your
>>> > plot?
>>> >
>>> > Thanks again!
>>> >
>>> > On Fri, Mar 9, 2012 at 7:07 PM, R. Michael Weylandt
>>> >  wrote:
>>> >>
>>> >> That doesn't really seem to make sense to me as a graphical
>>> >> representation (transforming adjacent y values differently), but if
>>> >> you really want to do so, here's what I'd do if I understand your goal
>>> >> (the preprocessing is independent of the graphics engine):
>>> >>
>>> >> DAT <- data.frame(x = runif(1000, 0, 20), y = rcauchy(1000)^2) # Nice
>>> >> and volatile!
>>> >>
>>> >> # split y based on some x binning and assign empirical quantiles of
>>> >> each
>>> >> group
>>> >>
>>> >> DAT$yquant <- with(DAT, ave(y, cut(x, seq(0, 20, 5)), FUN =
>>> >> function(x) ecdf(x)(x)))
>>> >>
>>> >> # BASE
>>> >> plot(yquant ~ x, data = DAT)
>>> >>
>>> >>  # ggplot2
>>> >> library(ggplot2)
>>> >>
>>> >> p <- ggplot(DAT, aes(x = x, y = yquant)) + geom_point()
>>> >> print(p)
>>> >>
>>> >> Michael Weylandt
>>> >>
>>> >> PS -- I see Josh Wiley just responded pointing out your requirements
>>> >> #1 and #2 are incompatible: I've used 1 here.
>>> >>
>>> >> On Fri, Mar 9, 2012 at 7:37 PM, Michael  wrote:
>>> >> > Hi all,
>>> >> >
>>> >

Re: [R] How do I do a pretty scatter plot using ggplot2?

2012-03-09 Thread Joshua Wiley
Hmm, smooth the chart makes me think you are trying to find the trends:


require(ggplot2)
ggplot(mtcars, aes(mpg, hp)) +
  geom_point() +
  stat_smooth()

Try it out and see what you think---it adds a locally smoothed line
that does something like trace the means (that is a very over
simplification, but the gist of it).

Cheers,

Josh

On Fri, Mar 9, 2012 at 7:00 PM, Michael  wrote:
> The origin of this problem was that a plain scatter plot with too many
> points with high dispersion generated too many points flying all over
> places.
>
> We are trying to smooth the charts a bit...
>
> Any good recommendations?
>
> Thanks a lot!
>
> On Fri, Mar 9, 2012 at 8:59 PM, Michael  wrote:
>
>> Sorry for the confusion Michael.
>>
>> I myself am trying to figure out what my boss is requesting:
>>
>> I am certain that I need to "plot the quantiles of each bin.  " ...
>>
>> But how are the quantiles plotted? Shall I specify 50% quantile, etc?
>>
>> Being a diligent guy I am trying my hard to do some homework and figure it
>> out myself...
>>
>> I thought there is a standard statistical prodedure that everybody knows...
>>
>> Any more thoughts?
>>
>> Thanks a lot!
>>
>>
>> On Fri, Mar 9, 2012 at 8:51 PM, R. Michael Weylandt <
>> [email protected]> wrote:
>>
>>> On Fri, Mar 9, 2012 at 9:28 PM, Michael  wrote:
>>> > Thanks a lot Mike!
>>> >
>>>
>>> Michael if you don't mind. (Though admittedly it leads to some degree
>>> of confusion in a conversation like this)
>>>
>>> > Could you please explain your code a bit?
>>>
>>> Which part?
>>>
>>> >
>>> > My imagination is that for each bin, I am plotting a line which is the
>>> > quantile of the y-values in that bin?
>>>
>>> Oh, so you want a qqnorm()-esque line? How is that like a scatterplot?
>>>
>>> yes, that's something else entirely (and not clear from your first
>>> post -- to my ear the "quantile" is a statistic tied to the [e]cdf)
>>> This is actually much easier in ggplot (and certainly doable in base
>>> as well)
>>>
>>> Try this,
>>>
>>> DAT <- data.frame(x = runif(1000, 0, 20), y = rnorm(1000)) # Not so
>>> volatile this time
>>> DAT$xbin <- with(DAT, cut(x, seq(0, 20, 5)))
>>>
>>> library(ggplot2)
>>> p <- ggplot(DAT) + facet_wrap( ~ xbin) + stat_qq(aes(sample = y))
>>>
>>> print(p)
>>>
>>> If this isn't what you want, please spend some time to show an example
>>> of the sort of graph you desire (it can be a bit of code or a link to
>>> a picture or even a hand sketch hosted somewhere online)
>>>
>>> Out on a limb, I think you might really be thinking of something more
>>> like this:
>>>
>>> p <- ggplot(DAT) + facet_wrap( ~ xbin) + geom_step(aes(x =
>>> seq_along(y), y = sort(y)))
>>>
>>> and see this for more: http://had.co.nz/ggplot2/geom_step.html
>>>
>>> Michael Weylandt
>>>
>>> >
>>> > I ran your program but couldn't figure out the meaning of the dots in
>>> your
>>> > plot?
>>> >
>>> > Thanks again!
>>> >
>>> > On Fri, Mar 9, 2012 at 7:07 PM, R. Michael Weylandt
>>> >  wrote:
>>> >>
>>> >> That doesn't really seem to make sense to me as a graphical
>>> >> representation (transforming adjacent y values differently), but if
>>> >> you really want to do so, here's what I'd do if I understand your goal
>>> >> (the preprocessing is independent of the graphics engine):
>>> >>
>>> >> DAT <- data.frame(x = runif(1000, 0, 20), y = rcauchy(1000)^2) # Nice
>>> >> and volatile!
>>> >>
>>> >> # split y based on some x binning and assign empirical quantiles of
>>> each
>>> >> group
>>> >>
>>> >> DAT$yquant <- with(DAT, ave(y, cut(x, seq(0, 20, 5)), FUN =
>>> >> function(x) ecdf(x)(x)))
>>> >>
>>> >> # BASE
>>> >> plot(yquant ~ x, data = DAT)
>>> >>
>>> >>  # ggplot2
>>> >> library(ggplot2)
>>> >>
>>> >> p <- ggplot(DAT, aes(x = x, y = yquant)) + geom_point()
>>> >> print(p)
>>> >>
>>> >> Michael Weylandt
>>> >>
>>> >> PS -- I see Josh Wiley just responded pointing out your requirements
>>> >> #1 and #2 are incompatible: I've used 1 here.
>>> >>
>>> >> On Fri, Mar 9, 2012 at 7:37 PM, Michael  wrote:
>>> >> > Hi all,
>>> >> >
>>> >> > I am trying hard to do the following and have already spent a few
>>> hours
>>> >> > in
>>> >> > vain:
>>> >> >
>>> >> > I wanted to do the scatter plot.
>>> >> >
>>> >> > But given the high dispersion on those dots, I would like to bin the
>>> >> > x-axis
>>> >> > and then for each bin of the x-axis, plot the quantiles of the
>>> y-values
>>> >> > of
>>> >> > the data points in each bin:
>>> >> >
>>> >> > 1. Uniform bin size on the x-axis;
>>> >> > 2. Equal number of observations in each bin;
>>> >> >
>>> >> > How to do that in R? I guess for the sake of prettyness, I'd better
>>> do
>>> >> > it
>>> >> > in ggplot2?
>>> >> >
>>> >> > Thank you!
>>> >> >
>>> >> >        [[alternative HTML version deleted]]
>>> >> >
>>> >> > __
>>> >> > [email protected] mailing list
>>> >> > https://stat.ethz.ch/mailman/listinfo/r-help
>>> >> > PLEASE do read the posting guide
>>> >> > http://www.R-pr

Re: [R] How do I do a pretty scatter plot using ggplot2?

2012-03-09 Thread Michael
The origin of this problem was that a plain scatter plot with too many
points with high dispersion generated too many points flying all over
places.

We are trying to smooth the charts a bit...

Any good recommendations?

Thanks a lot!

On Fri, Mar 9, 2012 at 8:59 PM, Michael  wrote:

> Sorry for the confusion Michael.
>
> I myself am trying to figure out what my boss is requesting:
>
> I am certain that I need to "plot the quantiles of each bin.  " ...
>
> But how are the quantiles plotted? Shall I specify 50% quantile, etc?
>
> Being a diligent guy I am trying my hard to do some homework and figure it
> out myself...
>
> I thought there is a standard statistical prodedure that everybody knows...
>
> Any more thoughts?
>
> Thanks a lot!
>
>
> On Fri, Mar 9, 2012 at 8:51 PM, R. Michael Weylandt <
> [email protected]> wrote:
>
>> On Fri, Mar 9, 2012 at 9:28 PM, Michael  wrote:
>> > Thanks a lot Mike!
>> >
>>
>> Michael if you don't mind. (Though admittedly it leads to some degree
>> of confusion in a conversation like this)
>>
>> > Could you please explain your code a bit?
>>
>> Which part?
>>
>> >
>> > My imagination is that for each bin, I am plotting a line which is the
>> > quantile of the y-values in that bin?
>>
>> Oh, so you want a qqnorm()-esque line? How is that like a scatterplot?
>>
>> yes, that's something else entirely (and not clear from your first
>> post -- to my ear the "quantile" is a statistic tied to the [e]cdf)
>> This is actually much easier in ggplot (and certainly doable in base
>> as well)
>>
>> Try this,
>>
>> DAT <- data.frame(x = runif(1000, 0, 20), y = rnorm(1000)) # Not so
>> volatile this time
>> DAT$xbin <- with(DAT, cut(x, seq(0, 20, 5)))
>>
>> library(ggplot2)
>> p <- ggplot(DAT) + facet_wrap( ~ xbin) + stat_qq(aes(sample = y))
>>
>> print(p)
>>
>> If this isn't what you want, please spend some time to show an example
>> of the sort of graph you desire (it can be a bit of code or a link to
>> a picture or even a hand sketch hosted somewhere online)
>>
>> Out on a limb, I think you might really be thinking of something more
>> like this:
>>
>> p <- ggplot(DAT) + facet_wrap( ~ xbin) + geom_step(aes(x =
>> seq_along(y), y = sort(y)))
>>
>> and see this for more: http://had.co.nz/ggplot2/geom_step.html
>>
>> Michael Weylandt
>>
>> >
>> > I ran your program but couldn't figure out the meaning of the dots in
>> your
>> > plot?
>> >
>> > Thanks again!
>> >
>> > On Fri, Mar 9, 2012 at 7:07 PM, R. Michael Weylandt
>> >  wrote:
>> >>
>> >> That doesn't really seem to make sense to me as a graphical
>> >> representation (transforming adjacent y values differently), but if
>> >> you really want to do so, here's what I'd do if I understand your goal
>> >> (the preprocessing is independent of the graphics engine):
>> >>
>> >> DAT <- data.frame(x = runif(1000, 0, 20), y = rcauchy(1000)^2) # Nice
>> >> and volatile!
>> >>
>> >> # split y based on some x binning and assign empirical quantiles of
>> each
>> >> group
>> >>
>> >> DAT$yquant <- with(DAT, ave(y, cut(x, seq(0, 20, 5)), FUN =
>> >> function(x) ecdf(x)(x)))
>> >>
>> >> # BASE
>> >> plot(yquant ~ x, data = DAT)
>> >>
>> >>  # ggplot2
>> >> library(ggplot2)
>> >>
>> >> p <- ggplot(DAT, aes(x = x, y = yquant)) + geom_point()
>> >> print(p)
>> >>
>> >> Michael Weylandt
>> >>
>> >> PS -- I see Josh Wiley just responded pointing out your requirements
>> >> #1 and #2 are incompatible: I've used 1 here.
>> >>
>> >> On Fri, Mar 9, 2012 at 7:37 PM, Michael  wrote:
>> >> > Hi all,
>> >> >
>> >> > I am trying hard to do the following and have already spent a few
>> hours
>> >> > in
>> >> > vain:
>> >> >
>> >> > I wanted to do the scatter plot.
>> >> >
>> >> > But given the high dispersion on those dots, I would like to bin the
>> >> > x-axis
>> >> > and then for each bin of the x-axis, plot the quantiles of the
>> y-values
>> >> > of
>> >> > the data points in each bin:
>> >> >
>> >> > 1. Uniform bin size on the x-axis;
>> >> > 2. Equal number of observations in each bin;
>> >> >
>> >> > How to do that in R? I guess for the sake of prettyness, I'd better
>> do
>> >> > it
>> >> > in ggplot2?
>> >> >
>> >> > Thank you!
>> >> >
>> >> >[[alternative HTML version deleted]]
>> >> >
>> >> > __
>> >> > [email protected] mailing list
>> >> > https://stat.ethz.ch/mailman/listinfo/r-help
>> >> > PLEASE do read the posting guide
>> >> > http://www.R-project.org/posting-guide.html
>> >> > and provide commented, minimal, self-contained, reproducible code.
>> >
>> >
>>
>
>

[[alternative HTML version deleted]]

__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How do I do a pretty scatter plot using ggplot2?

2012-03-09 Thread Michael
Sorry for the confusion Michael.

I myself am trying to figure out what my boss is requesting:

I am certain that I need to "plot the quantiles of each bin.  " ...

But how are the quantiles plotted? Shall I specify 50% quantile, etc?

Being a diligent guy I am trying my hard to do some homework and figure it
out myself...

I thought there is a standard statistical prodedure that everybody knows...

Any more thoughts?

Thanks a lot!


On Fri, Mar 9, 2012 at 8:51 PM, R. Michael Weylandt <
[email protected]> wrote:

> On Fri, Mar 9, 2012 at 9:28 PM, Michael  wrote:
> > Thanks a lot Mike!
> >
>
> Michael if you don't mind. (Though admittedly it leads to some degree
> of confusion in a conversation like this)
>
> > Could you please explain your code a bit?
>
> Which part?
>
> >
> > My imagination is that for each bin, I am plotting a line which is the
> > quantile of the y-values in that bin?
>
> Oh, so you want a qqnorm()-esque line? How is that like a scatterplot?
>
> yes, that's something else entirely (and not clear from your first
> post -- to my ear the "quantile" is a statistic tied to the [e]cdf)
> This is actually much easier in ggplot (and certainly doable in base
> as well)
>
> Try this,
>
> DAT <- data.frame(x = runif(1000, 0, 20), y = rnorm(1000)) # Not so
> volatile this time
> DAT$xbin <- with(DAT, cut(x, seq(0, 20, 5)))
>
> library(ggplot2)
> p <- ggplot(DAT) + facet_wrap( ~ xbin) + stat_qq(aes(sample = y))
>
> print(p)
>
> If this isn't what you want, please spend some time to show an example
> of the sort of graph you desire (it can be a bit of code or a link to
> a picture or even a hand sketch hosted somewhere online)
>
> Out on a limb, I think you might really be thinking of something more
> like this:
>
> p <- ggplot(DAT) + facet_wrap( ~ xbin) + geom_step(aes(x =
> seq_along(y), y = sort(y)))
>
> and see this for more: http://had.co.nz/ggplot2/geom_step.html
>
> Michael Weylandt
>
> >
> > I ran your program but couldn't figure out the meaning of the dots in
> your
> > plot?
> >
> > Thanks again!
> >
> > On Fri, Mar 9, 2012 at 7:07 PM, R. Michael Weylandt
> >  wrote:
> >>
> >> That doesn't really seem to make sense to me as a graphical
> >> representation (transforming adjacent y values differently), but if
> >> you really want to do so, here's what I'd do if I understand your goal
> >> (the preprocessing is independent of the graphics engine):
> >>
> >> DAT <- data.frame(x = runif(1000, 0, 20), y = rcauchy(1000)^2) # Nice
> >> and volatile!
> >>
> >> # split y based on some x binning and assign empirical quantiles of each
> >> group
> >>
> >> DAT$yquant <- with(DAT, ave(y, cut(x, seq(0, 20, 5)), FUN =
> >> function(x) ecdf(x)(x)))
> >>
> >> # BASE
> >> plot(yquant ~ x, data = DAT)
> >>
> >>  # ggplot2
> >> library(ggplot2)
> >>
> >> p <- ggplot(DAT, aes(x = x, y = yquant)) + geom_point()
> >> print(p)
> >>
> >> Michael Weylandt
> >>
> >> PS -- I see Josh Wiley just responded pointing out your requirements
> >> #1 and #2 are incompatible: I've used 1 here.
> >>
> >> On Fri, Mar 9, 2012 at 7:37 PM, Michael  wrote:
> >> > Hi all,
> >> >
> >> > I am trying hard to do the following and have already spent a few
> hours
> >> > in
> >> > vain:
> >> >
> >> > I wanted to do the scatter plot.
> >> >
> >> > But given the high dispersion on those dots, I would like to bin the
> >> > x-axis
> >> > and then for each bin of the x-axis, plot the quantiles of the
> y-values
> >> > of
> >> > the data points in each bin:
> >> >
> >> > 1. Uniform bin size on the x-axis;
> >> > 2. Equal number of observations in each bin;
> >> >
> >> > How to do that in R? I guess for the sake of prettyness, I'd better do
> >> > it
> >> > in ggplot2?
> >> >
> >> > Thank you!
> >> >
> >> >[[alternative HTML version deleted]]
> >> >
> >> > __
> >> > [email protected] mailing list
> >> > https://stat.ethz.ch/mailman/listinfo/r-help
> >> > PLEASE do read the posting guide
> >> > http://www.R-project.org/posting-guide.html
> >> > and provide commented, minimal, self-contained, reproducible code.
> >
> >
>

[[alternative HTML version deleted]]

__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How do I do a pretty scatter plot using ggplot2?

2012-03-09 Thread R. Michael Weylandt
On Fri, Mar 9, 2012 at 9:28 PM, Michael  wrote:
> Thanks a lot Mike!
>

Michael if you don't mind. (Though admittedly it leads to some degree
of confusion in a conversation like this)

> Could you please explain your code a bit?

Which part?

>
> My imagination is that for each bin, I am plotting a line which is the
> quantile of the y-values in that bin?

Oh, so you want a qqnorm()-esque line? How is that like a scatterplot?

yes, that's something else entirely (and not clear from your first
post -- to my ear the "quantile" is a statistic tied to the [e]cdf)
This is actually much easier in ggplot (and certainly doable in base
as well)

Try this,

DAT <- data.frame(x = runif(1000, 0, 20), y = rnorm(1000)) # Not so
volatile this time
DAT$xbin <- with(DAT, cut(x, seq(0, 20, 5)))

library(ggplot2)
p <- ggplot(DAT) + facet_wrap( ~ xbin) + stat_qq(aes(sample = y))

print(p)

If this isn't what you want, please spend some time to show an example
of the sort of graph you desire (it can be a bit of code or a link to
a picture or even a hand sketch hosted somewhere online)

Out on a limb, I think you might really be thinking of something more
like this:

p <- ggplot(DAT) + facet_wrap( ~ xbin) + geom_step(aes(x =
seq_along(y), y = sort(y)))

and see this for more: http://had.co.nz/ggplot2/geom_step.html

Michael Weylandt

>
> I ran your program but couldn't figure out the meaning of the dots in your
> plot?
>
> Thanks again!
>
> On Fri, Mar 9, 2012 at 7:07 PM, R. Michael Weylandt
>  wrote:
>>
>> That doesn't really seem to make sense to me as a graphical
>> representation (transforming adjacent y values differently), but if
>> you really want to do so, here's what I'd do if I understand your goal
>> (the preprocessing is independent of the graphics engine):
>>
>> DAT <- data.frame(x = runif(1000, 0, 20), y = rcauchy(1000)^2) # Nice
>> and volatile!
>>
>> # split y based on some x binning and assign empirical quantiles of each
>> group
>>
>> DAT$yquant <- with(DAT, ave(y, cut(x, seq(0, 20, 5)), FUN =
>> function(x) ecdf(x)(x)))
>>
>> # BASE
>> plot(yquant ~ x, data = DAT)
>>
>>  # ggplot2
>> library(ggplot2)
>>
>> p <- ggplot(DAT, aes(x = x, y = yquant)) + geom_point()
>> print(p)
>>
>> Michael Weylandt
>>
>> PS -- I see Josh Wiley just responded pointing out your requirements
>> #1 and #2 are incompatible: I've used 1 here.
>>
>> On Fri, Mar 9, 2012 at 7:37 PM, Michael  wrote:
>> > Hi all,
>> >
>> > I am trying hard to do the following and have already spent a few hours
>> > in
>> > vain:
>> >
>> > I wanted to do the scatter plot.
>> >
>> > But given the high dispersion on those dots, I would like to bin the
>> > x-axis
>> > and then for each bin of the x-axis, plot the quantiles of the y-values
>> > of
>> > the data points in each bin:
>> >
>> > 1. Uniform bin size on the x-axis;
>> > 2. Equal number of observations in each bin;
>> >
>> > How to do that in R? I guess for the sake of prettyness, I'd better do
>> > it
>> > in ggplot2?
>> >
>> > Thank you!
>> >
>> >        [[alternative HTML version deleted]]
>> >
>> > __
>> > [email protected] mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide
>> > http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>
>

__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How do I do a pretty scatter plot using ggplot2?

2012-03-09 Thread Michael
Thanks a lot Mike!

Could you please explain your code a bit?

My imagination is that for each bin, I am plotting a line which is the
quantile of the y-values in that bin?

I ran your program but couldn't figure out the meaning of the dots in your
plot?

Thanks again!

On Fri, Mar 9, 2012 at 7:07 PM, R. Michael Weylandt <
[email protected]> wrote:

> That doesn't really seem to make sense to me as a graphical
> representation (transforming adjacent y values differently), but if
> you really want to do so, here's what I'd do if I understand your goal
> (the preprocessing is independent of the graphics engine):
>
> DAT <- data.frame(x = runif(1000, 0, 20), y = rcauchy(1000)^2) # Nice
> and volatile!
>
> # split y based on some x binning and assign empirical quantiles of each
> group
>
> DAT$yquant <- with(DAT, ave(y, cut(x, seq(0, 20, 5)), FUN =
> function(x) ecdf(x)(x)))
>
> # BASE
> plot(yquant ~ x, data = DAT)
>
>  # ggplot2
> library(ggplot2)
>
> p <- ggplot(DAT, aes(x = x, y = yquant)) + geom_point()
> print(p)
>
> Michael Weylandt
>
> PS -- I see Josh Wiley just responded pointing out your requirements
> #1 and #2 are incompatible: I've used 1 here.
>
> On Fri, Mar 9, 2012 at 7:37 PM, Michael  wrote:
>  > Hi all,
> >
> > I am trying hard to do the following and have already spent a few hours
> in
> > vain:
> >
> > I wanted to do the scatter plot.
> >
> > But given the high dispersion on those dots, I would like to bin the
> x-axis
> > and then for each bin of the x-axis, plot the quantiles of the y-values
> of
> > the data points in each bin:
> >
> > 1. Uniform bin size on the x-axis;
> > 2. Equal number of observations in each bin;
> >
> > How to do that in R? I guess for the sake of prettyness, I'd better do it
> > in ggplot2?
> >
> > Thank you!
> >
>  >[[alternative HTML version deleted]]
> >
> > __
> > [email protected] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How do I do a pretty scatter plot using ggplot2?

2012-03-09 Thread Michael
Thanks Joshua.

The two criteria are separate...

So I have to produce two separate plots...

Thanks again!

On Fri, Mar 9, 2012 at 6:54 PM, Joshua Wiley  wrote:

> Hi Michael,
>
> Although I do think ggplot2 does a superb job of elegant data
> visualization; I am not sure any graphics package will do what you
> want.  I suspect you will first have to do some work binning your
> data, and then plot in your package of choice.
>
> In the situation that you have described, I do not believe your two
> criteria can be met.  Having x bins of equal size seems prohibitive of
> having equal number of points in each, when values are highly
> dispersed.
>
> Just as a heads up, for this specific of a task, I would expect you
> will spend a few hours more than you already have.  If you are willing
> to be a bit more flexible in your requirements, there are various
> binning algorithms in ggplot2 and other packages you could use to bin
> x valus, and then plot those against y quantiles.
>
> You are more likely to get a clear answer from the list if you can
> provide some sample data and perhaps a few example graphs showing what
> you hope to achieve.  An easy way to provide some sample data is using
> the dput() function and then paste the output into your (plaintext
> please) email).
>
> Cheers,
>
> Josh
>
> On Fri, Mar 9, 2012 at 4:37 PM, Michael  wrote:
> > Hi all,
> >
> > I am trying hard to do the following and have already spent a few hours
> in
> > vain:
> >
> > I wanted to do the scatter plot.
> >
> > But given the high dispersion on those dots, I would like to bin the
> x-axis
> > and then for each bin of the x-axis, plot the quantiles of the y-values
> of
> > the data points in each bin:
> >
> > 1. Uniform bin size on the x-axis;
> > 2. Equal number of observations in each bin;
> >
> > How to do that in R? I guess for the sake of prettyness, I'd better do it
> > in ggplot2?
> >
> > Thank you!
> >
> >[[alternative HTML version deleted]]
> >
> > __
> > [email protected] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
>
>
> --
> Joshua Wiley
> Ph.D. Student, Health Psychology
> Programmer Analyst II, Statistical Consulting Group
> University of California, Los Angeles
> https://joshuawiley.com/
>

[[alternative HTML version deleted]]

__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How do I do a pretty scatter plot using ggplot2?

2012-03-09 Thread R. Michael Weylandt
That doesn't really seem to make sense to me as a graphical
representation (transforming adjacent y values differently), but if
you really want to do so, here's what I'd do if I understand your goal
(the preprocessing is independent of the graphics engine):

DAT <- data.frame(x = runif(1000, 0, 20), y = rcauchy(1000)^2) # Nice
and volatile!

# split y based on some x binning and assign empirical quantiles of each group

DAT$yquant <- with(DAT, ave(y, cut(x, seq(0, 20, 5)), FUN =
function(x) ecdf(x)(x)))

# BASE
plot(yquant ~ x, data = DAT)

 # ggplot2
library(ggplot2)

p <- ggplot(DAT, aes(x = x, y = yquant)) + geom_point()
print(p)

Michael Weylandt

PS -- I see Josh Wiley just responded pointing out your requirements
#1 and #2 are incompatible: I've used 1 here.

On Fri, Mar 9, 2012 at 7:37 PM, Michael  wrote:
> Hi all,
>
> I am trying hard to do the following and have already spent a few hours in
> vain:
>
> I wanted to do the scatter plot.
>
> But given the high dispersion on those dots, I would like to bin the x-axis
> and then for each bin of the x-axis, plot the quantiles of the y-values of
> the data points in each bin:
>
> 1. Uniform bin size on the x-axis;
> 2. Equal number of observations in each bin;
>
> How to do that in R? I guess for the sake of prettyness, I'd better do it
> in ggplot2?
>
> Thank you!
>
>        [[alternative HTML version deleted]]
>
> __
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How do I do a pretty scatter plot using ggplot2?

2012-03-09 Thread Joshua Wiley
Hi Michael,

Although I do think ggplot2 does a superb job of elegant data
visualization; I am not sure any graphics package will do what you
want.  I suspect you will first have to do some work binning your
data, and then plot in your package of choice.

In the situation that you have described, I do not believe your two
criteria can be met.  Having x bins of equal size seems prohibitive of
having equal number of points in each, when values are highly
dispersed.

Just as a heads up, for this specific of a task, I would expect you
will spend a few hours more than you already have.  If you are willing
to be a bit more flexible in your requirements, there are various
binning algorithms in ggplot2 and other packages you could use to bin
x valus, and then plot those against y quantiles.

You are more likely to get a clear answer from the list if you can
provide some sample data and perhaps a few example graphs showing what
you hope to achieve.  An easy way to provide some sample data is using
the dput() function and then paste the output into your (plaintext
please) email).

Cheers,

Josh

On Fri, Mar 9, 2012 at 4:37 PM, Michael  wrote:
> Hi all,
>
> I am trying hard to do the following and have already spent a few hours in
> vain:
>
> I wanted to do the scatter plot.
>
> But given the high dispersion on those dots, I would like to bin the x-axis
> and then for each bin of the x-axis, plot the quantiles of the y-values of
> the data points in each bin:
>
> 1. Uniform bin size on the x-axis;
> 2. Equal number of observations in each bin;
>
> How to do that in R? I guess for the sake of prettyness, I'd better do it
> in ggplot2?
>
> Thank you!
>
>        [[alternative HTML version deleted]]
>
> __
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/

__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.