Announcement

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

  • James Walsh
    replied
    This was exactly what I was looking for. Thanks so much!

    Leave a comment:


  • Nick Cox
    replied
    Something like


    Code:
    sysuse bplong, clear
    egen group = group(age sex), label
    stripplot bp, bar over(group) ms(none)
    
    egen mean = mean(bp), by(group)
    
    egen order = group(mean group) 
    
    * labmask is from the Stata Journal 
    labmask order, values(group) decode 
    
    stripplot bp, bar over(order) ms(none)

    Leave a comment:


  • James Walsh
    replied
    I have a similar question to above that I cannot answer.

    I want to sort the categorical variables according to their mean score.

    Assume the following
    Code:
    sysuse bplong, clear
    egen group = group(age sex), label
    stripplot bp, bar over(group) ms(none)
    Is it possible to order groups (y axis) by mean blood pressure (x axis) as part of the stripplot command?

    Thanks in advance!
    Attached Files

    Leave a comment:


  • Nick Cox
    replied
    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.

    Leave a comment:


  • shem shen
    replied
    Nick is the best

    Leave a comment:


  • Gracia Brueckmann
    replied
    Thank you, this helped me very much!

    Leave a comment:


  • Nick Cox
    replied
    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))

    Leave a comment:


  • Gracia Brueckmann
    replied
    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!

    Leave a comment:


  • Nick Cox
    replied
    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.

    Leave a comment:

Working...
X