Hi
I'm currently working with a large longitudinal dataset with repeated measurements of several variables (105 variables, 7,060 observations).
1. If I want to look at individual BMI trajectories across time (the time variable being duration, my x variable), I first sort the data by ID and the x variable:
2. If I want to look at individual fitted BMI trajectories after running a linear mixed effects model (change in BMI across time - by duration), I run:
I have two questions:
1. Do the data need to be sorted by id followed by the x variable (duration - as I've done above) or by ID followed by the y variable (BMI)?
2. If an individual has a higher BMI value than the preceding individual's BMI value, does the 'connect(ascending)' option used with twoway scatter ensure a break in the BMI lines between the two individuals (that is I get a separate line for each individual)?
I get a very different graph, if I first sort as follows, before running a scatter plot:
As this is a large dataset - the patterns of BMI trajectories are very diverse taking on all kinds of slopes/directions - positive, negative and everything in between.
What is the best way to visualize my data? Given that I'm running longitudnal analysis, visualisation is key here!!
Thanks!
/Amal
I'm currently working with a large longitudinal dataset with repeated measurements of several variables (105 variables, 7,060 observations).
1. If I want to look at individual BMI trajectories across time (the time variable being duration, my x variable), I first sort the data by ID and the x variable:
Code:
sort id duration twoway (scatter bmi duration, jitter(2) msym(o) msize(tiny) /// (line bmi duration, connect(ascending) lwidth(vthin)/// (lfit bmi duration, sort lwidth(thick)
Code:
mixed bmi duration || id: duration, cov(unstr) mle predict bmifit, fitted sort id duration twoway connect bmifit duration, connect(ascending)
1. Do the data need to be sorted by id followed by the x variable (duration - as I've done above) or by ID followed by the y variable (BMI)?
2. If an individual has a higher BMI value than the preceding individual's BMI value, does the 'connect(ascending)' option used with twoway scatter ensure a break in the BMI lines between the two individuals (that is I get a separate line for each individual)?
I get a very different graph, if I first sort as follows, before running a scatter plot:
Code:
sort id bmi twoway (scatter bmi duration, jitter(2) msym(o) msize(tiny) /// (line bmi duration, connect(ascending) lwidth(vthin)/// (lfit bmi duration, sort lwidth(thick)
What is the best way to visualize my data? Given that I'm running longitudnal analysis, visualisation is key here!!

Thanks!
/Amal