For boxplot(), is it possible to pass in a parameter to change the default way that the 1st and 3rd quartiles are computed? (specifically, I'd like to use type 6 described in the quantile function). Also, what are the options for how outliers are computed, and how can one change them? Thank you [[alternative HTML version deleted]]
If you look at boxplot.default you will see that it calls boxplot.stats to compute the statistics used. So you can make renamed copies of both functions and alter them to behave as you like. (Because of namespace issues, you cannot just use your own boxplot.stats.) I am not sure why you would want to do this, and a 'box and whiskers plot' was pretty closely defined by the original authors so R does not allow options for forms they did not consider. But as it is a programming language it is pretty easy to produce your own version. On Sun, 11 Feb 2007, Cecilia Alm wrote:> For boxplot(), is it possible to pass in a parameter to change the default > way that the 1st and 3rd quartiles are computed? (specifically, I'd like to > use type 6 described in the quantile function). > > Also, what are the options for how outliers are computed, and how can one > change them? > > Thank you > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Hi as documentation does not say anything about changing quantile computation it seems to me that you have 2 options: 1. change source code 2. change values computed by boxplot.stats and do plotting with newly computed values by bxp see respective help pages and look at structure for boxplot e.g. mybox <- boxplot(something) mybox$stats <- changing.function(something) bxp(mybox) HTH Petr On 11 Feb 2007 at 22:04, Cecilia Alm wrote: Date sent: Sun, 11 Feb 2007 22:04:42 -0600 From: "Cecilia Alm" <ebbaalm at uiuc.edu> To: r-help at stat.math.ethz.ch Subject: [R] Boxplot: quartiles/outliers> For boxplot(), is it possible to pass in a parameter to change the > default way that the 1st and 3rd quartiles are computed? > (specifically, I'd like to use type 6 described in the quantile > function). > > Also, what are the options for how outliers are computed, and how can > one change them? > > Thank you > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch 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.Petr Pikal petr.pikal at precheza.cz
For your outlier question, look at the 'range' argument to the boxplot function. It defaults to 1.5 meaning that any points more than 1.5*IQR from the 1st and 3rd quartiles are considered outliers. If you make this smaller, you will potentially see more outliers, if you make it larger then it will show fewer outliers. The special case of 0 means that you don't want any points to be shown as outliers and the wiskers will go all the way to the min and max points. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at intermountainmail.org (801) 408-8111> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Cecilia Alm > Sent: Sunday, February 11, 2007 9:05 PM > To: r-help at stat.math.ethz.ch > Subject: [R] Boxplot: quartiles/outliers > > For boxplot(), is it possible to pass in a parameter to > change the default way that the 1st and 3rd quartiles are > computed? (specifically, I'd like to use type 6 described in > the quantile function). > > Also, what are the options for how outliers are computed, and > how can one change them? > > Thank you > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >
> I am not sure why you would want to do this, and a 'box and whiskers plot' > was pretty closely defined by the original authors so R does not allow > options for forms they did not consider.I was wondering who the original authors were? Would be interested in looking up their description. VR
Hi Google "boxplot" see Wikipedia The boxplot was invented in 1977 by American statistician John Tukey. John W. Tukey. "Exploratory Data Analysis". Addison-Wesley, Reading, MA. 1977 So you shall probably look there. HTH Petr On 14 Feb 2007 at 16:35, Vikas Rawal wrote: Date sent: Wed, 14 Feb 2007 16:35:43 +0530 From: Vikas Rawal <vikasrawal at gmail.com> To: r-help at stat.math.ethz.ch Copies to: Prof Brian Ripley <ripley at stats.ox.ac.uk> Subject: Re: [R] Boxplot: quartiles/outliers> > > I am not sure why you would want to do this, and a 'box and whiskers > > plot' was pretty closely defined by the original authors so R does > > not allow options for forms they did not consider. > > I was wondering who the original authors were? Would be interested in > looking up their description. > > VR > > ______________________________________________ > R-help at stat.math.ethz.ch 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.Petr Pikal petr.pikal at precheza.cz
Please see Michael Frigge and David C. Hoaglin and Boris Iglewicz. "Some Implementations of the Boxplot". The American Statistician. Vol. 43 (1), February 1989. 50?54. They investigate and compared several alternate definitions of the hinges (quartiles) and conclude that Tukey's definition is best on several criteria.