Announcement

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

  • Help with cumulative frequency chart

    cumulative frequency chart

  • #2
    There is no special command for that. Simply create the cumulative variable and use it to plot.

    Code:
    webuse grunfeld, clear
    keep if t<=10 & company==1
    line invest year, title(Investment) xtitle("") ytitle("") saving(gr1, replace)
    
    *GEN CUMULATIVE VARIABLE
    bys company (year): gen cum_invest= sum(invest)
    *PLOT
    line cum_invest year, title(Cumulative Investment) xtitle("") ytitle("") saving(gr2, replace)
    
    gr combine gr1.gph gr2.gph, ycommon
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	35.0 KB
ID:	1758382

    Comment


    • #3
      If cumulative frequency means any cumulative sum then, as Andrew Musau points out, you can just use the Stata function sum() to get a new variable.

      Among other community-contributed commands, distplot has been available since 1999 for plotting cumulative distribution functions and various siblings and cousins.

      The latest public version was released in 2019.

      Code:
      . search distplot, sj historical
      
      Search of official help files, FAQs, Examples, and Stata Journals
      
      SJ-19-1 gr41_5  . . . . . . . . . . . . . . . . . Software update for distplot
              (help distplot if installed)  . . . . . . . . . . . . . . .  N. J. Cox
              Q1/19   SJ 19(1):260
              changes include better handling of the by() option calls;
              simpler default y-axis titles; more detailed discussion of
              exactly what is plotted; and more information on ridits
      
      SJ-10-1 gr41_4  . . . . . . . . . . . . . . . . . Software update for distplot
              (help distplot if installed)  . . . . . . . . . . . . . . .  N. J. Cox
              Q1/10   SJ 10(1):164
              new reverse(ge) option specifies plotting probabilities or
              frequencies greater than or equal to any data value
      
      SJ-5-3  gr0018  . . . . . . . . . .  Speaking Stata: The protean quantile plot
              . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
              Q3/05   SJ 5(3):442--460           (see gr41_3 and gr42_3 for commands)
              discusses quantile and distribution plots as used in
              the analysis of species abundance data in ecology
      
      SJ-5-3  gr41_3  . . . . . . . . . . . . . . . . . Software update for distplot
              (help distplot if installed)  . . . . . . . . . . . . . . .  N. J. Cox
              Q3/05   SJ 5(3):471
              simplified syntax; both by() and over() are now allowed
      
      SJ-4-2  gr0004  .  Speaking Stata: Graphing categorical and compositional data
              . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
              Q2/04   SJ 4(2):190--215                                 (no commands)
              discusses graphical possibilities for categorical and
              compositional data
      
      SJ-4-1  gr0003  . . . . . . . . . . . . Speaking Stata: Graphing distributions
              . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
              Q1/04   SJ 4(1):66--88                                   (no commands)
              a review of official and user-written commands for
              graphing univariate distributions; includes tricks
              beyond what is obviously and readily available
      
      SJ-3-4  gr41_2  . . . . . . . . . . . . . . . . . Software update for distplot
              (help distplot if installed)  . . . . . . . . . . . . . . .  N. J. Cox
              Q4/03   SJ 3(4):449
              option tscale() renamed as trscale()
      
      SJ-3-2  gr41_1  . . . . . . . . . . . . . . . . . Software update for distplot
              (help distplot if installed)  . . . . . . . . . . . . . . .  N. J. Cox
              Q2/03   SJ 3(2):211
              enhanced to use Stata 8 graphics and provides new options
      
      STB-51  gr41  . . . . . . . . . . . . . . . . . .  Distribution function plots
              (help distplot if installed)  . . . . . . . . . . . . . . .  N. J. Cox
              9/99    pp.12--16; STB Reprints Vol 9, pp.108--112
              plots the cumulative distribution function or survival function
              and allows multiple variables

      Comment

      Working...
      X