Hi Angela,

to get the fs_write_Y to work, you would first need to set
mri.volsz(4) = 1
(to tell it to write only  a single frame).
But for writing significance maps, you can use fs_write_fstats (as you did).

Usually you don't describe the data, but simply capture the overlay of 
the p values on the surface and show the images. In the text you can of 
course reference the cortical ROI. You usually don't smooth significance 
maps, but instead you can use a different smoothing level for the inputs 
(Y, thickness), which is different.

For correction you would compute the FDR and use the result as a cutoff 
(FDR thresholded , so only what survives at the specified level is shown).
Here it makes sense to combine left and right hemisphere. Something like 
this:

% FDR correct, then use - log10(pth) in tksurfer
P = [ F_lhstats.pval(lhcortex) F_rhstats.pval(rhcortex) ];
G = [ F_lhstats.sgn(lhcortex) F_rhstats.sgn(rhcortex) ];
[detvtx,sided_pval,pth] = lme_mass_FDR2(P,G,[],0.05,0);
pcor = -log10(pth)


The significance map does include a sign, so that you know in what 
direction the effect goes. Having opposite signs for linear and 
quadratic is possible (meaning that the quadratic term goes in the 
opposite direction as the linear term). For example there could be a 
linear effect with age (atrophy, linear term is negative= higher age 
with smaller thickness) that slows down at higher ages (quadratic term 
is positive, a floor effect).

Best, Martin

