Announcement

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

  • Add Trend/Regression line in tsline

    Hello!

    I have three parameters that measure an examiners performance over time. The data is noted for around 10 examiners and is decreases over time, indicating better performance - I already performed analysis with linear mixed model analysis and more.
    Now I want to generate a graph plotting the values over time with the following code:

    Code:
    tsset Examiner IndexNumberOfExamination
    twoway (tsline PerformanceValue1) (tsline PerformanceValue2) (tsline PerformanceValue3) if IndexNumberOfExamination < 50, by(Examiner)
    This already gives me a nice graphical overview but as the performance values are fluctuating a bit, I would like to add a regression or trend-line to visualize decrease. Anyone got an idea how to do that?

    Thanks a lot!
    Michael

  • #2
    Statistically you have there variables or measures, not parameters. This works with one measure, but I haven't tried it with three.

    Code:
    webuse grunfeld, clear 
    
    tsset company year 
    
    gen log_invest = log(invest) 
    
    twoway tsline log_invest, by(company) || lfit log_invest year

    Comment


    • #3
      works great for one measure! But why the log? Just to get a better looking decrease?

      Comment


      • #4
        That's just for the data example: it works better. Might/might not be true for your data, which I can't see, but I guess you don't need it.

        Comment


        • #5
          Thanks a lot!
          I have ten "Examiners" and the command with by(Examiner) creates 10 separate graphs.
          Now I have a separate variable indicating if the examiner is female or male - is there a way to sort the 10 graphs so that the graphs are sorted by sex?

          Comment


          • #6
            Code:
            egen newid = group(female id), label
            and then tsset in terms of that.

            Comment

            Working...
            X