Thanks for the suggestions Doug, I have a few clarifying questions below, to make sure I understand everything. 


On Tue, Oct 22, 2013 at 8:02 AM, Douglas N Greve <greve@nmr.mgh.harvard.edu> wrote:

The duration of illnessis always 0 for your healthy controls(which is
obviously reasonable). The problem is that mri_glmfit is creating a
regressor of all 0s to model this duration and this is causing the
ill-conditionedness. There are several things you can do:

1. Create your own design matrix so that HCs do not have a column for
duration. You can edit the one created by mri_glmfit from the fsgd. You
can then feed this matrix into mri_glmfit instead of the fsgd file.
Would I do this for both medication and duration columns?
What is the flag for feeding mri_glmfit an .mtx instead of an fsgd?  

2. Run mri_glmfit with DOSS instead of DODS. This is appropriateif all
four groupshave the same slope with age, mean thickness, medication, and
duration.
i.e. if there are no group differences on age, mean thickness, medication, or duration of illness I can run DOSS? My groups are matched on age and ,mean thickness, but there are obviously group differences in medications and illness duration... thus wouldn't I expect them to have different slopes? 

3. Recode the HCs be SZs with 0 duration illness. This maynot make sense
with your other variables (like medication).
i.e. collapse them into one group? But, the analysis I am interested in is detecting group differences in thickness whilst controlling for confounds such as age, medication, and duration of illness... if I recoded the HC group wouldn't this change the analysis from between group to within?  

doug

