Re: [Freesurfer] Linear Mixed Models in FS?

2014-06-19 Thread jorge luis
Yes there is numerical instability when p-values becomes extremely low and your 
solution is OK. You are just being conservative. Your actual p-value might have 
been 1e-25 but you couldn't observe it exactly (got zero instead) because of 
numerical limitations of the Matlab's fcdf function.
I'll fix this issue on github:https://github.com/NeuroStats this weekend.

Best
-Jorge



 De: Lars M. Rimol lari...@gmail.com
Para: jorge luis jbernal0...@yahoo.es 
CC: Freesurfer support list freesurfer@nmr.mgh.harvard.edu 
Enviado: Jueves 19 de junio de 2014 5:01
Asunto: Re: [Freesurfer] Linear Mixed Models in FS?
 


Hi
Jorge,

Thank
you! Yes this makes sense, because this confirms that the second
covariate in fact tests for an effect across all groups, just as I
expected.
Now,
there's another problem with these analyses: Please consider the
attached figure lh_model1_01000_interaction_nopatch_lateral.tif,
which shows a p-map (cortical 

area, smoothed with 30 mm fwhm)
with two gray regions in the temporal lobe and the insula/IFG in the
middle of highly significant regions. There is no darker blue
transition 

into the non-significant regions. These gray regions
appear to be artifacts based on eye balling of the maps. I checked
the output of the significance testing in those regions and it 

appears that the output of this formula (in lme_mass_f.m) is
extremely low:  pval(i)
= 1-fcdf(Fstat,szC,m);
 
I
assume there may be numerical instability when pval becomes extremely
low? Could that explain this?  

I changed the code so
that if 

1-fcdf(Fstat,szC,m) is zero or less than 1e-15, then 
pval(i) = max(1-fcdf(Fstat,szC,m),1e-15);

(or, if it's
negative   pval(i) = min(1-fcdf(Fstat,szC,m),-1e-15) 
)

If it's not, then the old code applies:  pval(i) =
1-fcdf(Fstat,szC,m);

This seems to have fixed the problem as
the figure model1_area_lh_01000_winteraction_wpatch_lateral.tif
shows. Again, based on  
eye-balling
the maps.

I have seen this problem in several data sets, both
cortical and subcortical data. In all cases using a lower limit for
1-fcdf(Fstat,szC,m) -  
either
1e-15 or 1e-20 - seems to fix the problem. 

Do you concur
that the problem is numerical instability and is this a good way to
fix it?  


Thank you!

yours,
LMR





On Wed, Jun 18, 2014 at 3:49 PM, jorge luis jbernal0...@yahoo.es wrote:



Hi LMR 


If the interaction
term is not statistically significant then there is no evidence of
the existence of two different groups in your sample (as far as the
longitudinal trajectory is concerned they are all controls, the
groups might be different at baseline though). This is why main
effects are only tested after the interactions have been previously
tested. In your model a common “base time slope” is assumed for
both groups (the second coefficient) but you are also explicitly
modeling the possibility of the case-group slope being exceeding the
control/common base slope  by an extra quantity. That quantity is the
interaction term. 


Hope this makes
sense


Best
-Jorge






 De: Lars M. Rimol lari...@gmail.com
Para: FS maling list freesurfer@nmr.mgh.harvard.edu 
Enviado: Miércoles 18 de junio de 2014 8:57
Asunto: Re: [Freesurfer] Linear Mixed Models in FS?
 


Hi Jorge, 

Thank you for your reply!

Again considering the same model from before

    intercept(random
effect) + centered age + group + group x centered age + sex


I think what is confusing me is that I think of  the [centered age] 
covariate as a column vector which will contain the centered age of both the 
control- and the case group. This is how it would be seen in a GLM using the 
same design matrix. Therefore it is difficult for me to understand how the 
contrast [0 1 0 0 0] can inform us about the control group alone. To me it 
would seem obvious that this contrast tells me something about the effect of 
[centered age] on the whole of the sample, regardless of the group 
each subject belongs to. 

