Hi Laura In the wikihttps://surfer.nmr.mgh.harvard.edu/fswiki/LinearMixedEffectsModelswe recommended to order the columns of the design matrix in thefollowing way: Column 1: theintercept term (which is a column of ones) Colum 2: the timecovariate if it varies across subjects (eg. time from baseline) Column 3-q: anytime-varying covariates (eg. training: 0 before training, 1 aftertraining) Column q+1-r: thegroup covariates of interest (eg. a binary variable indicatingwhether or not the subject is a patient), for n groups you will haven-1 binary covariates Column r+1-s:interactions between group covariates with the time-varyingcovariates (only the interesting interactions) Column s+1-p: anyother nuisance time-invariant covariates (eg. age-at-baseline, gender,etc...)
LME is a type oflinear regression model that integrates both a model for the mean anda model for the covariance into a single statistical model. So ifyou want to compare different models for the mean (with differentcovariates) then you need to start with a “maximal model for themean” that includes all the possible covariates of interest. Then you selectthe random effects for that "maximal model" using the model selectionprocedure with lme_mass_LR. Random effects can only be time-varyingcovariates (i.e a subset of the columns from 1 to q above, thosecomprise the Zcols parameter in lme_mass_fit_vw) After you choosewhich time-varying covariates are going to be considered as randomeffects then you can test if any single fixed effects covariate in your designmatrix has a significant contribution to the model in the same wayyou would for a traditional GLM. You will use F-tests for that.Covariates that do not significantly contribute to the model can beruled out of the model and a new model with less covariates but the same random effects can thenbe fitted. Keep in mind thatfitting lme models is computationally expensive and the computationoverhead quickly increases with the number of random effects and fixedeffects in your model. Also considering one or two random effects including the intercept term (or atmost three) is usually enough but this really depends on the natureof the data. Best-Jorge De: Laura Rueda Delgado <laura.ruedadelg...@kuleuven.be> Para: Freesurfer support list <freesurfer@nmr.mgh.harvard.edu> Enviado: Lunes 11 de abril de 2016 13:05 Asunto: Re: [Freesurfer] LME for functional data, 3 factors #yiv9346679664 #yiv9346679664 -- _filtered #yiv9346679664 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;} _filtered #yiv9346679664 {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;} _filtered #yiv9346679664 {font-family:Consolas;panose-1:2 11 6 9 2 2 4 3 2 4;}#yiv9346679664 #yiv9346679664 p.yiv9346679664MsoNormal, #yiv9346679664 li.yiv9346679664MsoNormal, #yiv9346679664 div.yiv9346679664MsoNormal {margin:0cm;margin-bottom:.0001pt;font-size:11.0pt;color:black;}#yiv9346679664 a:link, #yiv9346679664 span.yiv9346679664MsoHyperlink {color:blue;text-decoration:underline;}#yiv9346679664 a:visited, #yiv9346679664 span.yiv9346679664MsoHyperlinkFollowed {color:purple;text-decoration:underline;}#yiv9346679664 pre {margin:0cm;margin-bottom:.0001pt;font-size:10.0pt;color:black;}#yiv9346679664 span.yiv9346679664EmailStyle17 {color:windowtext;}#yiv9346679664 span.yiv9346679664HTMLPreformattedChar {font-family:Consolas;color:black;}#yiv9346679664 span.yiv9346679664EmailStyle20 {color:#1F497D;}#yiv9346679664 .yiv9346679664MsoChpDefault {font-size:10.0pt;} _filtered #yiv9346679664 {margin:70.85pt 70.85pt 70.85pt 70.85pt;}#yiv9346679664 div.yiv9346679664WordSection1 {}#yiv9346679664 Dear Martin, Thank you for your quick response. My research question is focused on the group and day effect, so I could simplify the model. From your response, I thought of including in the design matrix the binary code for Condition 2, and for Condition 3 in two columns, like you suggested; however, adding only the interaction effect of group and day. This way, the model takes into account the repeated measures of Condition while remaining relatively simple. Now, to add more complexity and be more specific, I'm interested on neural correlates of learning, which is (un)fortunately tangled with performance. Therefore, I was thinking to add the learning gains (e.g. [performance_day_2 - performance_day_1]/performance_day_1) as a fixed effect. Checking the example datasets that come with the LME toolbox, I see that other measures (e.g. age, gender) are repeated for all the measures at different days of the same subject. And, when the age of participants at the first measurement is used as a fixed effect, "baseline age", the value is repeated for the baseline day and the other days. I was wondering if this could be applied for the Learning Gain as well (which is a measure of change of performance over the training days). I have my doubts because I would understand that this type of coding would describe two mixed aspects: a “prediction” of Gain from the brain data at Day 1, along with the appropriate relationship of Gain with brain data at Day 2. I would think that adding 0s for Day 1 in the variable Gain would be more appropriate, and this way the fixed effect of Day would be coded in the variable Gain. But of course, I recur to the experts to settle this issue. Additionally, I see that I could compare two models with different number of random effects with lme_mass_LR. However, I would like to compare models with different covariates (other covariates of no interest, like gender and years of education). Is this possible within this toolbox? Best regards, Laura Rueda From: freesurfer-boun...@nmr.mgh.harvard.edu [mailto:freesurfer-boun...@nmr.mgh.harvard.edu]On Behalf Of Martin Reuter Sent: donderdag 7 april 2016 18:20 To: freesurfer@nmr.mgh.harvard.edu Subject: Re: [Freesurfer] LME for functional data, 3 factors Hi Laura, 1) you would need to model the 3 level variable differently, as 1,2,3 will be understood as continuous and that is not what you want. Instead you have two columns: one column for group 2, where all instances are binary (1 if group is 2, else 0), and one for group 3. Then the intercept and slope will be for group 1 and these columns contain the offsets for group 2 and 3 respectively. About interactions, make sure you really want to model all interactions. Some may be not very meaningful and keeping the model simple is usually a good idea. But if you want them all, add them all. 2) Zcols: Vector with the indices of the colums of X that will be considered as random effects. Usually the intercept is a random effect and maybe other variables (e.g. the time, if you want to allow slopes to be different across subjects). For just the intercept column use [ 1] ni should be correct 3) yes, but with the design above, since you model a global intercept and then the offset of each group (or whatever that three condition variable is) you need to make sure you interpret things correctly. E.g. a 1 in such a column for group 2 or three indicates that there is a difference from the first group. This is not the group 2 effect. 4) Sorry, I don't know. Maybe someone else has a suggest. Since you have all interactions, you should be able to specify contrast according to your test in this model and don't need to create a new one. Your setup is a little complicated, so it would be wise to involve a local statistician to make sure you are interpreting things correctly. Best, Martin On 04/07/2016 10:57 AM, Laura Rueda Delgado wrote: Dear FreeSurfers and LME experts, I've just started using the LME toolbox by Bernal-Rusiel et al (2012, 2013) in Matlab, apart from FreeSurfer. My experimental design includes one between-subjects factor (group with two levels, 24 vs 22 subjects), and two within-subjects (WS) factors (day with two levels, and condition with three levels). As far as I understand, the LME toolbox can be used for longitudinal data and for investigating modulations of neural activity with behavioral measures. However, it's been difficult for me to set up both the design matrix and the input of the LME functions given three fixed factors in my design (I haven't included behavior yet). So I have a few questions that I hope you can help me answer. I follow these steps: 1) Following the wiki, I've created a pre-design matrix, M, with: First column: Day factor coded as 0 (first day) and 7 (7 days later, as during acquisition). Second column: Group factor binary coded. Third column: Condition factor coded with dummy variables 1 to 3 (three conditions in total). I don’t know if this is correct; I have failed to find in the mailing list any reference to an additional repeated measure besides time in LME models. From here, I've created the design matrix X adding a column of 1's for the intercept, adding the pre design matrix M, and adding columns for every possible interaction by multiplying element-wise the columns of M (including two-way and three-way interactions). 2) I then use lme_mass_fit_vw, but I have doubts about some inputs Zcols: column 1 in X ni: created a vector with 6 for all subjects (in total there are 6 repeated measures, 2 of day and 3 of condition) I kept the others as default. 3) lme_mass_F for statistics of fixed effects. I check main effects and interactions with contrasts based on the design matrix X: placing a 1 in the column position corresponding to each effect of interest. 4) lme_mass_FDR2 for correcting the F stats for multiple comparisons. I would like to compare the results using AlphaSim's Monte-Carlo simulations, however I'm not sure what image to use to estimate the smoothness. Would you have a suggestion? Could you please let me know if this procedure is sound? Also, if I’m interested in specific comparisons or post-hoc tests, e.g. Group 1$Day 1$Condition 3 vs. Group 1$Day 2$Condition 3, would I need a separate model for that? And lastly, for the analysis including the behavioral measures, should I just include them as a forth column in the pre-design matrix M and add the relevant effects in X? I hope I haven’t overwhelmed you with so many questions. I would greatly appreciate any suggestion you can provide. Best regards, Laura Rueda _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer -- Martin Reuter, PhD Assistant Professor of Radiology, Harvard Medical School Assistant Professor of Neurology, Harvard Medical School A.A.Martinos Center for Biomedical Imaging Massachusetts General Hospital Research Affiliate, CSAIL, MIT Phone: +1-617-724-5652 Web : http://reuter.mit.edu _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
_______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.