I have some longitudinal data. I've done longitudinal analysis before but I have never changed the time metric so I wanted to run the process of that by you.

Edits for clarity: I have repeated measures data collected over about 2 months but the study has to do with COVID - thus, time (and time passing) is an important component. People beginning the study, for example, on May 14th may be quite different than people coming in on June 1st in terms of our variables. I want to restructure the analysis to examine the effects of time. So I want to go from a scenario where I have a relatively time balanced (time 1, time 2, time 3) agnostic to the actual intake time, and restructure the analysis to take into account the specific dates on which each of the individuals 5 time points were collected - an individually varying times of observation scenario. I propose restructuring the data by indexing the analysis by recoding for each participant their 5 timepoints into 'days since the beginning of the study' and to include that as my time metric. I plan on using a linear mixed-effects model and using this new time metric as my 'time' covariate in the model.

I go into a few more details of the specific way I want to go about restructuring this below. But TLDR: I want to know a) whether this is defensible and b) whether my method of doing so makes sense below.

Original: Details:

5 data collections, spaced equally every 7 days. So t1= intake, t2= day 7, t3 = day 14, t4 = day 21, t5 = day 28. Sample size ~1500, of course some missing data due to attrition as time goes on. Participants were allowed to begin the study over the course of approximately a month - and there is a fairly good distribution of intakes across that month where the survey was open.

Instead of analyzing change just across measurement occasion, where the X-axis is t1, t2, t3, t4, t5, I would like to rescale the time-metric to capture actual day within this whole time period that data was collected and to analyze change across time that way as opposed to just being agnostic to the actual date. Turning the X-axis into Day 1, Day 2..., Day 60". This is because I have reason to believe that change on my outcome variable will be a function of time passing.

But as you might imagine, when conceptualized this way (as days) not every day will be common to all participants (i.e., some started on day 3, and some on day 30, and everything in between). So more like a time-unstructured data set - thus I will examine change over time using growth curve using a mixed- effects model.

Here is how I intend to go about doing this time metric change: Step 1: create variables that show y scores across all ~60 possible days. Step 2: recode existing 5 measurement occasion data from each participant into data organized by 'day' rather than (t1, t2, t3 ,t4, t5) based on date of intake. E.g., someone who began the study on day 1 has their first timepoint now labelled as 'day 1 Y', whereas someone who began the study on day 15 has their first timepoint labelled as 'day 15 y' in the data set (and their subsequent timepoints 7 days later i.e., 'day 21'). Step 3: restructure data to person period format (using participant IDs).
Step 4: run growth curve (with time now representing day and ranges from 1-60), with intercept and time as random effects using mixed effects model.

TLDR: I want to switch to an 'individually varying time metric' (Grim et al., 2017). I've recoded my data to change the time-metric from measurement occasion to 'day' to capture change over time. Is what I have done appropriate/correct?

OR would it just make more sense to include date (operationalized as day1, day2...etc.) as a covariate using the original metric?

Any help would be very much appreciated!

Below is a visual example of what I did using made up some random numbers:

enter image description here

Then pairwise restructure.

  • 1
    $\begingroup$ A few questions: does it make sense for your response variable to be tracked through days instead of visit at time t? If a subject can start on different days, does it make sense to create the time variable as days since the first visit? That way everyone starts at the same time. $\endgroup$ – Guilherme Marthe Dec 10 '20 at 17:50
  • 1
    $\begingroup$ Hi @GuilhermeMarthe, Thanks for your reply. It could certainly be conceptualized as 'time since last visit' and indeed that is similar to how the default data is structured. The only issue with that is that I do really want to capture/understand the overall trajectory over the specific time period of days. The way I've done it right now, just to be extra clear, my data is in the person-period format, each person has between 1-5 entries, the Time variable is between 1 and 60 capturing the day they completed their entries (instead of just Time being 1, 2, 3, 4, or 5). $\endgroup$ – C.Q Dec 10 '20 at 19:11
  • 1
    $\begingroup$ And then I have my cluster variable as participant ID, with that rescaled version of Time as my time-covariate predicting my Y in my mixed-effects model. @GuilhermeMarthe To be clear, when you say 'time since the first visit' - are you meaning time since the first respondent completed their respective survey, or time since that specific respondent completed their survey? $\endgroup$ – C.Q Dec 10 '20 at 19:13

would it just make more sense to include date ... as a covariate using the original metric?

That's how this type of situation is handled in survival analysis, if I understand your question correctly.

In survival analysis, a time reference of time = 0 is typically set as the date of entry into a study, which you coded as t1. That way, the situation over time for each individual is expressed relative to that individual's own starting time.

