Announcement

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

  • Line Graph with Mean and Standard Deviations

    Is it possible to draw a Line Graph with the y axis mean and standard deviations drawn on the graph? if so, How?

  • #2
    We need a more precise description of the graph you want.

    Do you want a line graph of means, e.g. for each year the mean number of accidents on a particular section of road, or do you want a line graph of the raw data and add ticks on the y-axis for the mean.

    How do you want to include the standard deviation in your plot? Is it supposed to tell us something about the variability? Maybe quantiles would be a more intuitive way of including that information?
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Maarten asks good questions. In addition

      Code:
      help serrbar
      The examples in the help can easily be extended:


      Code:
      webuse assembly, clear 
      serrbar mean std date, scale(2) yline(195)
      serrbar mean std date, scale(2) title("Observed Weight Variation") ///
      sub("San Francisco plant, 1/8 to 1/6") yline(195) yaxis(1 2) ylab(195, axis(2)) ytitle("", axis(2))
      
      * new here: see addplot() addition 
      serrbar mean std date, scale(2) title("Observed Weight Variation") ///
      sub("San Francisco plant, 1/8 to 1/6") yline(195) yaxis(1 2) ylab(195, axis(2)) ytitle("", axis(2)) ///
      addplot(line mean date) legend(off)

      Comment


      • #4
        Hello Nick Cox
        Thank you very much for this code which is very useful for me. May you please share here as to what to do if I want to organize date as a function of ascending/descending order of means?

        Comment

        Working...
        X