Solved – Plotting and presenting longitudinal data, options

data visualizationgrowth-modelpanel datarepeated measures

Hypothetical Scenario: A few continuous variables, each measured repeatedly at, say 12 time points, each with say, 150 observations. There are small fluctuations from one time point to another (i.e. change is not that smooth), but the variables are showing overall time-related changes.

Question: What are different options and their pros and cons in plotting and presenting change in such data? Would be excellent if example graphs/codes could be attached.

This is probably a very vague and general question, and I understand that it very much depends on what one wants to highlight, the kind of analyses conducted, the number of time points, the number of observations, etc. But it would be very helpful to have an idea how people usually plot their longitudinal data and what (nice) options are available. I'm particularly interested in hearing the options to highlight time-related changes integrated with individual differences (e.g. variability at each time point and variability in growth curve trajectories) in these changes.

For those interested, here is some randomly selected 100 observations from one segment of 12 time points to play with. Missings were coded as NA and data were structured wide.

Best Answer

Here's one idea for visualizing your data. Using a variation of small multiples, you could have two charts: one showing the variables' mean with a focus on a variable of interest (including SE or SD), with the second showing the focused variables individual observations.

The following chart shows three variables across 6 time periods, with 50 observations each. The shaded area indicates the SE of the focus variable, which is highlighted similarly in both charts.

Variable Observations

This could be easily scaled up or down based upon your specific needs. It can also be interactive, with a drop-down selection of a variable, and the focus and observations changing to the new item of interest.

EDIT: Here's another example, using your sample data. This shows the mean and SE (disregarding the NA's, since I don't know how you'll handle the calcs).

Median with SE

These were done in Excel, so I have no idea what the equivalent R code would be, but someone else here probably does. To create this chart, you'll have to nudge Excel into doing what you want. For the sample data you provided, I:

  1. Added four calculated rows: Mean, SE, Mean-SE, and 2*SE

    Data

  2. Create a line chart with all of your observations as series across your time periods. Format to your taste (it's probably worth some VBA to format everything at once, instead of individually selecting all 150 series). Format the rest of this chart to your preferences.

  3. Copy the chart, and paste it onto the same worksheet.

  4. Using the copy, delete all the series and add the Mean-SE and 2*SE series.

  5. Convert the chart type from Line Chart to Stacked Area Chart.

  6. Format the bottom series (Mean-SE) to No Fill. This should create the appearance of the 2*SE series floating.

  7. Add the Mean Series, and convert it to a Line Chart Type. This will cause it to appear in front of the 2*SE area series.

  8. Format the Chart Area and Plot Area to No Fill.

  9. Using Page Layout > Align > Snap to Grid align the two charts with the second chart on top.

While this looks pretty convoluted, it only takes 10-15 minutes to complete, which if you're like me is much less than trying to learn R.

Related Question