Announcement

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

  • Graph of individual growth curves and mean population trajectory, xtline?

    Dear all,

    I am doing growth models using Stata mixed command. Each individual case in my data has 4 repeated observations, each one year appart. Not all individuals have the same age at entry study however. What I want is a graph showing individual trajectories AND the average trajectory of the sample.

    I have already tried the following approaches :

    (1) Using twoway graph :

    xtmixed y age age_2 || id: age, mle cov(un)
    predict y_fitted, fitted
    sort id age
    twoway (connected y_fitted age, connect msymbol(i) lpattern(dash) (ascending)) || (qfit y age, lwidth(medthick))

    At first glance, this code seemed to work just fine, the 4 estimated data points within a person were correctly connected. And there is a curve for the average population. However, some trajectories were connected even though these observations did not belong to the same person. This happened to some cases, but not all of them.

    (2) Then I tried the xtline command :

    xtline y_fitted, overlay t(age) i(id) legend(off) scheme(s2mono)

    It works perfectly for the individual trajectories. BUT, how do I add to this graph the average population curve?

    Thanks a lot!

    Valérie
Working...
X