Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why my boxplot in Stata isn't showing whiskers?

    Good day! Please let me know how I can make the whiskers appear for my boxplot. I am just following tutorial on how to make boxplots in stata but when i try to generate my own, there are not any whiskers showing. I am new in exploring the use of Stata, none of the tutorials I found online seems to help. That is only my inquiry. I have attached a sample boxplot I am trying to make and it is not showing any whiskers. Thank you so much in advance.
    Attached Files
    Last edited by Mark Samoranos; 01 Dec 2018, 08:59.

  • #2
    this sounds like a data issue; please read the FAQ and post your data using -dataex- and inside CODE blocks

    Comment


    • #3
      Hi Rich! thank you for your advise, could I show my data here as I only have a very small sample size which is this:
      ID sample a sample b sample c sample d
      1 0.0625 0.3125 0.3125 0.3125
      1 0.0904 0.5578 0.2463 0.1055
      1 0.0417 0.4545 0.3687 0.1352
      I am only using Stata 13. So, when I try to make a boxplot with this data, I only generate the graphic I have attached in my earlier post. Thank you...
      Last edited by Mark Samoranos; 01 Dec 2018, 09:12.

      Comment


      • #4
        In general, there can be no whiskers in the presence of ties such that 25% or more of values = maximum and 25% or more = minimum.

        That has to be true also for a sample size of 3.

        Just use a dotplot?

        Comment


        • #5
          this is not a problem related directly to Stata. That might be well the reason you didn't find tutorials on this particular situation.

          But a fast Web-browsing will promptly reveal several texts on the subject.

          Nick already clarified the issue, but you may wish to read this text, for example.
          Best regards,

          Marcos

          Comment


          • #6
            I didn't know about that as I am only exploring the use of boxplots for data representation. Thank you very much for verifying it Nick, thank you as well Marcos. That text is indeed helpful

            Comment


            • #7
              There are also many posts on Cross Validated on box plots without whiskers. Another way to think about it is to push your data through summarize, detail or equivalently tabstat, which shows that Stata returns the same result for extremes and quartiles for this sample size.

              Code:
              clear 
              input ID    sample_a    sample_b    sample_c    sample_d
              1    0.0625    0.3125    0.3125    0.3125
              1    0.0904    0.5578    0.2463    0.1055
              1    0.0417    0.4545    0.3687    0.1352
              end 
              
              tabstat sample*, s(n min p25 p50 p75 max) c(stat)
              
                  variable |         N       min       p25       p50       p75       max
              -------------+------------------------------------------------------------
                  sample_a |         3     .0417     .0417     .0625     .0904     .0904
                  sample_b |         3     .3125     .3125     .4545     .5578     .5578
                  sample_c |         3     .2463     .2463     .3125     .3687     .3687
                  sample_d |         3     .1055     .1055     .1352     .3125     .3125
              --------------------------------------------------------------------------

              Comment


              • #8
                Thanks so much Nick!

                Comment


                • #9
                  Alternatively, it is not old enough to shave.

                  Comment

                  Working...
                  X