I have a dataset of 2 variables collected repeatedly at 5 different timepoints on a group of individuals, structured like this:

ID   TimePoint   Variable    Result
1       1           Var1        5
2       1           Var1        7 
3       1           Var1        3
1       1           Var2        5
2       1           Var2        7 
3       1           Var2        3
1       2           Var1        0
2       2           Var1        4 
3       2           Var1        5
1       2           Var2        6
2       2           Var2        9 
3       2           Var2        3


I want to investigate whether there is a linear relationship between the variables across the timepoints.

Separately I have carried out repeated measures testing to determine how the individual variables change for the group over time and a generalized linear model at each timepoint to investigate the relationship between the 2 variables. I am having trouble finding a method to investigate that relationship across all 5 of the timepoints. Can anyone recommend a method to achieve that?

N.B; the data in the table is just an example, in the real dataset the participant n = 28.


1 Answer 1


First, are your time-points equally spaced or are they dummy variables? If you want to regress both time and your variable they need to be continuous variables to see a linear relationsship.

I think you see where I am going here: use time as a covariate in your model and make an interaction with the other variable to determine if there are relations between time and the other covariates in predicating your outcome variable.

What software are you running in? Might help for an example.

  • $\begingroup$ They are evenly spaced, at each time point both variables are collected in paralell. They are both continusos variables. Yes, that's what I'm thinking. I'm just struggling to find a similar example. I'm doing everything in R. $\endgroup$
    – John Conor
    Mar 14 at 18:14
  • $\begingroup$ great! however, I do see that you have only 28 subjects. This might be a bit low, so be carefull and check the SD of the varaibles after adding an interaction. The model will look something like LMM.results <- Lmer(result~ TimePoint +variable + TimePoint*variable (1|ID), dataset) $\endgroup$
    – Walter
    Mar 15 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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