On 10/21/2013 11:01 PM, Laura M. Tully wrote:
> Hello freesurfers,
>
> I'm trying to run mri_glmfit between groups analysis (patients vs.
> controls) with gender, age, medication (continuous), and duration of
> illness as covariates. The problem is, only the patients have
> medication and duration of illness values - by virtue of being control
> participants, the control group have values of zero for medication and
> duration of illness. This causes issues with the matrix and I'm trying
> to figure out how to get around it. Suggestions would be most
> appreciated. See output and details below, plus attached files.
>
> Thanks!
>
> Laura.
>
> *Command line: *
> mri_glmfit --y lh_grpDiffs_thickness10.mgh --fsgd
> grpdiffs_thickness_lh_Med_Dur.fsgd --fsgd-rescale --C
> Contrast1A_grp_Diffs_HCvsSZ_Med_Dur.mtx --surf fsaverage lh --cortex
> --glmdir lh_grpdiffs_lh_thickness_Med_Dur.glmdir
> *
> *
> *Output:*
> gdfReadHeader: reading grpdiffs_thickness_lh_Med_Dur.fsgd
> INFO: demeaning continuous variables
> Continuous Variable Means (all subjects)
> 0 Age 36.0909 11.4927
> 1 LH_Mean_Thick 2.34931 0.118499
> 2 medication 204.545 330.217
> 3 duration_illness 7.74545 11.4005
> Class Means of each Continuous Variable
> 1 HCmale  34.3000   2.3799   0.0000   0.0000
> 2 HCfemale  32.5556   2.3723   0.0000   0.0000
> 3 SZmale  36.5000   2.3124 391.2500  14.6875
> 4 SZfemale  42.2000   2.3265 499.0000  19.1000
> INFO: gd2mtx_method is dods
> Reading source surface
> /ncf/snp/04/SCORE/freesurfer_analysis/fsaverage/surf/lh.white
> Number of vertices 163842
> Number of faces    327680
> Total area         65416.648438
> AvgVtxArea       0.399267
> AvgVtxDist       0.721953
> StdVtxDist       0.195470
>
> $Id: mri_glmfit.c,v 1.196.2.6 2011/05/05 20:54:25 greve Exp $
> cwd /ncf/snp/04/SCORE/freesurfer_analysis/glm_analysis
> cmdline mri_glmfit --y lh_grpDiffs_thickness10.mgh --fsgd
> grpdiffs_thickness_lh_Med_Dur.fsgd --fsgd-rescale --C
> Contrast1A_grp_Diffs_HCvsSZ_Med_Dur.mtx --surf fsaverage lh --cortex
> --glmdir lh_grpdiffs_lh_thickness_Med_Dur.glmdir
> sysname  Linux
> hostname ncfws14.rc.fas.harvard.edu <http://ncfws14.rc.fas.harvard.edu>
> machine  x86_64
> user     ltully
> FixVertexAreaFlag = 1
> UseMaskWithSmoothing     1
> OneSampleGroupMean 0
> y
>  /ncf/snp/04/SCORE/freesurfer_analysis/glm_analysis/lh_grpDiffs_thickness10.mgh
> logyflag 0
> usedti  0
> FSGD grpdiffs_thickness_lh_Med_Dur.fsgd
> labelmask
>  /ncf/snp/04/SCORE/freesurfer_analysis/fsaverage/label/lh.cortex.label
> maskinv 0
> glmdir lh_grpdiffs_lh_thickness_Med_Dur.glmdir
> IllCondOK 0
> ReScaleX 1
> DoFFx 0
> Creating output directory lh_grpdiffs_lh_thickness_Med_Dur.glmdir
> Loading y from
> /ncf/snp/04/SCORE/freesurfer_analysis/glm_analysis/lh_grpDiffs_thickness10.mgh
> INFO: gd2mtx_method is dods
> Saving design matrix to lh_grpdiffs_lh_thickness_Med_Dur.glmdir/Xg.dat
> Normalized matrix condition is 1e+08
> Design matrix ------------------
>  0.000   0.000   1.000   0.000   0.000   0.000   0.740   0.000   0.000
>   0.000  -1.700   0.000   0.000   0.000 0.329   0.000   0.000   0.000
>   0.817   0.000;
>  0.000   0.000   1.000   0.000   0.000   0.000  -0.392   0.000   0.000
>   0.000   0.233   0.000   0.000   0.000 0.632   0.000   0.000   0.000
>  -0.148   0.000;
>  0.000   0.000   0.000   1.000   0.000   0.000   0.000  -0.191   0.000
>   0.000   0.000   0.013   0.000   0.000 0.000  -1.511   0.000   0.000
>   0.000  -0.272;
>  0.000   0.000   1.000   0.000   0.000   0.000   0.479   0.000   0.000
>   0.000   0.427   0.000   0.000   0.000 0.212   0.000   0.000   0.000
>   0.729   0.000;
>  0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.940   0.000
>   0.000   0.000  -0.907   0.000   0.000 0.000   0.912   0.000   0.000
>   0.000  -0.009;
>  0.000   0.000   1.000   0.000   0.000   0.000   1.436   0.000   0.000
>   0.000  -0.029   0.000   0.000   0.000  -0.276   0.000   0.000
> 0.000   1.431   0.000;
>  1.000   0.000   0.000   0.000   0.757   0.000   0.000   0.000  -0.235
>   0.000   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  1.000   0.000   0.000   0.000   1.018   0.000   0.000   0.000  -0.775
>   0.000   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  1.000   0.000   0.000   0.000   1.627   0.000   0.000   0.000  -0.032
>   0.000   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  0.000   1.000   0.000   0.000   0.000   1.953   0.000   0.000   0.000
>  -0.070   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  1.000   0.000   0.000   0.000   1.105   0.000   0.000   0.000   0.854
>   0.000   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  0.000   1.000   0.000   0.000   0.000   1.518   0.000   0.000   0.000
>  -0.864   0.000   0.000   0.000   0.000 0.000   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.713   0.000
>   0.000   0.000   0.359   0.000   0.000 0.000  -0.784   0.000   0.000
>   0.000  -0.886;
>  0.000   1.000   0.000   0.000   0.000   1.083   0.000   0.000   0.000
>   0.428   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  0.000   0.000   1.000   0.000   0.000   0.000  -1.088   0.000   0.000
>   0.000   0.190   0.000   0.000   0.000 0.632   0.000   0.000   0.000
>  -0.937   0.000;
>  1.000   0.000   0.000   0.000  -0.548   0.000   0.000   0.000  -0.454
>   0.000   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  0.000   0.000   0.000   1.000   0.000   0.000   0.000   1.375   0.000
>   0.000   0.000   0.612   0.000   0.000 0.000   1.517   0.000   0.000
>   0.000   1.395;
>  1.000   0.000   0.000   0.000   0.496   0.000   0.000   0.000   0.010
>   0.000   0.000   0.000   0.000   0.000 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.131   0.000   0.000
>   0.000   0.435   0.000   0.000   0.000  -1.185   0.000   0.000
> 0.000   0.378   0.000;
>  0.000   0.000   1.000   0.000   0.000   0.000  -1.001   0.000   0.000
>   0.000  -0.864   0.000   0.000   0.000 0.212   0.000   0.000   0.000
>  -1.201   0.000;
>  0.000   1.000   0.000   0.000   0.000  -0.222   0.000   0.000   0.000
>  -2.138   0.000   0.000   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.931   0.000   0.000   0.000  -1.214
>   0.000   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  0.000   0.000   1.000   0.000   0.000   0.000   1.088   0.000   0.000
>   0.000  -0.856   0.000   0.000   0.000  -0.943   0.000   0.000
> 0.000   0.992   0.000;
>  0.000   0.000   0.000   1.000   0.000   0.000   0.000   0.070   0.000
>   0.000   0.000   0.401   0.000   0.000 0.000  -1.208   0.000   0.000
>   0.000   0.342;
>  0.000   0.000   0.000   1.000   0.000   0.000   0.000   1.114   0.000
>   0.000   0.000  -1.051   0.000   0.000 0.000   1.214   0.000   0.000
>   0.000   2.009;
>  0.000   0.000   1.000   0.000   0.000   0.000  -1.088   0.000   0.000
>   0.000  -0.147   0.000   0.000   0.000 0.212   0.000   0.000   0.000
>  -1.113   0.000;
>  0.000   0.000   0.000   1.000   0.000   0.000   0.000  -0.017   0.000
>   0.000   0.000  -1.219   0.000   0.000 0.000   0.306   0.000   0.000
>   0.000   0.868;
>  0.000   0.000   1.000   0.000   0.000   0.000   0.218   0.000   0.000
>   0.000  -0.721   0.000   0.000   0.000  -0.983   0.000   0.000
> 0.000  -0.323   0.000;
>  0.000   0.000   0.000   1.000   0.000   0.000   0.000  -1.149   0.000
>   0.000   0.000   2.139   0.000   0.000 0.000   0.154   0.000   0.000
>   0.000  -1.325;
>  0.000   0.000   0.000   1.000   0.000   0.000   0.000  -0.452   0.000
>   0.000   0.000  -0.325   0.000   0.000 0.000  -0.300   0.000   0.000
>   0.000  -1.061;
>  0.000   0.000   1.000   0.000   0.000   0.000  -0.044   0.000   0.000
>   0.000   0.486   0.000   0.000   0.000  -1.064   0.000   0.000
> 0.000  -0.060   0.000;
>  0.000   0.000   1.000   0.000   0.000   0.000   0.653   0.000   0.000
>   0.000  -0.392   0.000   0.000   0.000  -0.912   0.000   0.000
> 0.000   1.080   0.000;
>  0.000   0.000   0.000   1.000   0.000   0.000   0.000  -0.975   0.000
>   0.000   0.000  -0.021   0.000   0.000 0.000  -0.300   0.000   0.000
>   0.000  -1.061;
>  0.000   0.000   1.000   0.000   0.000   0.000  -1.349   0.000   0.000
>   0.000   0.579   0.000   0.000   0.000 0.026   0.000   0.000   0.000
>  -1.113   0.000;
>  0.000   0.000   1.000   0.000   0.000   0.000  -0.566   0.000   0.000
>   0.000   1.895   0.000   0.000   0.000 0.632   0.000   0.000   0.000
>  -0.850   0.000;
>  1.000   0.000   0.000   0.000   0.670   0.000   0.000   0.000  -0.809
>   0.000   0.000   0.000   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.722   0.000   0.000   0.000  -0.716
>   0.000   0.000   0.000   0.000   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.831   0.000   0.000   0.000
>   1.398   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  1.000   0.000   0.000   0.000   1.453   0.000   0.000   0.000  -0.978
>   0.000   0.000   0.000   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.670   0.000   0.000   0.000  -2.429
>   0.000   0.000   0.000   0.000   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.744   0.000   0.000   0.000
>  -0.121   0.000   0.000   0.000   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.657   0.000   0.000   0.000
>   0.082   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  1.000   0.000   0.000   0.000   1.018   0.000   0.000   0.000   1.318
>   0.000   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  1.000   0.000   0.000   0.000  -1.244   0.000   0.000   0.000   1.208
>   0.000   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  0.000   1.000   0.000   0.000   0.000  -1.179   0.000   0.000   0.000
>   0.444   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  1.000   0.000   0.000   0.000  -1.244   0.000   0.000   0.000   0.364
>   0.000   0.000   0.000   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.809   0.000   0.000   0.000   1.790
>   0.000   0.000   0.000   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.983   0.000   0.000   0.000   0.558
>   0.000   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  1.000   0.000   0.000   0.000  -1.157   0.000   0.000   0.000   0.254
>   0.000   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  1.000   0.000   0.000   0.000  -1.157   0.000   0.000   0.000   0.752
>   0.000   0.000   0.000   0.000   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.918   0.000   0.000   0.000
>   0.841   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  0.000   0.000   1.000   0.000   0.000   0.000   1.088   0.000   0.000
>   0.000  -1.354   0.000   0.000   0.000 3.660   0.000   0.000   0.000
>   1.343   0.000;
>  0.000   0.000   1.000   0.000   0.000   0.000  -0.305   0.000   0.000
>   0.000   1.819   0.000   0.000   0.000  -1.185   0.000   0.000
> 0.000  -1.025   0.000;
>  1.000   0.000   0.000   0.000  -0.461   0.000   0.000   0.000   0.870
>   0.000   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
>  1.000   0.000   0.000   0.000  -1.418   0.000   0.000   0.000  -0.336
>   0.000   0.000   0.000   0.000   0.000 0.000   0.000   0.000   0.000
>   0.000   0.000;
> --------------------------------
> ERROR: matrix is ill-conditioned or badly scaled, condno = 1e+08
>
>
> --
> --
> Laura M. Tully, PhD
> Post-Doctoral Fellow in Psychiatry
> UC Davis Imaging Research Center
> 4701 X Street,
> Sacramento, CA  95817
> Phone: (916) 734-7927
> Fax: (916) 734-8750
>
> Alumnus of Social Neuroscience & Psychopathology Lab, Harvard University
> ltully@fas.harvard.edu <mailto:ltully@fas.harvard.edu>
>
> Follow me on twitter: @tully_laura
> --
>
>
>
> _______________________________________________
> Freesurfer mailing list
> Freesurfer@nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer

--
Douglas N. Greve, Ph.D.
MGH-NMR Center
greve@nmr.mgh.harvard.edu
Phone Number: 617-724-2358
Fax: 617-726-7422

Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting
FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2
www.nmr.mgh.harvard.edu/facility/filedrop/index.html
Outgoing: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/

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




--
--
Laura M. Tully, PhD
Post-Doctoral Fellow in Psychiatry
UC Davis Imaging Research Center
4701 X Street,
Sacramento, CA  95817
Phone: (916) 734-7927
Fax:  (916) 734-8750

Alumnus of Social Neuroscience & Psychopathology Lab, Harvard University
ltully@fas.harvard.edu

Follow me on twitter: @tully_laura
--