Hi Alex

This error is likely due to the Qdec variable being empty. So, nothing was read into this variable when you applied

Qdec = fReadQdec('qdec.table.dat');

Please check that. If you don't find a solution to this then send me your Qdec table data file and I will check it out.

Best
-Jorge



De: Alex Hanganu <al.hanganu@yahoo.ca>
Para: jorge luis <jbernal0019@yahoo.es>
CC: FS Mailing List <Freesurfer@nmr.mgh.harvard.edu>
Enviado: Miércoles 5 de diciembre de 2012 13:50
Asunto: Re: [Freesurfer] Longitudinal analysis - contrast

Hi Jorge,

thanks for such a detailed help !!!

Martin explained very well the advantages of this method, so we are working on it now, and we have an Error.

we loaded the lh.thickness_sm10.mgh file, read the surface and label. Then we read the qdec.table.dat.
During the "sids = Qdec(:,1);" cmd we have an error:
"Index exceeds matrix dimensions"

does this mean we have an error in the qdec or fsgd file ? These files seems to be correct.

Thanks !

Sincerely,

Alex.

Le 04/12/2012 8:45 PM, jorge luis a écrit :
Hi Alex
 
I think that your design is very simple and so will be to use our lme tools. There is an example of a mass-univariate analysis on the wiki at http://surfer.nmr.mgh.harvard.edu/fswiki/LongitudinalStatistics. However, the analysis there is much more complex (because of the more complex data) than what you actually need.
 Since you only have two repeated measures your model only requires one random effect for the intercept term (a compound symmetry covariance always hold when there are only two repeated measures). So you don’t have to carry out any model selection procedure. Your design matrix only contains four colums
1- A column of 1s (intercept term)
2- The time covariate (or alternative a variable composed of 0s and 1s indicating whether the measurement occasion is the second time point or not).
3- The group covariate (composed of 0s and 1s indicating group membership)
4- The group by time interaction (the point to point product of the previous second and third covariates).
 Once you have run the Freesurfer’s mris_preproc and mri_surf2surf cmd it is quite easy to read the generated data into Matlab using lme. If you think that it is to difficult to apply the spatiotemporal mixed-effects model at least try the voxel-wise mixed model. It only requires you to run one Matlab function
 lme_mass_fit_vw(X,1,Y,ni,cortex)
were X is your ordered design matrix, Y is the cortical thickness data matrix, ni is 2*ones(36,1) and cortex is your average subject's cortex label.
 
Even that voxel-wise mixed model analysis will perform much better than other approaches (both in power and family wise error).  Then you only need to test if the coefficient for the interaction term is greater than zero with the contrast C=[0 0 0 1] and write your results for visualization in Freesurfer (or you can obtained the anatomical coordinates of the detected clusters usin the mri_surfcluster cmd).
I think that what is called “RepeatedMeasuresAnova” in the wiki is not actually a true repeated measures Anova analysis and in your case (two repeated measures and two groups) it will give you exactly the same results as using the mris_slope cmd.  The only advantage of those methods over the lme tool at the moment is the possibility of using other multiple comparison methods in addition to FDR.
I encourage people to give a try to the lme tools because it will pay good dividends after all, especially for those studies with more than three repeated measures.
Just write to me any doubt you have and I will answer you ASAP.
Best
-Jorge

De: Alex Hanganu <al.hanganu@yahoo.ca>
Para: Martin Reuter <mreuter@nmr.mgh.harvard.edu>
CC: FS Mailing List <Freesurfer@nmr.mgh.harvard.edu>
Enviado: Martes 4 de diciembre de 2012 19:19
Asunto: Re: [Freesurfer] Longitudinal analysis - contrast

Hello Martin,

thanks for the quick reply !

as I understood, from the "LongitudinalTutorial", after long_mris_slopes
the results can be seen for each subject, and in order to see the group
results, all subjects should be analysed in the Qdec, and there I could
see the results for each group, but couldn't do the inter-group, this is
why we tried the "RepeatedMeasuresAnova"

Indeed, there is some difference in the time distance, so we will try
your new idea !

I know about Jorge's work - Marvellous ! but it seems to need too much
time to be comprehended and applied. We hoped to be done with these
results and start already writing the paper :)

Thank you very much for Your help !!!

Sincerely,
Alex.




Le 04/12/2012 6:44 PM, Martin Reuter a écrit :
> Hi Alex,
>
> I am not familiar with the way Doug describes the repeated measure anova
> on the wiki. Of course in a longitudinal setting repeated measures are
> correlated and I am not sure if this is considered in that model there.
>
> Since you have only 2 time points, why not simply compare the difference
> (or weighted by the time distance, if the time points are not the same
> distance apart)?
>
> You would compute (tp2-tp1)/time for each subject and then compare this
> across groups with a standard glm.
> Since in the longitudinal stream both thickness maps are registered, you
> can simply use mris_calc to compute the difference directly.
>
> There are also scripts for this (long_mris_slopes, even for more than 2
> time points, where we fit a line into each subject). See the
> http://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/LongitudinalTutorial
> This is a simple approach, first reducing the variable of interest
> (change across time) to a single number per subject and then running a
> standard test. It should be sufficient for your setting.
>
> You can also do more complex modeling using our new linear mixed effects
> models if you want (see older email from Jorge about that). It considers
> both temporal and spacial correlation of measures. This model is
> especially useful if you have differently many time points and time
> distances  per subject.
>
> Best, Martin
>
>
> On Tue, 2012-12-04 at 18:26 -0500, Alex Hanganu wrote:
>> Dear Freesurfer Experts,
>>
>> We are analysing longitudinal data - the difference between 2 groups (P
>> and M) [19 and 17 subjects] with 2 time points for each group (A, B).
>>
>> We are using the example of "Repeated Measures Anova"
>> (http://surfer.nmr.mgh.harvard.edu/fswiki/RepeatedMeasuresAnova)
>>
>> For our first approach - we took all the subjects - 36 classes, and
>> tried to create the contrast for:
>>
>> P(B-A) - M(B-A)
>> 2 within subject factors, and 2 inter-subject
>>
>> We considered the recent explanations
>> (http://www.mail-archive.com/freesurfer@nmr.mgh.harvard.edu/msg25459.html),
>> and, as we understood, our null hypothesis is:
>>
>> PB-PA=0 AND MB-MA=0 ->
>> Combining: PB-PA-MB+MA=0
>>
>> and the matrix seems to be:
>> 0 0 0 .... (36 zeros) -1
>> 0 0 0 .... (36 zeros) 1
>> 0 0 0 .... (36 zeros) 1
>> 0 0 0 .... (36 zeros) -1
>>
>> but we still get a dimension mismatch between X and C: X has 72, C has 37.
>>
>> The fsgd file is like this:
>> Class subject 1
>> .
>> .
>> .
>> Class subject 36
>> Variables                            TP1-vs-TP2
>> Input groupPsubj1-A    Subject1    -1
>> Input groupPsubj1- B  Subject1    1
>> Input groupPsubj2-A    Subject2    -1
>> .
>> .
>> .
>> Input groupMsubj35-A    Subject35    1
>> Input groupMsubj35-B    Subject35    -1
>> Input groupMsubj36-A    Subject36  1
>> Input groupMsubj36-B    Subject36  -1
>>
>> ==============
>>
>> Our second approach - we run mris_glmfit for each group separately and
>> then we wanted to use mris_calc to compute the difference:
>>
>> mris_calc -o avg.mgh groupP/glm-dir/Contrast/sig.mgh add
>> groupM/glm-dir/Contrast/sig.mgh
>>
>> though the sig.mgh for each group shows significant results, the avg.mgh
>> reveals no effect.
>>
>> Can you please help with this analysis ?
>>
>> Thanks!
>>
>> Sincerely,
>> Alex.
>> ____________________



_______________________________________________
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.