help > RE: Mixed effects model for repeated subjects?
Aug 4, 2021  09:08 PM | Karl Lerud
RE: Mixed effects model for repeated subjects?
Thanks Alfonso. I will try to be concise, hopefully this is clear. I have resting-state BOLD scans, my first-level within-subject contrast is ON vs. OFF stimulation, and my second-level groups are three different types of stimulation, say A, B, and C. I want to ask, for each group, what connectivities are different from zero. The issue is that most subjects contributed multiple sessions, usually to multiple groups as well. So somehow I need to specify which sessions are from which subject, in a generalized way. I sort of felt like I understood how to set this up, until I got to Setup.subjects.groups and I see that this is only nsub long, when it seems like I would need to specify it more like the other variables, like Setup.subjects.groups{nsub}{nses} but maybe there is a different way of doing this.


Hopefully that is clear, thanks,

Karl





Originally posted by Alfonso Nieto-Castanon:
Hi Karl,

Regarding using .json files to specify TR, sorry I have never really tried or seen it used in the context of 3D ANALYZE format files (only with 4d NIFTI) files, but it may have a chance of working by just creating a single .json file using the name of the .img file associated with the first scan (if that does not work, another strategy would be to use spm_file_merge to merge your multiple 3D files into a single 4D file)

And regarding the group variables, perhaps if you let me know the details of your planned analysis I may be able to suggest possible strategies. For general information regarding 2nd-level analyses, including repeated measures designs, perhaps a good way to get started would be http://www.conn-toolbox.org/fmri-methods...

Best
Alfonso
Originally posted by Karl Lerud:
Hi Alfonso, could I bump this, and ask you to specify your recommendations about RT and defining group variables? Thanks again,

Karl









Originally posted by Karl Lerud:
Thanks Alfonso. For the RT values, does that assume that the BOLD image is one 4D image? At the moment my functionals are separate 3D images. Would I need a json file for every image, or would just one work with the same naming convention as the images?

About the sessions and groups, could you be a little more specific about how to script this, and how it would be different than how I have described what I have done so far? What do you mean by defining group variables and using them? Apologies if this is naive, maybe I just don't know what aspects of the setup scripting you are referring to. And/or, can you point me to documentation that describes this kind of multiple session design? Thanks,

Karl










Originally posted by Alfonso Nieto-Castanon:
Hi Karl,

Regarding the question about different TR values for different runs/sessions, one way to do that is by having the TR information directly encoded in your NIFTI functional files. For example, you would enter NaN in the Setup.RT field and then create a .json file associated with each functional NIFTI file (e.g. create a /data/sub-01/run1.json file associated with a /data/sub-01/run1.nii functional file) containing a field named "RepetitionTime" and with the TR value specified in seconds, e.g.:

{
"RepetitionTime": 2.5,
}

Regarding the association between sessions and groups, unless you are planning to do the analyses jointly (and for that you would probably need linear mixed models or other forms of more complex covariance modeling techniques) you would typically define the different group-variables separately, and then select the appropriate ones for each specific analysis. E.g. you may define two groups ('open' and 'closed') associated with eyes-open or eyes-closed conditions during a pure resting state scan, and then use those two group-variables when analyzing that resting-state run, irrespective of what may happen on the same subject on different runs/sessions.

Hope this helps
Alfonso

Originally posted by Karl Lerud:
Like my Setup.RT, I also set up my Setup.subjects.groups to be a cell array of cell arrays corresponding to nsub and nses per subject, but reading conn_batch.m and the documentation, it seems that Setup.subjects.groups is also meant only to be a vector of scalars that assign each subject to one group, implying that all sessions belong to the same group, correct? Same with Setup.RT it seems. If I have subjects participating in multiple groups across their sessions, how would I set this up? And same question for Setup.RT. Thanks,

Karl












Originally posted by Karl Lerud:
For the time being, I am only using sessions with a single RT per subject. Related to this problem, I am also running into an error when setting up the batch. Can you advise what might be causing the following error? I can copy parts of my script if that would help.


Undefined operator '==' for input arguments of type 'cell'.

Error in conn_batch (line 1196)
CONN_x.Setup.l2covariates.values{nsub}{nl2covariates}=(batch.Setup.subjects.groups(nsub)==ngroup);
Error in CONNsetup_mixedEffects (line 352)
conn_batch(conn_x)



Karl




Hi all, I would like to try to bump this again. I am working on a script where many, but not all, subjects have multiple sessions, across different levels of a factor. So I am preparing fields utilizing cell arrays as the documentation says, such as onsets{1}{nsub}{nses} etc. I actually have multiple RT values, even within subjects, so I set Setup.RT in the same way as a cell array, but I get an error that I assume means it expects that to be a vector of doubles. The documentation also says that it is only a vector that is nsub long. So how should I set this up when I need to specify the RT for each individual session? Thanks,
Originally posted by Karl Lerud:
Hi all, can I bump this? I am just wondering how to use the "Sessions" option in the case of multiple sessions per subject, and also in general a mixed effects model with unequal N, different numbers of sessions per subject, subjects participating in different conditions, etc. Thanks, 

Karl

Originally posted by Karl Lerud:
Hello all. I have a fairly simple resting-state functional connectivity analysis that I am doing, where the contrast at the first-level analysis is just a type of stimulation being off or on, let's call these OFF and ON, which alternates several times over the course of each scan. There are several types of this stimulation, which is the group distinction, let's call them A, B, C, D, etc., that I use for second-level group analysis. There are 100 scans in total, comprising the total of A, B, C, etc.

My problem is that I have far fewer than 100 subjects, because many of them contributed multiple scans. Some only contributed one, some may have contributed two to A and one to B, some may have contributed three to C but none to any other condition, etc. How many scans and which conditions they were vary widely subject to subject.

So this sounds like it needs a mixed effects analysis, with subject coded as a random effect, correct? For simplicity in setting up the CONN analysis, I just have each scan as a new "subject" and each "subject" only has one "session". But to do this correctly, would I simply code each scan from the same subject as a new session for that subject, and keep everything else the same? Is it ok that the number of sessions is very unequal from subject to subject, and many (most) have not participated in all conditions A, B, C, etc.? I have all this batch scripted and would like to keep it that way, and I think I see how to do this from the documentation. Thanks,

Karl

Threaded View

TitleAuthorDate
Karl Lerud Jun 15, 2021
Karl Lerud Jun 23, 2021
Karl Lerud Jul 23, 2021
Karl Lerud Jul 26, 2021
Karl Lerud Jul 26, 2021
Alfonso Nieto-Castanon Jul 26, 2021
Karl Lerud Jul 27, 2021
Karl Lerud Jul 29, 2021
Alfonso Nieto-Castanon Jul 29, 2021
RE: Mixed effects model for repeated subjects?
Karl Lerud Aug 4, 2021
Karl Lerud Aug 20, 2021