Hi Doug,

Thanks. Please see attached for the files in their original format. 

I realized the GLM for model 1 (discrete factors for maltx, parent ed and sex, continuous: age) might be failing bc one of the 8 groups (2maltreated*2parented*2sex) has only 1 subject.

My apologies for my delayed response, I missed this email in the daily digest.

Thanks,
Andrea


From: "Gold, Andrea (NIH/NIMH) [F]" <andrea.gold@nih.gov>
Date: Monday, October 5, 2015 at 12:58 PM
To: "freesurfer@nmr.mgh.harvard.edu" <freesurfer@nmr.mgh.harvard.edu>
Subject: error using mri_glmfit

Hi,

I got the following error during my first time running the mri_glmfit  command: 

    mri_glmfit --y Model1_Maltx_ParentEd_Sex_Age_n58-lh-thickness.mgh --fsgd Model1_Maltx_ParentEd_Sex_Age_n58.fsgd --C Model1_Maltx.mtx --C Model1_ParentEd.mtx --surf fsaverage lh --glmdir Model1_Maltx_ParentEd_Sex_Age_n58-lh-thickness.glmdir 

--------------------------------

ERROR: matrix is ill-conditioned or badly scaled, condno = 1e+08

--------------------------------

Possible problem with experimental design:

Check for duplicate entries and/or lack of range of

continuous variables within a class.


We are trying to look at the main effects of two discrete variables in the same model (I.e., effect of var1 while controlling for var2), while also regressing out sex (class) and age (variable). We don’t care about the interaction term(s).

There are 16 regressors = 8 classes * (1 variable +1) = 16.


The FSGD file is attached, and I copied the design matrix below.



From reading the archives, I tried Doug’s suggestion of "cat old.fsgd | sed 's/\\r/\\n/g' > new.fsgd” but that did not fix it.

Then I tried removing the overall mean (across all 58 subjects) and got the same error – see attached “*_demeaned.fsgd” file.



Thank you for your help with troubleshooting this error.



Best,

Andrea



Design matrix ------------------

 1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   18.053   0.000   0.000   0.000   0.000   0.000   0.000   0.000;

 1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   16.052   0.000   0.000   0.000   0.000   0.000   0.000   0.000;

 1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   14.267   0.000   0.000   0.000   0.000   0.000   0.000   0.000;

 1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   19.120   0.000   0.000   0.000   0.000   0.000   0.000   0.000;

 1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   15.195   0.000   0.000   0.000   0.000   0.000   0.000   0.000;

 1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   18.558   0.000   0.000   0.000   0.000   0.000   0.000   0.000;

 1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.895   0.000   0.000   0.000   0.000   0.000   0.000   0.000;

 0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   16.862   0.000   0.000   0.000   0.000   0.000   0.000;

 0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.974   0.000   0.000   0.000   0.000   0.000   0.000;

 0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.733   0.000   0.000   0.000   0.000   0.000   0.000;

 0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.260   0.000   0.000   0.000   0.000   0.000   0.000;

 0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.941   0.000   0.000   0.000   0.000   0.000;

 0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   16.712   0.000   0.000   0.000   0.000;

 0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.257   0.000   0.000   0.000   0.000;

 0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.446   0.000   0.000   0.000   0.000;

 0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.741   0.000   0.000   0.000   0.000;

 0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   15.718   0.000   0.000   0.000   0.000;

 0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   13.750   0.000   0.000   0.000   0.000;

 0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   14.111   0.000   0.000   0.000   0.000;

 0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   15.335   0.000   0.000   0.000   0.000;

 0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   16.329   0.000   0.000   0.000   0.000;

 0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   16.786   0.000   0.000   0.000;

 0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.990   0.000   0.000   0.000;

 0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.886   0.000   0.000   0.000;

 0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   18.497   0.000   0.000   0.000;

 0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.569   0.000   0.000;

 0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.604   0.000   0.000;

 0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.802   0.000   0.000;

 0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   16.851   0.000   0.000;

 0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   15.858   0.000   0.000;

 0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   16.640   0.000   0.000;

 0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   16.597   0.000   0.000;

 0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.410   0.000   0.000;

 0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   19.160   0.000;

 0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   15.636   0.000;

 0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   14.749   0.000;

 0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   14.056   0.000;

 0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   18.302   0.000;

 0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.333   0.000;

 0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   16.668   0.000;

 0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   20.236   0.000;

 0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   16.671   0.000;

 0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   19.058   0.000;

 0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   15.376   0.000;

 0.000   0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   19.209;

 0.000   0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   16.246;

 0.000   0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.640;

 0.000   0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   14.483;

 0.000   0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   16.214;

 0.000   0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   18.820;

 0.000   0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.955;

 0.000   0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.645;

 0.000   0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.514;

 0.000   0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   17.331;

 0.000   0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   16.189;

 0.000   0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   15.387;

 0.000   0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   15.231;

 0.000   0.000   0.000   0.000   0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.000   0.000   0.000   0.000   18.335;


-- 
Andrea Gold, Ph.D.
Section on Development and Affective Neuroscience
National Institute of Mental Health
Room 201, Bldg. 15K, 
MSC 2670
Bethesda, MD 20892-2670
Phone: 301-827-9804
Fax: 301-402-2010