On the other hand, I agree with you that the interaction term could 
tell us something about the effect of [centered age] on the case-group 
by considering the contrast vector [0 0 0 1 0].



Just for the sake of argument, please consider the following model

 intercept(random
effect) + (1-group) x centered age + group + group x centered age + sex



and compare to the one presented above. Here (1-group) is a column vector 
which is 1 where the [group] vector is 0, and vice versa. This 
difference  ensures that the second term only includes numbers from the 
control-group. Applying the contrast [0 1 0 0 0] to this model, would this 
not be more appropriate for consider the effect of [centered age] 
on the control-group alone?

Given your previous answers I 
suspect I'm missing something here, but I would greatly appreciate if 
you could please take the time to explain to me how I've gone wrong. 

Thanks!
LMR


---
Hi

Re: [Freesurfer] Linear Mixed Models in FS?

2014-06-19 Thread Eugenio Iglesias
Ey! Dice Lilla que estas currando en el Childrens?

Juan Eugenio Iglesias
Postdoctoral researcher BCBL
www.jeiglesias.com
www.bcbl.eu

Legal disclaimer/Aviso legal/Lege-oharra: www.bcbl.eu/legal-disclaimer


- Original Message -
From: jorge luis jbernal0...@yahoo.es
To: Lars M. Rimol lari...@gmail.com
Cc: Freesurfer support list freesurfer@nmr.mgh.harvard.edu
Sent: Thursday, June 19, 2014 8:56:38 AM
Subject: Re: [Freesurfer] Linear Mixed Models in FS?




Yes there is numerical instability when p-values becomes extremely low and y 
our solution is OK. You are just being conservative. Your actual p-value might 
have been 1e-25 but you couldn't observe it exactly (got zero instead) because 
of numerical limitations of the Matlab's fcdf function. 
I'll fix this issue on github: https://github.com/NeuroStats this weekend. 


Best 
-Jorge 







De: Lars M. Rimol lari...@gmail.com 
Para: jorge luis jbernal0...@yahoo.es 
CC: Freesurfer support list freesurfer@nmr.mgh.harvard.edu 
Enviado: Jueves 19 de junio de 2014 5:01 
Asunto: Re: [Freesurfer] Linear Mixed Models in FS? 






Hi Jorge, 

Thank you! Yes this makes sense, because this confirms that the second 
covariate in fact tests for an effect across all groups, just as I expected. 

Now, there's another problem with these analyses: Please consider the attached 
figure lh_model1_01000_interaction_nopatch_lateral.tif , which shows a p-map 
(cortical 

area, smoothed with 30 mm fwhm) with two gray regions in the temporal lobe and 
the insula/IFG in the middle of highly significant regions. There is no darker 
blue transition 

into the non-significant regions. These gray regions appear to be artifacts 
based on eye balling of the maps. I checked the output of the significance 
testing in those regions and it 

appears that the output of this formula (in lme_mass_f.m) is extremely low: 
pval(i) = 1-fcdf(Fstat,szC,m); 

I assume there may be numerical instability when pval becomes extremely low? 
Could that explain this? 

I changed the code so that if 

1-fcdf(Fstat,szC,m) is zero or less than 1e-15, then pval(i) = 
max(1-fcdf(Fstat,szC,m),1e-15); 

