Oh, sorry, Greve. I misunderstood your suggestion.
Now I get the same resulte in both mri_glmfit and matlab. Thanks a lot!
But there is still a question about how it happened. Why I have to do so to get the correct result? There is nothing relevant between the number scale of one variable and the beta values of other variables theoretically. Is it any relevance to the data size of data structure in mri_glmfit?
 
Best Regards,
Lijie Huang
 
On Tue, May 3, 2011 at 10:55 PM, Douglas N Greve <greve@nmr.mgh.harvard.edu> wrote:
sorry, I mean to do it for both the FSGD file and the matlab script. I just tried it with your data and it works.

doug

soft.join Huang wrote:
Hi, doug.
 Thanks for your suggestion, but it does not seem to work.
After having divided the ICV by 1e6, I reculated the betas, and got the similar results as before in Matlab, just the beta4 -- correspondent to ICV -- multiplied a 10^6.
And then I computed the rank of matrix X that the value is 4, indicating that each 2 variables in design matrix do not highly correlated.
Also I have finished an regress analysis including one class variable and one continuous variable using mri_glmfit, got the same result in Matlab.
A wired situation...
Is it any additional constrains in mri_glmfit when doing regression analysis?
 Lijie Huang

 On Mon, May 2, 2011 at 9:09 PM, Douglas N Greve <greve@nmr.mgh.harvard.edu <mailto:greve@nmr.mgh.harvard.edu>> wrote:

   I think the problem may be that your data are "badly scaled"
   meaning that one column is much greater than another column. Try
   dividing the ICV by 1e6 and see if you get more similar results.

   doug

   soft.join Huang wrote:

       Doug,
        Thanks for your reply.
       I recalculated the beta value and got the same results as the
       Matlab does, but be different from the mri_glmfit's. I can not
       figure out where the problem is.
       Details following:
           I use the command
                mri_glmfit --table lh.volume.txt --fsgd
       volume.gender.fsgd doss --C gender.diff.mtx --glmdir lh.vol.glmdir
           to finish regression analysis. and got the beta value (
       beta1 = 1.9781e+03, beta2 = 2.0639e+03, beta3 = 110.9220,
       beta4 = 5.1964e-04 ) from beta.mgh file.
           Using X.mat file and the same dependent variable Y.mat as
       mri_glmfit's, I got totally different results in Matlab( beta1
       = 5.19e+02, beta2 = 4.44e+02, beta3 = 90.32, beta4 = 0.0015 ).
       I don't know how it happened...
        Hope for your reply.
       The data I used are all in the attachment.
        Best Regrads,
        Lijie Huang
       On Fri, Apr 29, 2011 at 9:45 PM, <greve@nmr.mgh.harvard.edu
       <mailto:greve@nmr.mgh.harvard.edu>
       <mailto:greve@nmr.mgh.harvard.edu
       <mailto:greve@nmr.mgh.harvard.edu>>> wrote:

          Lijie,

          I don't know what the matlab regress() function does.
       mri_glmfit
          is just
          solving the GLM equation, which you can do easily in matlab:

          beta = inv(X'*X)*X'*y;

          try that and see if you get the same as mri_glmfit.

          doug


          > Hi all,
          >
          > I'm working on a group analysis using mri_glmfit.
          >  In analysis directory, I got a X.mat file which
       containing the
          matrix X (
          > size 50x4 ) used to regress analysis, also the beta value
       from
          beta.mgh
          > file.
          > Strangely, I loaded the X.mat in Matlab and recalculated the
          beta using
          > function regress in matlab, but got a different result
       from that of
          > mri_glmfit.
          > I don't know where the problem is, is there any difference in
          algorithm
          > between mri_glmfit and matlab function regress(
       regress(Y,X) )?
          or I made
          > some mistakes during the procedure.
          > The X.mat file and the dependent variable Y.mat are in the
          attachment.
          >
          > Thanks in advance
          >
          > Lijie Huang
          > _______________________________________________
          > Freesurfer mailing list
          > Freesurfer@nmr.mgh.harvard.edu
       <mailto:Freesurfer@nmr.mgh.harvard.edu>
          <mailto:Freesurfer@nmr.mgh.harvard.edu
       <mailto: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.



   --     Douglas N. Greve, Ph.D.
   MGH-NMR Center

   greve@nmr.mgh.harvard.edu <mailto:greve@nmr.mgh.harvard.edu>
   Phone Number: 617-724-2358 Fax: 617-726-7422

   Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting
   <http://surfer.nmr.mgh.harvard.edu/fswiki/BugReporting>    <http://www.nmr.mgh.harvard.edu/facility/filedrop/index.html>



--
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: www.nmr.mgh.harvard.edu/facility/filedrop/index.html