Announcement

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

  • Scatter graph plot (time series) with multiple observations

    Hi there,

    I am looking at marks of 200 students over time.

    I have a scatter graph with:
    TIME: X-axis
    MARKS: Y-axis

    "twoway (scatter MARKS TIME, sort)"

    I have 200 observations, hence my scatter graph is a bit messy

    How could I plot an line of the average marks of the class? (instead of having plenty of dots everywhere?)

    PS: The command : "twoway (line MARKS TIME, sort)" does not work as it connects all the dots of every students (and there are 200 dots for every year)

    Regards,

    Joseph

  • #2
    Is the unit of measurement students or classes? If classes you'd want to collapse the data into class level means first. If you wanted to help people understand the relationship being displayed by the scatterplot you could use:

    Code:
    tw scatter MARKS TIME, sort || lfit MARKS TIME
    To overlay the regression of marks on time over the scatterplot points.

    Comment


    • #3
      There are many kinds of averaging. See also

      Code:
      * a variant of William Buchanan's approach 
      ssc desc aaplot  
      
      ssc desc rcspline 
      
      ssc desc localp 
      
      help lpoly 
      
      search polarsm

      Comment


      • #4
        Hi wbuchanan!

        My unit of measurement is by students (thus 200 students = 200 observations per test)
        And I would like to obtain a line which will be the average of the class over time (200 students in the class)

        Thanks

        Joseph

        Comment


        • #5
          Further, if you just want a graph of averages for a few distinct times, you could go

          Code:
          egen mean = mean(marks), by(time
          scatter marks time || connected mean time, sort
          although localp (SSC) or lpoly may well give you similar graphs with suitable bandwith choice. That depends on whether time is clustered or not.

          http://www.statalist.org/forums/foru...thodox-methods makes this vivid.
          Last edited by Nick Cox; 16 Jan 2016, 08:50.

          Comment


          • #6
            It worked! Thank you for your help

            Comment

            Working...
            X