(or, if it's negative pval(i) = min(1-fcdf(Fstat,szC,m),-1e-15) ) 

If it's not, then the old code applies: pval(i) = 1-fcdf(Fstat,szC,m); 

This seems to have fixed the problem as the figure 
model1_area_lh_01000_winteraction_wpatch_lateral.tif shows. Again, based on 
eye-balling the maps. 

I have seen this problem in several data sets, both cortical and subcortical 
data. In all cases using a lower limit for 1-fcdf(Fstat,szC,m) - 
either 1e-15 or 1e-20 - seems to fix the problem. 

Do you concur that the problem is numerical instability and is this a good way 
to fix it? 


Thank you! 

yours, 
LMR 






On Wed, Jun 18, 2014 at 3:49 PM, jorge luis  jbernal0...@yahoo.es  wrote: 







Hi LMR 


If the interaction term is not statistically significant then there is no 
evidence of the existence of two different groups in your sample (as far as the 
longitudinal trajectory is concerned they are all controls, the groups might be 
different at baseline though). This is why main effects are only tested after 
the interactions have been previously tested. In your model a common “base time 
slope” is assumed for both groups (the second coefficient) but you are also 
explicitly modeling the possibility of the case-group slope being exceeding the 
control/common base slope by an extra quantity. That quantity is the 
interaction term. 


Hope this makes sense 


Best 
-Jorge 










De: Lars M. Rimol  lari...@gmail.com  
Para: FS maling list  freesurfer@nmr.mgh.harvard.edu  
Enviado: Miércoles 18 de junio de 2014 8:57 
Asunto: Re: [Freesurfer] Linear Mixed Models in FS? 







Hi Jorge, 

Thank you for your reply! 

Again considering the same model from before 

intercept(random effect) + centered age + group + group x centered age + sex 


I think what is confusing me is that I think of the [centered age] covariate as 
a column vector which will contain the centered age of both the control- and 
the case group. This is how it would be seen in a GLM using the same design 
matrix. Therefore it is difficult for me to understand how the contrast [0 1 0 
0 0] can inform us about the control group alone. To me it would seem obvious 
that this contrast tells me something about the effect of [centered age] on the 
whole of the sample, regardless of the group each subject belongs to. 

On the other hand, I agree with you that the interaction term could tell us 
something about the effect of [centered age] on the case-group by considering 
the contrast vector [0 0 0 1 0]. 



Just for the sake of argument, please consider the following model 

intercept(random effect) + (1-group) x centered age + group + group x centered 
age + sex 



and compare to the one presented above. Here (1-group) is a column vector which 
is 1 where the [group] vector is 0, and vice versa. This difference ensures 
that the second term only

Re: [Freesurfer] Linear Mixed Models in FS?

2014-06-18 Thread Lars M. Rimol
Hi Jorge,

Thank you for your reply!

Again considering the same model from before

intercept(random effect) + centered age + group + group x centered age
+ sex

I think what is confusing me is that I think of the [centered age]
covariate as a column vector which will contain the centered age of both
the control- and the case group. This is how it would be seen in a GLM
using the same design matrix. Therefore it is difficult for me to
understand how the contrast [0 1 0 0 0] can inform us about the control
group alone. To me it would seem obvious that this contrast tells me
something about the effect of [centered age] on the whole of the sample,
regardless of the group each subject belongs to.

On the other hand, I agree with you that the interaction term could tell us
something about the effect of [centered age] on the case-group by
considering the contrast vector [0 0 0 1 0].


Just for the sake of argument, please consider the following model

 intercept(random effect) + (1-group) x centered age + group + group x
centered age + sex

and compare to the one presented above. Here (1-group) is a column vector
which is 1 where the [group] vector is 0, and vice versa. This difference
ensures that the second term only includes numbers from the control-group.
Applying the contrast [0 1 0 0 0] to this model, would this not be more
appropriate for consider the effect of [centered age] on the control-group
alone?

Given your previous answers I suspect I'm missing something here, but I
would greatly appreciate if you could please take the time to explain to me
how I've gone wrong.

Thanks!
LMR

---
Hi LMR

1) Yes, you should
use n-1 (0/1) covariates to model n groups.  Eg.  (Controls, Case 1
and Case 2) the model would be:

intercept(random
effect) + centered age?(might be a random effect too)?+ ?Case1 + Case1 x
centered age +  Case2 +
Case2 x centered age + sex

