Thanks to Deepayan's suggestion, I was able to use boxplot.stats to specify
type=6 to calculate quantiles by creating my own stats function as follows,

my.boxplot.stats<-function(y,subscripts,...)boxplot.stats(quantile(y,type=6),...)


And then call bwplot(Result~Group,data=d2,stats=my.boxplot.stats)


However the whisker lines are missing when there are outliers. Also not all
the outliers are drawn but only the maximum or the minimum.  I appreciate
any comment from the group. Thanks.

Jun

On Tue, Jul 21, 2009 at 10:20 AM, Deepayan Sarkar <deepayan.sar...@gmail.com
> wrote:

> On Tue, Jul 21, 2009 at 7:47 AM, Jun Shen<jun.shen...@gmail.com> wrote:
> > Uwe,
> >
> > Thank you for your reply.  I am still not very clear about the meanings
> of
> > the arguments in the stats function.   To make it clearer, quantile()
> uses
> > type=7 as default method. I believe this is the method bwplot() uses to
> > calculate the quantiles. I want to use type=6 method for bwplot(). How do
> I
> > achieve that? Thanks again.
>
> Maybe this will be clearer: bwplot() uses the boxplot.stats() function
> to compute the "quantiles" used, which in turn uses fivenum(), which
> has its own quantile calculation (and does not explicitly use
> quantile()). There is no easy way to allow for type=6 etc. here.
>
> bwplot() allows you to replace boxplot.stats() and provide your own
> alternative. So what you need to do is:
>
> (1) write a function, say, 'my.boxpot.stats', that takes the same
> arguments as boxplot.stats() and returns a similar result, but using
> your preferred calculation for the quantiles. There are many ways to
> do this.
>
> (2) plug in this function into the bwplot() call; e.g. bwplot(...,
> stats = my.boxplot.stats)
>
> -Deepayan
>
>
> >
> > Jun
> >
> > 2009/7/21 Uwe Ligges <lig...@statistik.tu-dortmund.de>
> >
> >>
> >>
> >> Jun Shen wrote:
> >>
> >>> Hi, everyone,
> >>>
> >>> Since quantile calculation has nine different methods in R, I wonder
> how I
> >>> specify a method when calling the bwplot() in lattice. I couldn't find
> any
> >>> information in the documentation. Thanks.
> >>>
> >>>
> >>
> >> bwplot() uses the panel function panel.bwplot() which allows to specify
> a
> >> function that calculates the statistics in its argument stats that
> defaults
> >> to boxplot.stats(). Hence you can change that function.
> >>
> >> Example with some fixed values:
> >>
> >> bwplot( ~ 1:10,
> >>    stats = function(x, ...)
> >>        return(list(stats=1:5, n=10, conf=1, 10, out=integer(0)))
> >> )
> >>
> >>
> >> Uwe Ligges
> >>
> >
> >        [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help@r-project.org 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.
> >
>



-- 
Jun Shen PhD
PK/PD Scientist
BioPharma Services
Millipore Corporation
15 Research Park Dr.
St Charles, MO 63304
Direct: 636-720-1589

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to