To: freesurfer@nmr.mgh.harvard.edu
From: mreuter@nmr.mgh.harvard.edu
Date: Tue, 20 Oct 2015 09:06:53 -0400
Subject: Re: [Freesurfer] A mixed effect model approach in within subject dataset {Disarmed} {Disarmed}
Hi Pablo,
the zero columns could be outside the cortex and then this would be
fine. Do
min(sum(lhY(:,lhcortex)))
if you get 0 you have at least one location where the column is all
zero (as we should not have any negative values, you can test that
with min(lhY(:))
Now even if you still have a column of 0 , then that vertex is
problematic, but who cares about a single vertex. If you do a region
approach, it will be part of a region anyway. so you should check
how often you get 0 columns (inside cortex).
About your M: I would subtract 1 from gender (to have 0 and 1)
Also you only need 2 columns for the groups: keep only column 3 and
4. A HC is someone who has 0 in both.
Best, Martin
On 10/20/2015 04:37 AM, pablo najt
wrote:
Dear FS experts,
I am following up on an issue I am having when trying to
run linear mixed effects model. I keep getting 'Algorithm did
not converge'.
So far I have changed the preprocessing steps following
literally from the wiki as in message below. Also I tried to
use only one random effect for the intercept. Also I have
checked that sum of vectors of (ni) is equal to the number of rows
in (X).
As none of the above worked
I started to have concerns about the dimensions of my
lh.thickness_sm10.mgh. When I load in matlab in working
space says 'too many variables'. Is this ok?
Also, when I open 'lhY' variable it shows a column of Zeros
every nine columns as below. Is this alright?
Perhaps this is fine but I would like to check on anything
that is creating this problem. For matrix 'M' I created a
matlab script that loads a matrix with intercept (all ones),
HC (ones to HC otherwise zero), U_PT (relatives of patients
ones otherwise zero), PT (patients one otherwise zero),
gender, age (see below). The three columns for groups do not
match the qdec.table.dat which
have only one column for groups (HC, U_PT, PT). However the order of the rows is identical in
M and qdec.table.dat
Please let me know if this should be set differently.
Thank you
Pablo
To:
freesurfer@nmr.mgh.harvard.edu
From:
mreuter@nmr.mgh.harvard.edu
Date: Mon, 19 Oct 2015 09:00:57 -0400
Subject: Re: [Freesurfer] A mixed effect model approach in
within subject dataset {Disarmed}
Hi Pablo,
since you did not run this through the longitudinal stream,
you won't have a base ( or subject-template), also you won't
have <tpid>.long.<base> directories, so the
first command should fail. For that you simply replace the
--qdec-long with --qdec and use the same table. Should work.
The second command is fine (it just smoothes the thickness
stack).
Best, Martin
On 10/19/2015 06:51 AM,
pablo najt wrote:
Hi Jorge and FS experts,
I have run again the analysis and still get the
convergence problem.
I am assuming the issue has to do with the
preprocessing steps, as I had doubts on how to follow
from the instructions if I am not using qdec and have
a cross sectional design.
Instructions on lme in the wiki for preprocessing
specify the following:
mris_preproc --qdec-long qdec.table.dat --target study_average --hemi lh --meas thickness --out lh.thickness.mgh
mri_surf2surf --hemi lh --s study_average --sval lh.thickness.mgh --tval lh.thickness_sm10.mgh --fwhm-trg 10 --cortex --noreshape
My data -as I explained below- is cross section
but I want to treat it as longitudinal as I want to
analyse subjects belonging to the same family.
Here is my 2 main questions:
1) for preprocessing should I follow
instructions as it would be longitudinal data?
2) Although my design does not allow using
qdec (3 groups) do I still create a qdec table and
follow literally the two instructions above ?
Thank you
Pablo
____________________________________________________________________________________________________________________________________
Date: Fri, 16 Oct 2015 16:24:36 +0000
From:
jbernal0019@yahoo.es
To:
freesurfer@nmr.mgh.harvard.edu
CC:
pablonajt@hotmail.com
Subject: Re: [Freesurfer] A mixed effect model
approach in within subject dataset {Disarmed}
Hi
Pablo
Yes, too many locations at which the
estimation algorithm didn't converge is
problematic. That might mean that having two
random effects is not appropriate for your data.
You should try to run the command with just a
single random effect for the intercept term:
lhstats = lme_mass_fit_vw(X, [1], lhY,
ni, lhcortex, [], 4);
If the result still have too many
non-convergence locations then something might
be wrong with the ordering of the design matrix
and its correspondence with the ordering of the
ni vector or the ordering of the image data
etc... You will need to check it thoroughly.
Cheers
-Jorge
Thanks you for the
replies.
Jorge and FS experts,
I have run the analysis and
first double checked that the sum
of vectors of (ni) is equal to the
number of rows in (X). Both are
140 which is the number of my
subjects.
The analysis gave the following
'error'(?) below:
I looked up a previous thread
coming across this. At that case
you recommended
Would you recommend this
afain>
Aproximate
percentage of fitted
locations: 100%
Warning: matlabpool will
be removed in a future
release.
To query the size of an already
started parallel pool, query
the 'NumWorkers'
To check if a pool is
already started use
'isempty(gcp('nocreate'))'.
Warning: matlabpool will
be removed in a future
release.
To shutdown a parallel
pool use
'delete(gcp('nocreate'))'
instead.
Parallel pool using the
'local' profile is shutting
down.
Algorithm did not
converge at 90.0637 percent
of the total number of
locations.
Total elapsed time is
550.1023 minutes.
Also
almost all the time the screen
showed the following message:
144114:
Algorithm did not
converge. Initial and
final likelihoods:
-38.3408-1.5708i,
-241.4153-1.570796i.
Location 144113:
Algorithm did not
converge. Initial and
final likelihoods:
-5.5424-1.5708i,
-133.8004-1.570796i.
Location 144112:
Algorithm did not
converge. Initial and
final likelihoods:
-7.7571-1.5708i,
-319.1378-1.570796i.
Location
144111: Algorithm did not
converge. Initial and
final likelihoods:
-16.8597-1.5708i, 0.74448.
Aproximate percentage
of fitted locations: 100%
So my two questions are:
1. Is this problematic?
2. Are there any fixes to
this issue?
Thank
you,
Pablo
Date:
Thu, 15 Oct 2015 13:38:22 +0000
From:
jbernal0019@yahoo.es
To:
freesurfer@nmr.mgh.harvard.edu
CC:
pablonajt@hotmail.com
Subject: Re: [Freesurfer] A
mixed effect model approach in
within subject dataset
{Disarmed}
Hi Pablo
The
error you are getting is
because in your Matlab
setup you can only request
a maximum of 4 matlab
parallel workers and by
default lme requests 8. So
you just need to modify
your command like this:
lhstats
= lme_mass_fit_vw(X, [1
2], lhY, ni, lhcortex, [],
4);
Please
make sure that sum(ni) and
length(X) give the same
value before running the
above command.
Cheers
-Jorge
Thank
you Martin.
I
am trying to
run the
following
command line
and get the
error below.
Would you have
a suggestion
to overcome
this issue?
Just
in case I am
also including
a snapshot of
my loaded
variables at
the bottom.
Many
thanks,
Pablo
>>
lhstats =
lme_mass_fit_vw(X,
[1 2], lhY,
ni, lhcortex);
Warning:
matlabpool
will be
removed in a
future
release.
To
query the size
of an already
started
parallel pool,
query the
'NumWorkers'
To
check if a
pool is
already
started use
'isempty(gcp('nocreate'))'.
Warning:
matlabpool
will be
removed in a
future
release.
To
query the size
of an already
started
parallel pool,
query the
'NumWorkers'
To
check if a
pool is
already
started use
'isempty(gcp('nocreate'))'.
Warning:
matlabpool
will be
removed in a
future
release.
Starting
matlabpool
using the
'local'
profile ...
Error
using
matlabpool
(line 148)
Failed
to start a
parallel pool.
(For
information in
addition to
the causing
error,
validate
the profile
'local' in the
Cluster
Profile
Manager.)
Error
in
lme_mass_fit
(line 128)
Error
in
lme_mass_fit_vw
(line 73)
[stats1,st1]
=
lme_mass_fit(X,[],Xrows,Zcols,Y,ni,prs,e);
Error using
parallel.internal.pool.InteractiveClient/start
(line 330)
Error using
parallel.Job/submit
(line 304)
You
requested a
minimum of 8
workers, but
the cluster
"local" has
the
NumWorkers
property set
to allow a
maximum of 4
workers. To
run a
communicating
job on more
workers than
this (up to a
maximum of 512
for the
Local
cluster),
increase the
value of the
NumWorkers
property for
the
cluster. The
default value
of NumWorkers
for a Local
cluster is the
number of
cores on the
local machine.
To:
freesurfer@nmr.mgh.harvard.edu
From:
mreuter@nmr.mgh.harvard.edu
Date: Wed, 14
Oct 2015
10:54:41 -0400
Subject: Re:
[Freesurfer] A
mixed effect
model approach
in within
subject
dataset
{Disarmed}
Hi Pablo,
you should run something like this to get the ni:
[M,Y,ni] = sortData(M,1,Y,sID); # (sorts the data)
see
https://surfer.nmr.mgh.harvard.edu/fswiki/LinearMixedEffectsModels
hope that
helps, Martin
On
10/14/2015
10:43 AM,
pablo najt
wrote:
Dear
FS experts.
I have
query about a
relating to a
previous email
(below). I am aiming to run a LME analysis on
cross-sectional
data from
different
families and
have variable
'family'
(number of
families) as
my NI vector.
My design
has three
groups and
therefore I am
not able to
use qdec. I am
running the
matlab
commands below
and finding
some
difficulty
would really
appreciate if
you could help
out.
Thanks
Pablo
Start
analysis as
follows:
1-Read your label eg.:
lhcortex = fs_read_label('freesurfer/subjects/fsaverage/label/lh.cortex.label');
2-Read the data file eg.:
[lhY, lhmri] = fs_read_Y('lh.thickness.mgh');
%---------------------I input the concatenated .mgh image from preproc and mris_surf2surf-----------------------------------------------------------------------%
3-Fit a vertex-wise lme model with random effects.:
lhstats = lme_mass_fit_vw(X, [1 2], lhY, ni, lhcortex);
Here I am getting the following problems:
%-------------------- If I use number of families as my ni get the following------------------------------------------------------------------------------------------------%
lhstats = lme_mass_fit_vw(X, [1 2], lhY, 82, lhcortex);
Error using lme_mass_fit (line 108)
The total number of measurements, indicated by sum(ni), mustbe the same as the number of rows of the design
Error in lme_mass_fit_vw (line 73)
[stats1,st1] = lme_mass_fit(X,[],Xrows,Zcols,Y,ni,prs,e);
My matrix is organised in "family", "group", Sex" and "age" columns".
4-Perform vertex-wise inference eg.:
CM.C = [your contrast matrix];
F_lhstats = lme_mass_F(lhstats, CM);
5-Save results eg.:
fs_write_fstats(F_lhstats, lhmri,' sig.mgh', 'sig');
Date:
Thu, 10 Sep
2015 13:44:36
+0000 From:
jbernal0019@yahoo.es
To:
freesurfer@nmr.mgh.harvard.edu
Subject: Re:
[Freesurfer] A
mixed effect
model approach
in within
subject
dataset
Hi Pablo
I think you can use LME to analyze your data
by ordering
the rows of
your design
matrix
appropriately.
You can
consider all
subjects
belonging to
the same
family as if
they were a
single subject
in a
longitudinal
analysis. You
can put in
your design
matrix all
subjects
belonging to
family1 first,
then all
subjects
belonging to
family 2 and
so on. Then
the 'ni'
required by
lme_mass_fit_vw
is a vector
with the
number of
subjects in
each family as
its entries
(ordered
according to
your design
matrix). So
the length of
the 'ni'
vector is
equal to the
number of
different
families in
your data.
Now you can go further and additionally order
the rows of
your design
matrix within
each family by
age. This will
allow you to
test the
effect of age
within family.
When choosing the random effects for your
statistical
model remember
that a random
effect can
only be the
intercept term
or any
covariate that
varies within
family. For
example you
can compare a
model with a
single random
effect for the
intercept term
against the
same model but
considering
both the
intercept term
and age as
random
effects.
Hope that helps
Cheers
-Jorge
Dear
Freesurfer
users,
I
wanted to
enquire if
anyone had
successfully
been able to
implement
Bernal's
Linear Mixed
Effects (LME)
Models in
cross-section
dataset *not
longitudinal*
(please see
previous
thread below).
I am
willing to
perform a LME
(3 groups (HC,
PT and
Unaffected_relatives)
and 3
covariates
(sex, age, and
family) with
"family"
variable been
a
within-subject
factor.
LME will allow to
control for
the
non-independence
of data
contributed by
patients and
relatives from
the same
families.
Thanks
in advance!
Pablo
From:
michaelnotter@hotmail.com
To:
freesurfer@nmr.mgh.harvard.edu
Date: Wed, 19
Feb 2014
13:10:09 +0100
Subject:
[Freesurfer]
Analysis of
structural
data acquired
from multiple
sites by using
a mixed effect
model approach
Hi
everybody, I
want to
compare the
surface data
of 3 groups
(GroupA,
GroupB and
Controlls) but
have the
problem that
they were
acquired from
4 different
scanner sites.
As I can see
it, there are
three ways how
I could tackle
this problem:
1. I could use
mri_glmfit and
create a qdec
table /
fsgd-file with
12 classes:
Class
GroupA_site1;
Class
GroupA_site2,...
And then use
the contrasts
[0.25 0.25
0.25 0.25 0 0
0 0 -0.25
-0.25 -0.25
-0.25] to
compare GroupA
to the
Controlls. My
Problem with
this approach
is, that the
sites don't
contribute the
same amount of
subjects to
the analysis.
I'm not sure
if this could
be handled by
simply using a
weighted
contrast.
Meaning, if
Site1 and
Site2 had
twice as many
subjects than
Site3 and
Site4, I could
modify the
contrast to
[0.33 0.33
0.17 0.17 0 0
0 0 -0.33
-0.33 -0.17
-0.17]. 2. I
could create
dummy
variables to
account for
the
variability
between sites.
In this case,
I only need to
specify 3
classes (Class
GroupA; Class
GroupB; Class
Controlls) in
my fsgd-file.
And I use a
design matrix
that has 4
dummy
variables at
the end, which
specify to
which site a
subject
belongs. This
approach might
work, but I'm
not confident
that it is the
right one. 3.
I could use a
mixed effect
model approach
and specify
site as a
random effect.
If I
understand it
correctly, the
mixed effect
model approach
would be the
best one, as
it accounts
for the
variability
within sites.
Is that
correct or are
there other
issues/better
approaches? I
tried to
implement a
mixed effect
model by using
Bernal's
Linear Mixed
Effects (LME)
Models (
http://surfer.nmr.mgh.harvard.edu/fswiki/LinearMixedEffectsModels)
but run into
some problems.
I'm not sure
if LME can
only be
applied on
longitudinal
data or if my
implementation
is wrong. I
have a design
matrix X that
specifies the
characteristics
of each
subject per
row as
follows:
Intercept
GroupA
GroupB
Controll
Age IQ
Site1
Site2
Site3 Site4
1 1 0 0
11.1 99 0 0
1 0 1 0 1
0 11.1 101
0 0 1 0 1 1
0 0 11.4
95 1 0 0 0
1 0 0 1
12.4 100 1 0
0 0 ... As I
have no
repeated
measures, 'ni'
is just a
vector with
length X
containing
'1's. If I do
now the
vertex-wise
linear
mixed-effects
estimation, I
get the
following
output:
>> stats
=
lme_mass_fit_vw(X,[7
8 9
10],Y,ni,lhcortex);
Starting
matlabpool
using the
'local'
profile ...
connected to 8
workers.
Starting model
fitting at
each location
... Location
24994: Index
exceeds matrix
dimensions.
Location
24994:
Algorithm did
not converge.
Initial and
final
likelihoods:
-10000000000,
-10000000000.
Location
62484: Index
exceeds matrix
dimensions.
Location
62484:
Algorithm did
not converge.
Initial and
final
likelihoods:
-10000000000,
-10000000000.
... I've
checked the
matrix
dimensions of
X, Y, ni and
lhcortex and
compared them
to the LME
mass_univariate
example stored
in
ADNI_Long_50sMCI_vs_50cMCI.mat
but couldn't
find any
divergence.
Has anybody
encountered
similar
problems? Is
my approach of
specifying
'ni' as a
vector of'1's
even
legitimate?
Thanks,
Michael
_______________________________________________
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.
_______________________________________________
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
--
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.
_______________________________________________
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
--
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
--
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.