If there are changes in underlying conditions over calendar time that might affect the outcome measure in the underlying population (as you suspect with your study), the calendar date of entry can be used as a covariate for each individual. That way, for each individual you are evaluating the changes over time from that individual's entry into the study, while accounting for systematic differences among members of the population over calendar time.

Specifying calendar date of entry as a covariate allows you to capture non-linear changes over calendar time with regression techniques like restricted cubic splines. You will have to use your knowledge of the subject matter to determine whether you model the calendar date of entry as contributing to outcome only with respect to intercepts, or with respect to slopes (e.g., changes in individuals' outcomes over their own times since entry) as well.

That means you would have 2 different types of times specified for each observation: a within-individual time relative to study entry that changes from observation to observation for that individual, and an among-individuals calendar time representing the fixed date of study entry for each individual.

In response to comments:

I see nothing to gain by reporting separate models. A combined, comprehensive model would be best. We'll put aside for now that your outcome is evidently ordinal; just model that appropriately and interpret any statements about "linear" trends in terms of the linear predictor rather than outcome per se.

To minimize ambiguity, let's call the calendar date of entry entryDate for an individual. Call the time point of each data collection, relative to an individual's entryDate, the measurementTime. So measurementTime = 0 on an individual's entryDate.

The following, in R formula syntax (intercept is implicit), is the simplest that allows for both time within individuals and calendar time to contribute to outcome:

Outcome ~ entryDate + measurementTime + (other covariates) + (1|ID)

The random effect allows for differences among individuals (ID) with respect to the intercept. The entryDate term provides for an overall linear trend in outcome over calendar time, and measurementTime provides a linear trend in outcome within individuals (same for each individual) starting from each individual's entryDate, while taking into account the association of entryDate with outcome.

Depending on your understanding of the subject matter, you could extend the model to examine non-linear relationships between each of entryDate and measurementTime and Outcome, and examine an interaction between entryDate and measurementTime (allowing for the rate of change of outcome within individuals to vary systematically with entryDate). In the above model there is no random effect specified for measurementTime, so you should have enough data to evaluate those possibilities.

You could perhaps allow for individual-specific rates of change with measurementTime with a random effect of (1 + measurementTime | ID), but as you note that might be pushing things too far if there's anything more than a linear trend with respect to measurementTime within an individual. I don't see much to be gained by incorporating entryDate in a random effect.

  • 1
    $\begingroup$ @C.Q if you want to model changes in outcome over time within an individual then you would "also need an additional variable that denotes t1, t2, t3, t4, t5 " for each individual. With Time as the calendar date of entry, the Time|ID random effect doesn't provide anything helpful. There is only one such Time per ID, so there's no slope with respect to that Time for any individual. If you expect a linear trend within individuals from t1 through t5, then you might consider an interaction of calendar Time with that within-individual linear slope as a random effect. $\endgroup$ – EdM Dec 14 '20 at 17:25
  • 1
    $\begingroup$ Again - thank you for your time! I may have been under the faulty assumption that because my data was clustered by participant ID, and that each participant has between 1-5 entries associated with their clustering ID (now indexed by calendar date) that it would account for that. So let me just check my understanding on a couple points: 1) You propose that I include both the calendar date as well as the time-point variables and the within-individual slope *calendar time as a random effect interaction to capture both within individual change and change associated with the passing of time. $\endgroup$ – C.Q Dec 14 '20 at 21:04
  • 1
    $\begingroup$ 2) It feels as though I have almost done that ‘piecemeal’: I currently have a model where I estimated a growth curve model with measurement occasion (using the t1, t2, t3, t4, t5) as my metric, and then separately, in this latter model I have estimated just the calendar date of entry as my time variable. Is there any validity to presenting these two models separately? And not seek to make these ‘combined’ inferences? I ask because I wonder if the amount of data for certain cells of the Time*Calendar date interaction might be too low? $\endgroup$ – C.Q Dec 14 '20 at 21:04
  • 1
    $\begingroup$ Alternatively, I wonder about the viability of this: a growth curve model estimated in SEM based on the t1,t2,t3,t4,t5 metric (on which I constrain my ints/slops), but then including calendar start date (as a predictor of slopes and intercept, or as a TVC predicting my observations? I am very appreciative of your time and expertise, @EdM! $\endgroup$ – C.Q Dec 14 '20 at 21:04
  • 1
    $\begingroup$ @C.Q some call this sign-switch an example of Simpson's paradox. For correct interpretation, you need to apply your knowledge of the subject matter. Before you jump too quickly onto this regression model result, look at plots of Outcome versus measurementTime for groups with similar entryDate values, and examine initial Outcome values versus entryDate to see if the regression result makes sense. Ordinal outcome scales can require some care in handling. $\endgroup$ – EdM Dec 15 '20 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.