Re: [R] Analog of least significant difference error bars for proportions

From: Richard Friedman <>
Date: Tue, 24 May 2011 11:46:48 -0400

Dear Rolf (and List),

        Thank you for your help on error bars.
I fear that neither of the suggestions quite answer my immediate need. 1. Notches will not work because I have more than 2 levels. 2. The errbar function will useful once I know the error bars to put in.

I thing I have figured it out but I would greatly appreciate feedback (positive or negative) from the list:

For 2 or more levels with ordinary ANOVA the least significant error bars are given by


Am I correct that for 3 levels the error bars are given by


where the argument of the first square root is the standard error of the sample mean?

If I am correct, then an analogous express would seem to hold where the normal approximation is a good approximation to the binomial distribution.

for 2 samples


and for 3 samples


Does this sound right?

Thanks and best wishes,

Date: Tue, 24 May 2011 12:03:16 +1200
From: Rolf Turner <> To: Richard Friedman <> Cc:

Subject: Re: [R] Analog of least significant difference error bars	for

Message-ID: <> Content-Type: text/plain

On 24/05/11 11:23, Richard Friedman wrote:
> Dear R-list,
> In the R-book, p.464, Michael Crawley recommends that error
> bars for bar plots of normally distributed continuous response
> variables with categorical explanatory variables be given by
> 1/2 of the least significant difference, where the least significant
> difference is defines as
> qt(0.975,degrees_of_freedom)*standard_error_of_the_difference.
> The idea is that the above quantity visually conveys whether or not
> the means are different more realistically than do standard errors.
> I have analyzed proportions with categorical variables using
> the glm function with a binomial error model. I wish to plot a bar
> graph with the height of the bars the proportions. Is there a way
> to define error bars analogous to the least significant difference
> bars
> described above that can convey the overlap of proportions?
> The experimentalists with whom I work just love error bars. I would
> like to
> make them as meaningful as possible.

(1) The errbar() function in the Hmisc package will allow you to set any ``spread'' that you wish on your error bars.

(2) In respect of maximal meaningfulness: The naive viewer tends to interpret error bars by concluding that if the ranges of two pairs of error bars do not overlap then the two quantities being estimated are ``significantly different''. Hence it strikes me that you might want to imitate what is done for the notches in boxplots, which are designed to make such an interpretation roughly correct.

 From the help on boxplot.stats():

> The notches (if requested) extend to |+/-1.58 IQR/sqrt(n)|. This seems
> to be based on the same calculations as the formula with 1.57 in
> Chambers /et al./ (1983, p. 62), given in McGill /et al./ (1978, p.
> 16). They are based on asymptotic normality of the median and roughly
> equal sample sizes for the two medians being compared, and are said to
> be rather insensitive to the underlying distributions of the samples.
> The idea appears to be to give roughly a 95% confidence interval for
> the difference in two medians.


         Rolf Turner

        [[alternative HTML version deleted]] mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 24 May 2011 - 15:49:17 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 24 May 2011 - 16:30:08 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive