Hi Cathy

If you only have three groups in your data (Control subjects, High risk patients, Ill patients) then you should drop the “Controls versus all others and controls*time interaction” terms from your design matrix. Otherwise it is ill-conditioned. One way to check your design matrix is by performing a simple univariate analysis using data from a single vertex, eg. at vertex 1000:

lhstats = lme_fit_FS(X,[1 2],Y(:,lhcortex(1000)),ni);

and check the behavior of the optimization procedure. Make sure that both your design matrix X and the cortical thickness data Y are ordered in a way that they contain all the repeated measures for the first subject (ordered by time), then all the repeated measures for the second subject and so on. The first element of the vector ni must indicate the number of repeated measures in the design matrix X for the first subject, the second element of that vector must indicate the number of repeated measures in the design matrix for the second subject and so on. Finally you should include the data Y as an argument of the fitting function:

lhstats = lme_mass_fit_vw(X,[1 2],Y,ni,lhcortex);

This will fit a linear mixed effects model with two random effects (intercept and time).

Best

-Jorge



De: Catherine Bois <C.Bois@sms.ed.ac.uk>
Para: Jorge <jbernal0019@yahoo.es>
CC: freesurfer@nmr.mgh.harvard.edu
Enviado: Lunes 24 de junio de 2013 5:14
Asunto: Re: [Freesurfer] lme issues + failure to converge

Hi,

So, the model we fitted was one with only 1 random effect apparently 
(the intercept term), so we used the script you sent for older 
versions of matlab;

lhstats = lme_mass_fit_vw1(X,[1],ni,lhcortex)

The model took 861 minutes to run, and at the end it now said that the 
model failed to converge at ca 85% of locations...

The matrices columns are as follows; the intercept term, time (I guess 
due to only using one random effect in our model it will be treated as 
a fixed effect by Matlab?), High risk versus all other patients, high 
risk versus time interaction, Controls versus all others, 
controls*time interaction, ill*all others, ill*time interaction, 
Gender, Age. There are ca 170 subjects, with varying and unbalanced 
repeated measures (ranging up to 5/subject).

Since we would like to fit a model with both intercept and time (and 
in the long run) also family as random effects, perhaps we need to use 
the spatiotemporal models instead to make our model converge? If so, 
will the scripts for fitting these in older versions of Matlab be 
available soon?

Have we missed an obvious step which is making our model not converge 
at 85% of the positions?

Thank you for your help,

Best Wishes,

Cathy


X = [ones(length(M),1) M(:,1) Mat(:,1) Mat(:,1).*M(:,1) Mat(:,2)
>> Mat(:,2).*M(:,1) Mat(:,3) Mat(:,3).*M(:,1) M(:,3)-1 M(:,4)];


Quoting Jorge <jbernal0019@yahoo.es> on Fri, 21 Jun 2013 10:42:11 -0700:

> Hi Cathy
>
> You should put a comma between X and [1 2]
>
>> lhstats = lme_mass_fit_vw(X, [1 2],ni,lhcortex);
>
> The model with a single random effect for the intercept term must 
> always converge:
>
>> lhstats = lme_mass_fit_vw(X, [1],ni,lhcortex);
>
>
> Can you tell me with words what the columns of your design matrix 
> are?  How many subjects and how many repeated measures for each 
> subject do you have?
>
> Best
> -Jorge
>
>
>
> Sent from my iPad
>
> On Jun 21, 2013, at 4:53, Catherine Bois <C.Bois@sms.ed.ac.uk> wrote:
>
>> Dear Jorge/freesurfer group,
>>
>> I am using the scripts you sent me that do not require the newer
>> version of matlab, and now using a computer that has the Statistics
>> toolbox. I can get the scripts (with the suffix 1) to run with;
>> lhstats = lme_mass_fit_vw(X[1 2],ni,lhcortex);) however it "fails to
>> reach convergence" at most vertices. We have tried simplifying the
>> model to include only one random effect at a time, however the problem
>> persists. Our design matrix is as follows;
>>
>>  X = [ones(length(M),1) M(:,1) Mat(:,1) Mat(:,1).*M(:,1) Mat(:,2)
>> Mat(:,2).*M(:,1) Mat(:,3) Mat(:,3).*M(:,1) M(:,3)-1 M(:,4)];
>>
>> I have read on the mailing list that non-convergence at some vertices
>> is normal, however what we are getting far exceeds 10%. Any help on
>> this matter would be greatly appreciated!
>>
>> Best Wishes,
>>
>> Cathy
>>
>> --
>> The University of Edinburgh is a charitable body, registered in
>> Scotland, with registration number SC005336.
>>
>>
>> _______________________________________________
>> 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.
>>
>
>



--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer