[Freesurfer] error in lme_mass_fit using matlab tools

2013-06-19 Thread Catherine Bois
Dear Freesurfer experts,

I have a question about fitting linear mixed models to mass-univariate  
data using the lme tools in matlab.

I am currently trying to compute the initial vertex-wise temporal  
covariance estimates by [lhTh0lhRe] =  
lme_mass_fit_EMinit(X,[2],ni,lhcortex,3]

However, I keep getting this error message:

Undefined function 'matlabpool' for input arguments of type 'char'.

Error in lme_mass_fit_init (line 74)
if (prs==1) || (matlabpool('size') ~= prs)

Error in lme_mass_fit_EMinit (line 69)
[Theta1,Re1] = lme_mass_fit_init(X,Zcols,Y,ni,[],prs);

I have defined X, Y etc according to the previous steps available on  
the wiki. Would be very grateful for any clarification on why this  
error message keeps coming up.

Thank you very much,

Cathy

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


___
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] error in lme_mass_fit using matlab tools

2013-06-20 Thread Catherine Bois
Hi,

Thank you for your response. I am actually using two random effects  
(time and intercepts), and have fixed my design matrix to incorporate  
this. We are actually running R2011b Matlab, however I just realised  
that we do not have the Statistics toolbox. Could this be what is  
causing the errors? Is the Statistics toolbox freely available to  
download?

Best Wishes,

Cathy

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


___
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] error in lme_mass_fit using matlab tools

2013-06-19 Thread jorge luis


Hi Cathy

You are getting that error likely because your Matlab version is too old 
(before 2011) and it doesn't support 'matlabpool' parallel computing. Also, I 
notice that you are using only a single random effect (the second column of 
your design matrix). In that case I don't expect a significant increase in 
power from the spatiotemporal model. So you can simply use the traditional 
vertex-wise model 

 lhstats= lme_mass_fit_vw(X,[2],Y,ni,lhcortex);


You can find as attachment a non-parallel version of those scripts that may 
work on your Matlab version (I have not written the non-parallel version of the 
spatiotemporal model yet). The scripts are name as their parallel versions but 
with the sufix "1".


Best
-Jorge






>
> De: Catherine Bois 
>Para: freesurfer@nmr.mgh.harvard.edu 
>Enviado: Miércoles 19 de junio de 2013 10:39
>Asunto: [Freesurfer] error in lme_mass_fit using matlab tools
> 
>
>Dear Freesurfer experts,
>
>I have a question about fitting linear mixed models to mass-univariate  
>data using the lme tools in matlab.
>
>I am currently trying to compute the initial vertex-wise temporal  
>covariance estimates by [lhTh0lhRe] =  
>lme_mass_fit_EMinit(X,[2],ni,lhcortex,3]
>
>However, I keep getting this error message:
>
>Undefined function 'matlabpool' for input arguments of type 'char'.
>
>Error in lme_mass_fit_init (line 74)
>if (prs==1) || (matlabpool('size') ~= prs)
>
>Error in lme_mass_fit_EMinit (line 69)
>[Theta1,Re1] = lme_mass_fit_init(X,Zcols,Y,ni,[],prs);
>
>I have defined X, Y etc according to the previous steps available on  
>the wiki. Would be very grateful for any clarification on why this  
>error message keeps coming up.
>
>Thank you very much,
>
>Cathy
>
>-- 
>The University of Edinburgh is a charitable body, registered in
>Scotland, with registration number SC005336.
>
>
>___
>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.
>
>
>
>function fstats = lme_mass_F1(stats,CM)
% fstats = lme_mass_F1(stats,CM) 
% 
% Inference for the fixed-effects in the linear mixed-effects model. Allows 
% to test a different model at each voxel/vertex (Depends on the Statistics
% toolbox).
%
% Input
% stats: Structure array containing statistiscs for every voxel/vertex (see
% lme_FSfit for more details on these statistics).
% CM: Structure array containing a contrast matrix CM.C for each and every 
% voxel/vertex. If length(CM)==1 the same contrast matrix CM.C is tested at
% each and every voxel/vertex.
%
% Output
% fstats.F: F-Statistic.
% fstats.pval: P-value of the F-Statistic.
% fstats.sgn: Sign of the contrast.
% fstats.df: Degrees of freedom of the F-Statistic.
%
% $Revision: 1.1.1.1 $  $Date: 2012/02/02 11:25:52 $
% Original Author: Jorge Luis Bernal Rusiel 
% CVS Revision Info:
%$Author: jbernal$
%$Date: 2012/02/02 11:25:52 $
%$Revision: 1.1 $
% References: Bernal-Rusiel J.L., Greve D.N., Reuter M., Fischl B., Sabuncu
% M.R., 2012. Statistical Analysis of Longitudinal Neuroimage Data with Linear 
% Mixed Effects Models, NeuroImage, doi:10.1016/j.neuroimage.2012.10.065.
%
tic;
if nargin < 2
error('Too few inputs');
end;
nv = length(stats);
nCM = length(CM);
if nCM ~= nv
if nCM == 1
CM(1:nv) = struct('C',CM.C);
else
error(['The number of elements (contrasts) in CM must be equal to the'...
' number of locations (length(stats))']);
end
end;
for i=1:nv
if (stats(i).lreml ~= -10^10)  &&  (size(CM(i).C,2) ~= length(stats(i).Bhat))
error(['The number of colums in the contrast matrix CM('...
num2str(i) ').C is different from the corresponding number'...
' of fixed effects in stats(' num2str(i) ').Bhat']);
end;
end;
F = zeros(1,nv);
pval = ones(1,nv);
sgn = zeros(1,nv);
df = zeros(2,nv);
display(' ');
display('Computing F statistics, degrees of freedom and P-values ...');
for i=1:nv
if stats(i).lreml ~= -10^10
Bhat = stats(i).Bhat;
C = CM(i).C;
Zcols = stats(i).Zcols;
q = length(Zcols);
nth = q*(q+1)/2+1;
invEI = stats(i).i