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
De: pablo najt pablonajt@hotmail.com Para: "freesurfer@nmr.mgh.harvard.edu" freesurfer@nmr.mgh.harvard.edu Enviado: Viernes 16 de octubre de 2015 1:43 Asunto: Re: [Freesurfer] A mixed effect model approach in within subject dataset {Disarmed}
#yiv7275178360 #yiv7275178360 --.yiv7275178360hmmessage P{margin:0px;padding:0px;}#yiv7275178360 body.yiv7275178360hmmessage{font-size:12pt;font-family:Calibri;}#yiv7275178360 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 recommendedWould 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'property of the pool.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. Summary: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
De: pablo najt pablonajt@hotmail.com Para: Freesurfer support list freesurfer@nmr.mgh.harvard.edu Enviado: Jueves 15 de octubre de 2015 7:18 Asunto: Re: [Freesurfer] A mixed effect model approach in within subject dataset {Disarmed}
#yiv7275178360 #yiv7275178360 --.yiv7275178360ExternalClass #yiv7275178360ecxyiv7790603773 body.yiv7275178360ecxyiv7790603773hmmessage {font-size:12pt;font-family:Calibri;}#yiv7275178360 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'
property of the pool.
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'
property of the pool.
To check if a pool is already started use 'isempty(gcp('nocreate'))'.
Warning: matlabpool will be removed in a future release.
Use parpool instead.
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)
matlabpool(prs);
Error in lme_mass_fit_vw (line 73)
[stats1,st1] = lme_mass_fit(X,[],Xrows,Zcols,Y,ni,prs,e);
Caused by:
Error using parallel.internal.pool.InteractiveClient/start (line 330)
Failed to start pool.
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:
#yiv7275178360 #yiv7275178360 --.yiv7275178360ExternalClass #yiv7275178360ecxyiv7790603773 .yiv7275178360ecxyiv7790603773ExternalClass body.yiv7275178360ecxyiv7790603773ecxhmmessage {font-size:12pt;font-family:Calibri;}#yiv7275178360 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
matrix X
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 +0000From: jbernal0019@yahoo.esTo: freesurfer@nmr.mgh.harvard.eduSubject: Re: [Freesurfer] A mixed effect model approach in within subject datasetHi PabloI think you can useLME to analyze your data by ordering the rows of your design matrixappropriately. You can consider all subjects belonging to the samefamily as if they were a single subject in a longitudinal analysis.You can put in your design matrix all subjects belonging to family1first, 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 ofsubjects in each family as its entries (ordered according to yourdesign matrix). So the length of the 'ni' vector is equal to thenumber of different families in your data. Now you can gofurther and additionally order the rows of your design matrix withineach family by age. This will allow you to test the effect of agewithin family. When choosing therandom effects for your statistical model remember that a randomeffect can only be the intercept term or any covariate that varieswithin family. For example you can compare a model with a singlerandom effect for the intercept term against the same model butconsidering both the intercept term and age as random effects.Hope that helpsCheers-Jorge De: pablo najt pablonajt@hotmail.com Para: "freesurfer@nmr.mgh.harvard.edu" freesurfer@nmr.mgh.harvard.edu Enviado: Jueves 10 de septiembre de 2015 8:07 Asunto: [Freesurfer] A mixed effect model approach in within subject dataset #yiv7275178360 #yiv7275178360 --.yiv7275178360ExternalClass #yiv7275178360ecxyiv7790603773 .yiv7275178360ecxyiv7790603773ExternalClass #yiv7275178360ecxyiv7790603773ecxyiv8323390595 body.yiv7275178360ecxyiv7790603773ecxyiv8323390595hmmessage {font-size:12pt;font-family:Calibri;}#yiv7275178360 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!PabloFrom: michaelnotter@hotmail.comTo: freesurfer@nmr.mgh.harvard.eduDate: Wed, 19 Feb 2014 13:10:09 +0100Subject: [Freesurfer] Analysis of structural data acquired from multiple sites by using a mixed effect model approach#yiv7275178360 #yiv7275178360 --.yiv7275178360ExternalClass #yiv7275178360ecxyiv7790603773 .yiv7275178360ecxyiv7790603773ExternalClass #yiv7275178360ecxyiv7790603773ecxyiv8323390595 .yiv7275178360ecxyiv7790603773ecxyiv8323390595ExternalClass body.yiv7275178360ecxyiv7790603773ecxyiv8323390595ecxhmmessage {font-size:12pt;font-family:Calibri;}#yiv7275178360 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 Site41 1 0 0 11.1 99 0 0 1 01 0 1 0 11.1 101 0 0 1 01 1 0 0 11.4 95 1 0 0 01 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 listFreesurfer@nmr.mgh.harvard.eduhttps://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurferThe information in this e-mail is intended only for the person to whom it isaddressed. If you believe this e-mail was sent to you in error and the e-mailcontains patient information, please contact the Partners Compliance HelpLine athttp://www.partners.org/complianceline . If the e-mail was sent to you in errorbut does not contain patient information, please contact the sender and properlydispose of the e-mail. _______________________________________________Freesurfer mailing listFreesurfer@nmr.mgh.harvard.eduhttps://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurferThe information in this e-mail is intended only for the person to whom it isaddressed. If you believe this e-mail was sent to you in error and the e-mailcontains patient information, please contact the Partners Compliance HelpLine athttp://www.partners.org/complianceline . If the e-mail was sent to you in errorbut does not contain patient information, please contact the sender and properlydispose of the e-mail. _______________________________________________Freesurfer mailing listFreesurfer@nmr.mgh.harvard.eduhttps://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurferThe information in this e-mail is intended only for the person to whom it isaddressed. If you believe this e-mail was sent to you in error and the e-mailcontains patient information, please contact the Partners Compliance HelpLine athttp://www.partners.org/complianceline . If the e-mail was sent to you in errorbut does not contain patient information, please contact the sender and properlydispose of the e-mail. _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer