help >

**Within-subjects design longitudinal analysis with three time points.**Showing 1-6 of 6 posts

Feb 17, 2021 08:02 PM | Álvaro Deleglise

Within-subjects design longitudinal analysis with three time points.

Dear Andrew,

Thanks in advance for your help.

I'm currently working with funcional data of a within-subjects design longitudinal experiment. I have 21 subjects who performed 2 differents tasks A & B in two different weeks, and for each subject I have 6 resting-state scans (1 session before performing any of the two tasks, 1 session 30 minutes later after performing the task for the first time, and 1 session 24 hs after performing the task). In brief, I have 2 conditions with 3 times points each. The main objective of the study is to identify the specific funcional signatures of one of these two task on resting-state networks.

For each task, I've independently ran paired samples t-test on each network edge (≈8000) to compare the baseline vs the 30 min, the baseline vs the 24 hs, and the 30 min vs the 24 hs session, but I'm not sure if this approach is adequate for the study design. So now I was thinking to perform a NB statistical analysis including all the data at once (accounting for the withing-subject and longitudinal nature of the design) but I'm a little bit lost about the way the "design matrix" and "contrast" should look like for my dataset. Can you please help me with this? I'm interesed in main effect of task type and the interaction between task * time, and more specifically, in identifying the edges that present a difference in strength. For example, when I've ran the related samples t-test on each edge comparing the baseline vs the 30 min data of one particular task, I founded a network composed of 18 edges that presented a significant difference between both sessions. Can the NBS tool also localize and supply this kind of results where comparing the three sessions of both tasks at once?

Cheers,

A.D.

Thanks in advance for your help.

I'm currently working with funcional data of a within-subjects design longitudinal experiment. I have 21 subjects who performed 2 differents tasks A & B in two different weeks, and for each subject I have 6 resting-state scans (1 session before performing any of the two tasks, 1 session 30 minutes later after performing the task for the first time, and 1 session 24 hs after performing the task). In brief, I have 2 conditions with 3 times points each. The main objective of the study is to identify the specific funcional signatures of one of these two task on resting-state networks.

For each task, I've independently ran paired samples t-test on each network edge (≈8000) to compare the baseline vs the 30 min, the baseline vs the 24 hs, and the 30 min vs the 24 hs session, but I'm not sure if this approach is adequate for the study design. So now I was thinking to perform a NB statistical analysis including all the data at once (accounting for the withing-subject and longitudinal nature of the design) but I'm a little bit lost about the way the "design matrix" and "contrast" should look like for my dataset. Can you please help me with this? I'm interesed in main effect of task type and the interaction between task * time, and more specifically, in identifying the edges that present a difference in strength. For example, when I've ran the related samples t-test on each edge comparing the baseline vs the 30 min data of one particular task, I founded a network composed of 18 edges that presented a significant difference between both sessions. Can the NBS tool also localize and supply this kind of results where comparing the three sessions of both tasks at once?

Cheers,

A.D.

Feb 20, 2021 03:02 AM | Andrew Zalesky

RE: Within-subjects design longitudinal analysis with three time points.

Hi Alvaro,

this seems like a fairly complicated design and it is difficult to provide details recommendations without understanding your specific aims and hypotheses.

Some quick comments:

- Given that the sample size is modest, you may want to consider simplifying the design, given that the power to test for interactions between conditions and each of the time points may be minimal when considering ~8000 tests. In this sense, using paired t-tests is a reasonable first choice in my opinion (as you have done).

- The full design is a 2 x 3 repeated measures. Check out some of the previous posts on this forum providing details about the design matrix for a 2 x 2 repeated measures design. You could either directly adopt one of these design matrices and exclude one of your time points, or adapt the design with inclusion of a third time point.