2)In model:

intercept(random
effect) + centered age + group + group x centered age + sex

the fourth coefficient is
the interaction term that represents the difference in slope between
the patient and control groups.  This is easy to see from your
Question 1 equations.  It's also easy to see from those equations
that [0 1 0 0 0] tests the effect of time in the control group since
the group-specific slope is only equal to the coefficient of the time
covariate (the
second covariate) when the group covariate is zero (i.e for the
controls).


Hope this makes
sense.

Best
-Jorge
-- 
yours,

Lars M. Rimol, PhD
St. Olavs Hospital
Trondheim,
Norway
___
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.


Re: [Freesurfer] Linear Mixed Models in FS?

2014-06-18 Thread jorge luis


Hi LMR 

If the interaction
term is not statistically significant then there is no evidence of
the existence of two different groups in your sample (as far as the
longitudinal trajectory is concerned they are all controls, the
groups might be different at baseline though). This is why main
effects are only tested after the interactions have been previously
tested. In your model a common “base time slope” is assumed for
both groups (the second coefficient) but you are also explicitly
modeling the possibility of the case-group slope being exceeding the
control/common base slope  by an extra quantity. That quantity is the
interaction term. 

Hope this makes
sense

Best
-Jorge




 De: Lars M. Rimol lari...@gmail.com
Para: FS maling list freesurfer@nmr.mgh.harvard.edu 
Enviado: Miércoles 18 de junio de 2014 8:57
Asunto: Re: [Freesurfer] Linear Mixed Models in FS?
 


Hi Jorge, 

Thank you for your reply!

Again considering the same model from before

    intercept(random
effect) + centered age + group + group x centered age + sex


I think what is confusing me is that I think of  the [centered age] 
covariate as a column vector which will contain the centered age of both the 
control- and the case group. This is how it would be seen in a GLM using the 
same design matrix. Therefore it is difficult for me to understand how the 
contrast [0 1 0 0 0] can inform us about the control group alone. To me it 
would seem obvious that this contrast tells me something about the effect of 
[centered age] on the whole of the sample, regardless of the group 
each subject belongs to. 

On the other hand, I agree with you that the interaction term could 
tell us something about the effect of [centered age] on the case-group 
by considering the contrast vector [0 0 0 1 0].



Just for the sake of argument, please consider the following model

 intercept(random
effect) + (1-group) x centered age + group + group x centered age + sex



and compare to the one presented above. Here (1-group) is a column vector 
which is 1 where the [group] vector is 0, and vice versa. This 
difference  ensures that the second term only includes numbers from the 
control-group. Applying the contrast [0 1 0 0 0] to this model, would this 
not be more appropriate for consider the effect of [centered age] 
on the control-group alone?

Given your previous answers I 
suspect I'm missing something here, but I would greatly appreciate if 
you could please take the time to explain to me how I've gone wrong. 

Thanks!
LMR


---
Hi LMR

1) Yes, you should
use n-1 (0/1) covariates to model n groups.  Eg.  (Controls, Case 1
and Case 2) the model would be:

intercept(random
effect) + centered age?(might be a random effect too)?+ ?Case1 + Case1 x 
centered age +  Case2 +
Case2 x centered age + sex

2)In model:

intercept(random
effect) + centered age + group + group x centered age + sex

the fourth coefficient is
the interaction term that represents the difference in slope between
the patient and control groups.  This is easy to see from your
Question 1 equations.  It's also easy to see from those equations
that [0 1 0 0 0] tests the effect of time in the control group since
the group-specific slope is only equal to the coefficient of the time 
covariate (the
second covariate) when the group covariate is zero (i.e for the
controls).


Hope this makes
sense.

Best
-Jorge
-- 

yours,

Lars M. Rimol, PhD
St. Olavs Hospital
Trondheim,
Norway
___
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.