On 04/20/2016 04:50 PM, Angela Favaro wrote:
> I was finally able to run linear mixed models with my data - thank you
> very much Martin for your precious help!
>
> No I would need some help/advice for visualization and description of
> my results
>
> The command fs_write_Y(sided_pval,mri,'spval.mgh') is not working on
> my matlab. This is the message error:
> Error using reshape
> To RESHAPE the number of elements must not change.
> Error in fs_write_Y (line 21)
> save_mgh(reshape(Y',mri.volsz),fname,mri.M,mri.mr_parms);
>
> so, I have used the command:
> fs_write_fstats(F_rhstats_lin,mri,'sig.mgh','sig')
> to export the findings, as described in the wiki. However, how can I
> describe my data, in terms of measure of the clusters, MNI coordinates
> and statistical values? and is it possible to smooth the image?
>
> In addition, this map is 'uncorrected' for multiple testing. How can I
> perform this correction?
>
> I am testing null hypothesis of no group differences in the rate of
> change over time between two groups and I found significant
> differences both using quadratic effects (time per time per group) and
> linear effects (time per group) in the same model (with one random
> effect, that appeared to perform better than the model with 2 RF). The
> map of the first analysis appeared in blue in Freeview, whereas the
> map for linear effects appeared in red. Does sig.mgh include the sign
> of the difference? and is it possible that the two analyses have
> opposite sign? am I doing something wrong?
>
> Thank you!
>
> Angela
>
>
>
>
>
>
> Martin Reuter <mreu...@nmr.mgh.harvard.edu> ha scritto:
>
>> Actually I am just adding a fix for this submitted by a user (thanks
>> Knut) , so it should work with modern versions soon.
>>
>> Best, Martin
>>
>> On 04/06/2016 11:02 AM, Martin Reuter wrote:
>>> Hi Angela,
>>>
>>> newer versions of matlab don't support the old matlabpool comands any
>>> longer. You need to use an older matlab version (less than 8.2.0.29).
>>>
>>> Best, Martin
>>>
>>> On 04/05/2016 06:06 PM, Angela Favaro wrote:
>>>> Hi Martin, thank you for your help.
>>>> I still have problems in running mixed models analyses. Do I need some
>>>> additional toolbox in matlab? (I did not find this information in the
>>>> web)
>>>> I tried to run the module in two versions of matlab, but the same
>>>> problem occurr.
>>>>
>>>> I used these commands:
>>>> [M,Y,ni] = sortData(M,1,Y,sID)
>>>> X = [ones(length(M),1) M M(:,1).*M(:,2)]
>>>>
>>>> [lhTh0,lhRe] = lme_mass_fit_EMinit(X,[1 2],Y,ni,lhcortex,3)
>>>>
>>>> this is the 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);
>>>>
>>>> What can it be the problem?
>>>> the matrices seem to be OK (and M has the same number of rows as Y
>>>> (and as the sID)).
>>>>
>>>> thank you for any help!
>>>>
>>>> Angela
>>>>
>>>>
>>>>
>>>>
>>>> Martin Reuter <mreu...@nmr.mgh.harvard.edu> ha scritto:
>>>>
>>>>> Hi Angela,
>>>>>
>>>>> the smooth function seems to be part of the curve fitting toolbox
>>>>> http://www.mathworks.com/help/curvefit/smooth.html
>>>>> so either that is missing, or your version is too old.
>>>>> You can skip the lowess Plot (it is just for initially checking the data).
>>>>>
>>>>>
>>>>> Make sure your M has the same number of rows as your Y (and as the sID).
>>>>> Also make sure you are computing the ni (and sorted M and Y) like this
>>>>> (if your first column in M is the time, else specify the column with the
>>>>> time as the second parameter):
>>>>>
>>>>> [M,Y,ni] = sortData(M,1,Y,sID);  # (sorts the data)
>>>>>
>>>>>
>>>>> Best, Martin
>>>>>
>>>>>
>>>>>
>>>>> On 03/20/2016 04:38 PM, Angela Favaro wrote:
>>>>>> Dear Freesurfer experts,
>>>>>> I need some help with the longitudinal streaming and the use of mixed
>>>>>> models in matlab.
>>>>>> I followed all the instructions and tried to use the following
>>>>>> commands in matlab:
>>>>>>
>>>>>> lme_timePlot(M(:,1),Y,ni)
>>>>>> and this worked well
>>>>>>
>>>>>> However, when I tried this:
>>>>>> lme_lowessPlot(M(:,1),Y,0.70,M(:,2))
>>>>>>
>>>>>> matlab gave the following error message:
>>>>>>
>>>>>> Undefined function 'smooth' for input arguments of type 'double'.
>>>>>> Error in lme_lowessPlot (line 49)
>>>>>>          ybw = smooth(st,dat(ix),bw,'rlowess')
>>>>>>
>>>>>> I checked in my version of matlab (R2012b) and the command 'smooth'
>>>>>> does not exist
>>>>>>
>>>>>> Further, when I tried this:
>>>>>>
>>>>>> lhstats  = lme_fit_FS(X,[1 2],Y,ni)
>>>>>>
>>>>>> Error using  -
>>>>>> Matrix dimensions must agree.
>>>>>>
>>>>>> Error in lme_fit_init (line 42)
>>>>>>          ri = yi-Xi*Bhat;
>>>>>>
>>>>>> Error in lme_fit_FS (line 71)
>>>>>> [D,phisq] = lme_fit_init(X,Zcols,y,ni);
>>>>>>
>>>>>> Looking into the matlab code, I observed that in line 42 there is no
>>>>>> command.....
>>>>>> and I am sure that matrix dimensions are correct.
>>>>>>
>>>>>> So, I have problems in solving these issues... Any help is greatly
>>>>>> appreciated!
>>>>>> Is it a problem of Matlab version?
>>>>>> Thank you!
>>>>>>
>>>>>> Angela
>>>>>>
>>>>>> _______________________________________________
>>>>>> Freesurfer mailing list
>>>>>> Freesurfer@nmr.mgh.harvard.edu
>>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>>>>>>
>>>>>>
>>>>> --
>>>>> Martin Reuter, PhD
>>>>> Assistant Professor of Radiology, Harvard Medical School
>>>>> Assistant Professor of Neurology, Harvard Medical School
>>>>> A.A.Martinos Center for Biomedical Imaging
>>>>> Massachusetts General Hospital
>>>>> Research Affiliate, CSAIL, MIT
>>>>> Phone: +1-617-724-5652
>>>>> Web  : http://reuter.mit.edu
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>>>
>>>>
>> --
>> Martin Reuter, PhD
>> Assistant Professor of Radiology, Harvard Medical School
>> Assistant Professor of Neurology, Harvard Medical School
>> A.A.Martinos Center for Biomedical Imaging
>> Massachusetts General Hospital
>> Research Affiliate, CSAIL, MIT
>> Phone: +1-617-724-5652
>> Web  : http://reuter.mit.edu
>>
>> _______________________________________________
>> Freesurfer mailing list
>> Freesurfer@nmr.mgh.harvard.edu
>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>
>
> _______________________________________________
> Freesurfer mailing list
> Freesurfer@nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
>
>

-- 
Martin Reuter, PhD
Assistant Professor of Radiology, Harvard Medical School
Assistant Professor of Neurology, Harvard Medical School
A.A.Martinos Center for Biomedical Imaging
Massachusetts General Hospital
Research Affiliate, CSAIL, MIT
Phone: +1-617-724-5652
Web  : http://reuter.mit.edu

_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer

Reply via email to