In brief, the design matrix would include a separate column for each subject, where a 1 is placed in each row pertaining to the subject, and zero elsewhere. Two columns would be included to model two of the time points (It doesn't matter which of the two time points that you model). And an additional two columns would be included to model the interaction between time and group.

Andrew

this seems like a fairly complicated design and it is difficult to provide details recommendations without understanding your specific aims and hypotheses.

Some quick comments:

- Given that the sample size is modest, you may want to consider simplifying the design, given that the power to test for interactions between conditions and each of the time points may be minimal when considering ~8000 tests. In this sense, using paired t-tests is a reasonable first choice in my opinion (as you have done).

- The full design is a 2 x 3 repeated measures. Check out some of the previous posts on this forum providing details about the design matrix for a 2 x 2 repeated measures design. You could either directly adopt one of these design matrices and exclude one of your time points, or adapt the design with inclusion of a third time point.

In brief, the design matrix would include a separate column for each subject, where a 1 is placed in each row pertaining to the subject, and zero elsewhere. Two columns would be included to model two of the time points (It doesn't matter which of the two time points that you model). And an additional two columns would be included to model the interaction between time and group.

Andrew

*Originally posted by Álvaro Deleglise:*Dear Andrew,

Thanks in advance for your help.

I'm currently working with funcional data of a within-subjects design longitudinal experiment. I have 21 subjects who performed 2 differents tasks A & B in two different weeks, and for each subject I have 6 resting-state scans (1 session before performing any of the two tasks, 1 session 30 minutes later after performing the task for the first time, and 1 session 24 hs after performing the task). In brief, I have 2 conditions with 3 times points each. The main objective of the study is to identify the specific funcional signatures of one of these two task on resting-state networks.

For each task, I've independently ran paired samples t-test on each network edge (≈8000) to compare the baseline vs the 30 min, the baseline vs the 24 hs, and the 30 min vs the 24 hs session, but I'm not sure if this approach is adequate for the study design. So now I was thinking to perform a NB statistical analysis including all the data at once (accounting for the withing-subject and longitudinal nature of the design) but I'm a little bit lost about the way the "design matrix" and "contrast" should look like for my dataset. Can you please help me with this? I'm interesed in main effect of task type and the interaction between task * time, and more specifically, in identifying the edges that present a difference in strength. For example, when I've ran the related samples t-test on each edge comparing the baseline vs the 30 min data of one particular task, I founded a network composed of 18 edges that presented a significant difference between both sessions. Can the NBS tool also localize and supply this kind of results where comparing the three sessions of both tasks at once?

Cheers,

A.D.

Thanks in advance for your help.

I'm currently working with funcional data of a within-subjects design longitudinal experiment. I have 21 subjects who performed 2 differents tasks A & B in two different weeks, and for each subject I have 6 resting-state scans (1 session before performing any of the two tasks, 1 session 30 minutes later after performing the task for the first time, and 1 session 24 hs after performing the task). In brief, I have 2 conditions with 3 times points each. The main objective of the study is to identify the specific funcional signatures of one of these two task on resting-state networks.

For each task, I've independently ran paired samples t-test on each network edge (≈8000) to compare the baseline vs the 30 min, the baseline vs the 24 hs, and the 30 min vs the 24 hs session, but I'm not sure if this approach is adequate for the study design. So now I was thinking to perform a NB statistical analysis including all the data at once (accounting for the withing-subject and longitudinal nature of the design) but I'm a little bit lost about the way the "design matrix" and "contrast" should look like for my dataset. Can you please help me with this? I'm interesed in main effect of task type and the interaction between task * time, and more specifically, in identifying the edges that present a difference in strength. For example, when I've ran the related samples t-test on each edge comparing the baseline vs the 30 min data of one particular task, I founded a network composed of 18 edges that presented a significant difference between both sessions. Can the NBS tool also localize and supply this kind of results where comparing the three sessions of both tasks at once?

Cheers,

A.D.

Feb 25, 2021 02:02 PM | Álvaro Deleglise

RE: Within-subjects design longitudinal analysis with three time points.

Hi again Andrew,

First of all, thank you very for your help.

Here I attach a file containing the design matrix that I have constructed for modeling only two time points. Could you please tell me if it is correct? MSL and CTL are the two taks, "ses" designates the corresponding session/time point, and "su" designates the corresponding subject.

I'm using the following constrasts:

-to test for task: [1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

-to test for session/time point: [0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

-to test the interaction between task and session: [0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

Finally, given that it is a within-subjects design, I have set the exchange blocks as follows (remember that I have 21 subjects):

[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21] Is this correct?

By the other hand, could you please show me in with a little example how the design matrix should look like for the case when modeling the three time points? I would really appreciate it.

Again, thank you so much in advance.

First of all, thank you very for your help.

Here I attach a file containing the design matrix that I have constructed for modeling only two time points. Could you please tell me if it is correct? MSL and CTL are the two taks, "ses" designates the corresponding session/time point, and "su" designates the corresponding subject.

I'm using the following constrasts:

-to test for task: [1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

-to test for session/time point: [0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

-to test the interaction between task and session: [0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

Finally, given that it is a within-subjects design, I have set the exchange blocks as follows (remember that I have 21 subjects):

[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21] Is this correct?

By the other hand, could you please show me in with a little example how the design matrix should look like for the case when modeling the three time points? I would really appreciate it.

Again, thank you so much in advance.

Feb 27, 2021 05:02 AM | Andrew Zalesky

RE: Within-subjects design longitudinal analysis with three time points.

Hi Alvaro,

I suspect that your design matrix is not full rank and will produce a rank deficiency warning. Did you get a warning?

If so, you will need to remove the task column. I assume that the task remains that the same between the two time points.

Your design matrix should therefore comprise the main effect of time, the interaction between time and task, and the individual columns for each subject. But not the main effect of task.

If the task is the same for the two time points, you can test for the main effect of task by averaging the data for two time points and using the averaged data in a separate model. No need for multiple time points to assess the task effect.

The three time points is more complex. Perhaps focus on getting the simpler case working correctly.

Best wishes,

Andrew

I suspect that your design matrix is not full rank and will produce a rank deficiency warning. Did you get a warning?

If so, you will need to remove the task column. I assume that the task remains that the same between the two time points.

Your design matrix should therefore comprise the main effect of time, the interaction between time and task, and the individual columns for each subject. But not the main effect of task.

If the task is the same for the two time points, you can test for the main effect of task by averaging the data for two time points and using the averaged data in a separate model. No need for multiple time points to assess the task effect.

The three time points is more complex. Perhaps focus on getting the simpler case working correctly.

Best wishes,

Andrew

*Originally posted by Álvaro Deleglise:*Hi again Andrew,

First of all, thank you very for your help.

Here I attach a file containing the design matrix that I have constructed for modeling only two time points. Could you please tell me if it is correct? MSL and CTL are the two taks, "ses" designates the corresponding session/time point, and "su" designates the corresponding subject.

I'm using the following constrasts:

-to test for task: [1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

-to test for session/time point: [0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

-to test the interaction between task and session: [0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

Finally, given that it is a within-subjects design, I have set the exchange blocks as follows (remember that I have 21 subjects):

[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21] Is this correct?

By the other hand, could you please show me in with a little example how the design matrix should look like for the case when modeling the three time points? I would really appreciate it.

Again, thank you so much in advance.

First of all, thank you very for your help.

Here I attach a file containing the design matrix that I have constructed for modeling only two time points. Could you please tell me if it is correct? MSL and CTL are the two taks, "ses" designates the corresponding session/time point, and "su" designates the corresponding subject.

I'm using the following constrasts:

-to test for task: [1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

-to test for session/time point: [0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

-to test the interaction between task and session: [0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

Finally, given that it is a within-subjects design, I have set the exchange blocks as follows (remember that I have 21 subjects):

[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21] Is this correct?

By the other hand, could you please show me in with a little example how the design matrix should look like for the case when modeling the three time points? I would really appreciate it.

Again, thank you so much in advance.

Mar 1, 2021 11:03 AM | Álvaro Deleglise

RE: Within-subjects design longitudinal analysis with three time points.

Hi again Andrew,

I didn't get any rank deficiency warning using the design matrix I attached to you in the last message, so I assume it's ok. However, I will follow your advice and remove the task column and assess the task effect in a separate model by using the averaged data of each subject for the two time points. Hope it work. As you said, the two different tasks (MSL and CTL in the attached file) are the same in the two time points.

By the other hand, given that you didn't mention anything regarding the contrasts and the exchange blocks vectors, I assume they are ok.

Thanks you very much for your time and help!

A. D.

I didn't get any rank deficiency warning using the design matrix I attached to you in the last message, so I assume it's ok. However, I will follow your advice and remove the task column and assess the task effect in a separate model by using the averaged data of each subject for the two time points. Hope it work. As you said, the two different tasks (MSL and CTL in the attached file) are the same in the two time points.

By the other hand, given that you didn't mention anything regarding the contrasts and the exchange blocks vectors, I assume they are ok.

Thanks you very much for your time and help!

A. D.

Mar 2, 2021 12:03 AM | Andrew Zalesky

RE: Within-subjects design longitudinal analysis with three time points.

Ok - if there was no rank deficiency
warning, perhaps I have simply misinterpreted the
design.

Here is a previous post, where I discuss this issue in detail:

Here is a link to some nice slides on modelling a 2x2 repeated measures (slides 78-79):

http://mumford.bol.ucla.edu/setting_up_d...

Here are some detailed instructions:

Suppose the data is order according to the following rows (2 groups, 2 time points, 2 subjects per group):

Group 1 Time 1 Subject 1

Group 1 Time 1 Subject 2

Group 1 Time 2 Subject 1

Group 1 Time 2 Subject 2

Group 2 Time 1 Subject 3

Group 2 Time 1 Subject 4

Group 2 Time 2 Subject 3

Group 2 Time 2 Subject 4

The your design matrix would look like:

1 0 0 0 1 1

0 1 0 0 1 1

1 0 0 0 -1 -1

0 1 0 0 -1 -1

0 0 1 0 1 -1

0 0 0 1 1 -1

0 0 1 0 -1 1

0 0 0 1 -1 1

Where the first four columns model the individual means of each subject, the 5th column models the main effect of time and the 6th column models the group x time interaction.

The contrast for the main effect of time is either: [0 0 0 0 1 0] or [0 0 0 0 -1 0]

The contrast for the interaction is: [0 0 0 0 0 1] or [0 0 0 0 0 -1]

The exchange block should be set as: [1 2 1 2 3 4 3 4]

Select either t-test of F-test, as appropriate.

If you want to test the main effect of group, then a repeated measures design is not particularly useful and can be eliminated. For example you can average across the two time points per subject and perform a two sample t-test, or perform a one-sample test on the difference.

Best wishes,

Andrew

Here is a previous post, where I discuss this issue in detail:

Here is a link to some nice slides on modelling a 2x2 repeated measures (slides 78-79):

http://mumford.bol.ucla.edu/setting_up_d...

Here are some detailed instructions:

Suppose the data is order according to the following rows (2 groups, 2 time points, 2 subjects per group):

Group 1 Time 1 Subject 1

Group 1 Time 1 Subject 2

Group 1 Time 2 Subject 1

Group 1 Time 2 Subject 2

Group 2 Time 1 Subject 3

Group 2 Time 1 Subject 4

Group 2 Time 2 Subject 3

Group 2 Time 2 Subject 4

The your design matrix would look like:

1 0 0 0 1 1

0 1 0 0 1 1

1 0 0 0 -1 -1

0 1 0 0 -1 -1

0 0 1 0 1 -1

0 0 0 1 1 -1

0 0 1 0 -1 1

0 0 0 1 -1 1

Where the first four columns model the individual means of each subject, the 5th column models the main effect of time and the 6th column models the group x time interaction.

The contrast for the main effect of time is either: [0 0 0 0 1 0] or [0 0 0 0 -1 0]

The contrast for the interaction is: [0 0 0 0 0 1] or [0 0 0 0 0 -1]

The exchange block should be set as: [1 2 1 2 3 4 3 4]

Select either t-test of F-test, as appropriate.

If you want to test the main effect of group, then a repeated measures design is not particularly useful and can be eliminated. For example you can average across the two time points per subject and perform a two sample t-test, or perform a one-sample test on the difference.

Best wishes,

Andrew

*Originally posted by Álvaro Deleglise:*Hi again Andrew,

I didn't get any rank deficiency warning using the design matrix I attached to you in the last message, so I assume it's ok. However, I will follow your advice and remove the task column and assess the task effect in a separate model by using the averaged data of each subject for the two time points. Hope it work. As you said, the two different tasks (MSL and CTL in the attached file) are the same in the two time points.

By the other hand, given that you didn't mention anything regarding the contrasts and the exchange blocks vectors, I assume they are ok.

Thanks you very much for your time and help!

A. D.

I didn't get any rank deficiency warning using the design matrix I attached to you in the last message, so I assume it's ok. However, I will follow your advice and remove the task column and assess the task effect in a separate model by using the averaged data of each subject for the two time points. Hope it work. As you said, the two different tasks (MSL and CTL in the attached file) are the same in the two time points.

By the other hand, given that you didn't mention anything regarding the contrasts and the exchange blocks vectors, I assume they are ok.

Thanks you very much for your time and help!

A. D.