[R] how to change the "quantile" method in bwplot
Matthias Kohl
Matthias.Kohl at stamats.de
Tue Jul 21 18:31:50 CEST 2009
for teaching purposes I wrote a corresponding function; cf.
qbxp.stats (as well as qboxplot ...) in package MKmisc.
hth,
Matthias
Deepayan Sarkar schrieb:
> On Tue, Jul 21, 2009 at 7:47 AM, Jun Shen<jun.shen.ut at 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 <ligges at 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 at 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.
>>
>>
>
> ______________________________________________
> R-help at 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.
>
--
Dr. Matthias Kohl
www.stamats.de
More information about the R-help
mailing list