Skip to content

What to do with notched box traces with "inverted ends" ? #4088

Description

@destradafilm

I'm implementing the boxplot notched option, but don't really know what it is exactly and how to explain it to users that choose that option. The plotly documentation doesn't explain how it's calculated

the only thing I found useful online when researching was this:
https://sites.google.com/site/davidsstatistics/home/notched-box-plots

The Notch - displays the a confidence interval around the median which is normally based on the median +/- 1.57 x IQR/sqrt of n. According to Graphical Methods for Data Analysis (Chambers, 1983) although not a formal test the, if two boxes' notches do not overlap there is ‘strong evidence’ (95% confidence) their medians differ.>

Also, there are inverted ends when I add notches. I'm not sure if this is a bug or expected behavior
Screen+Shot+2019-07-29+at+4 17 03+PM

Activity

  1. changed the title [-]request - better documentation for boxplot notched[/-] [+]possible bug - boxplot notched and request for better documentation[/+] on Jul 29, 2019
  2. etpinard commented on Jul 31, 2019

    @etpinard
    Contributor

    Also, there are inverted ends when I add notches.

    Thanks for reporting. Could you share the data/layout you used to help us debug?

  3. destradafilm commented on Jul 31, 2019

    @destradafilm
    Author

    Here is a codepen with an example of the bug:
    https://codepen.io/destrada/pen/WVONOK

  4. destradafilm commented on Aug 7, 2019

    @destradafilm
    Author

    hi @etpinard . I'm wondering if this has been labeled as a bug and if the codepen I provided helps show what the bug is? Thanks!

  5. self-assigned this
    on Nov 25, 2019
  6. etpinard commented on Nov 25, 2019

    @etpinard
    Contributor

    The problem here has to do with samples that have median confidence intervals that go beyond Q1 (and/or Q3) and beyond the lower (and/or upper) fence value.

    After a quick search, I couldn't find any notched boxplot examples that show "inverted ends". I suspect that some libraries bound the confidence interval to the IQR. But from #2305 (the PR that added notched boxes), looks like the author (@krassowski ) was ok with those "inverted ends" as that PR added two mocks showing inverted ends:

    If "inverted ends" are a thing, then the problem is in our autorange-finding routine which should consider the median confidence interval in its computations.

    If "inverted ends" were added in by mistake, then we should simply bound the median confidence interval accordingly in the calc step.

  7. changed the title [-]possible bug - boxplot notched and request for better documentation[/-] [+]What to do with notched box traces with "inverted ends" ?[/+] on Nov 25, 2019
  8. removed their assignment
    on Nov 25, 2019
  9. alexcjohnson commented on Nov 26, 2019

    @alexcjohnson
    Collaborator

    FWIW At least matplotlib allows inverted notches too https://stackoverflow.com/questions/38794406/why-is-matplotlibs-notched-boxplot-folding-back-on-itself

    I feel like I’ve seen this elsewhere as well - And to me it seems like the most honest way to display the notches. But I suppose an option to bound them to the IQR would be a reasonable feature to add.

  10. krassowski commented on Nov 26, 2019

    @krassowski
    Contributor

    On my part, the inverted notches were intended - they highlight an important property of the distribution and are generated by all major packages including matplotlib (above), ggplot etc. Another link to an explanation: https://stats.stackexchange.com/questions/151580/how-to-interpret-notched-box-plots/151584

  11. krassowski commented on Nov 26, 2019

    @krassowski
    Contributor
  12. etpinard commented on Nov 26, 2019

    @etpinard
    Contributor

    Thanks @krassowski @alexcjohnson !!

    I'll adjust the autorange computations accordingly.

  13. self-assigned this
    on Nov 26, 2019
  14. destradafilm commented on Dec 11, 2019

    @destradafilm
    Author

    sorry I'm late to the conversation. @etpinard thanks for fixing the autorange.
    And thanks @alexcjohnson @krassowski for clarifying that inverted notches aren't considered a bug :)

  15. etpinard commented on Dec 11, 2019

    @etpinard
    Contributor

    ... and thank you @destradafilm for reporting this bug !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugsomething broken

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions