Announcement

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

  • Continuous line cumulative frequency graph

    Hello Forum,

    I'm creating a cumulative frequency graph, but the visual result is not like expected. How do I create a continuous line without these “outgrowths”?

    I appreciate any help

    Ben


    Click image for larger version

Name:	Graph.png
Views:	1
Size:	59.4 KB
ID:	1731642

  • #2
    What code did you use?

    Comment


    • #3

      Code:
      *Create cdf
      cumul PSM_too_cheap, gen(cdf_PSM_too_cheap) 
      cumul PSM_cheap, gen(cdf_PSM_cheap)
      cumul PSM_expensive, gen(cdf_PSM_expensive)
      cumul PSM_too_expensive, gen(cdf_PSM_too_expensive)
      
      *stack 
      stack cdf_PSM_too_cheap PSM_too_cheap cdf_PSM_cheap PSM_cheap cdf_PSM_expensive PSM_expensive cdf_PSM_too_expensive PSM_too_expensive, into(c PSM) wide clear
      
      *Graph
      line cdf_PSM_too_cheap cdf_PSM_cheap cdf_PSM_expensive cdf_PSM_too_expensive PSM, sort

      Comment


      • #4
        Originally posted by Nick Cox View Post
        What code did you use?
        I used your equal option. Now it looks better. Thanks

        Comment


        • #5
          cumul is an official command. You're right that the equal option was originally suggested by me.

          Otherwise you could find distplot from the Stata Journal more direct.

          Code:
          distplot PSM_*
          should get you started.


          Code:
          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
          The 1999 and 2004 papers retain some value; otherwise the 2019 version is the latest public version of the code.
          Last edited by Nick Cox; 26 Oct 2023, 08:27. Reason: Fixed a misreading of the problem.

          Comment

          Working...
          X