Announcement

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

  • stripplot updated on SSC

    The single-program package stripplot has been updated on SSC, thanks as usual to Kit Baum. Stata 8.2 is required.

    If interested, install or replace with ssc or adoupdate.

    stripplot started in 1999 as an alternative to graph, oneway (since Stata 8 gr7, oneway) but has since morphed by a mix of accident and design into an alternative to the official command dotplot. The aim is to compare distributions and a variety of displays is possible, including linear and stacked dot and strip plots, with in conjunction box plots or confidence intervals.

    The main changes in this version are

    1. Much extended help file.

    2. Side-by-side quantile plots (or less usefully, in my view, cumulative distribution plots stacked vertically) as an alternative display.

    3. Horizontal reference lines for e.g. means and medians (with a documented limit to this). This detail was sparked by users' comments at the Boston meeting in July on the +++ reference lines allowed with dotplot.

    #2 and #3 are exemplified by this token graph using Stata's citytemp dataset. The reference lines are means in this instance.



    Click image for larger version

Name:	stripplot_new.png
Views:	1
Size:	13.0 KB
ID:	210041



    Here is another example, with Stata's auto data used to show a hybrid box and quantile plot. (Box plots can leave out so much....) The reference lines here are medians.

    Attached Files
    Last edited by Nick Cox; 05 Sep 2014, 08:21.

  • #2
    Thanks to Kit Baum (again), stripplot has been updated on SSC (again).

    Apart from extending the help file, the most obvious changes concern

    1. Adding a cumulative probability option for the cumulated displays (distribution function or quantile function, depending on whether horizontal or vertical alignment is chosen). As the second example in the previous post especially makes clear, cumulative graphs implied previously a frequency scale. Adding a probability scale has the simple advantage that each group of values is shown in about the same space. This permits easy combination with box plots:

    Click image for larger version

Name:	stripplot_box4.png
Views:	1
Size:	24.4 KB
ID:	264575

    The idea (ideal!) is to get the best of both worlds, not only the summarizing function of box plots but also the detail provided by quantile plots (not just possible outliers, but also fine structure such as gaps or granularity that may or may not need scrutiny). Note that there is nothing novel or original in these plots except the implementation: Parzen was urging the use of hybrid quantile-box plots in 1979 and geographers were doing the same thing in spirit in 1933.

    The code for the above example is

    Code:
     
    sysuse auto, clear 
    stripplot mpg, over(rep78) box(barw(0.8) blcolor(ltblue)) centre vertical cumul cumpr mc(orange) scheme(s1color) yla(, ang(h))

    2. Adding an outside option so that stripplot can be used to draw box plots only. There is a detailed example in the help, so I will not illustrate.

    Comment


    • #3
      May I ask a question about strip plot here?

      Assume

      Code:
      sysuse auto
      
      stripplot length cumul cumprob box centre  over(rep78) refline  xsize(3)
      is there any way to sort them from 1 (top) to 5 (bottom) on the rep78 scale? In the "vertical" option case it seems fine, but not horizontal, see my exemplary code.

      ( I need a lot of plots like this and they are all neatly labelled, so just recoding before plotting seem excessive but so far the only option.)

      I seem to be unable to find anything about this in the help file or on the web, I cannot be the only one...

      Thanks in advance!

      Comment


      • #4
        ysc(reverse) is a standard twoway option.

        Code:
        . sysuse auto, clear 
        
        . stripplot length, cumul cumprob box centre  over(rep78) refline  xsize(3)
        
        . stripplot length, cumul cumprob box centre  over(rep78) refline  xsize(3) ysc(reverse)
        The results look fairly odd in this case, but an example in the help for stripplot is more convincing

        Code:
        sysuse bplong, clear 
        
        egen group = group(age sex), label
        
        stripplot bp*, bar over(when) by(group, compact col(1) note("")) ysc(reverse) subtitle(, pos(9) ring(1) nobexpand bcolor(none) placement(e)) ytitle("") xtitle(Blood pressure (mm Hg))

        Comment


        • #5
          Thank you, this helped me very much!

          Comment


          • #6
            Nick is the best

            Comment


            • #7
              Thanks again to Kit Baum, stripplot has been updated on SSC. The immediate stimulus is a bug fix arising from a problem kindly reported by Dave Airey in https://www.statalist.org/forums/for...pplot-question

              The last public date was about 3 years ago. Since then I've been steadily elaborating the help file, by adding references and also examples. The project goes back to 1999, so I now have a fair collection of references, but more are welcome.

              Example code and references for "midgap plots" as discussed at https://www.statalist.org/forums/for...-without-boxes have been added, for example.

              Comment

              Working...
              X