Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Plot means with SD

From   "Roger B. Newson" <>
Subject   Re: st: Plot means with SD
Date   Wed, 04 Apr 2012 12:09:28 +0100

Patricia didn't seem to specify what these means and SDs are going to be plotted against. However, users who want to plot means with SD bars, error bars or confidence limits (or even medians, interquartile ranges, minima and maxima) should probably use the -eclplot- package, downloadable from SSC. If Patricia is calculating means using the -mean- command, then the -parmest- package, also downloadable from SSC, can be used to create an output dataset with 1 observation per mean and data on the mean, standard error and confidence limits, which the user can then use to produce the plot. The -xcollapse- package can also be useful for this purpose, and can also be downloaded from SSC. All of these packages contain hypertext references to documents that explain how they can be used together to produce plots of the kind that Patricia wants.

Best wishes


Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Web page:
Departmental Web page:

Opinions expressed are those of the author, not of the institution.

On 04/04/2012 11:53, David Hoaglin wrote:

Stepping back from the programming details, I wonder what the basic
question is.  If the two variables come from the same patients, is
medstable part of durofstay, and are you also looking at a scatterplot
of medstable versus durofstay?

Also, if those variables come from the same patients, and you are
interested in the difference between the variables, it would be
helpful to look at the difference for each patient (i.e., durofstay
MINUS medstable), in order to free the comparison of differences among

If you had a something that resembles a boxplot, why would you want
mean instead of median and, especially, SD instead of the quartiles?
How skewed are the variables, especially durofstay?

David Hoaglin

I have two variables
1) medstable (days after a patient achieves medical stability, in days)
2) durofstay    (duration of hospital stay; in days)

now I wanna plot these two variables with mean and SD, so that I can see the differences of both.
How can I do this?

*   For searches and help try:
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index