Diff for "Tips" - MRC CBU Imaging Wiki
location: Diff for "Tips"
Differences between revisions 24 and 25
Revision 24 as of 2011-08-17 13:59:27
Size: 1747
Comment:
Revision 25 as of 2013-03-07 21:23:02
Size: 1749
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
[[TableOfContents()]] <<TableOfContents>>
Line 29: Line 29:
attachment:display.jpg {{attachment:display.jpg}}
Line 33: Line 33:
Use the matlab functions corr or corrcoef (use help corr in matlab for full details) [[BR]] Use the matlab functions corr or corrcoef (use help corr in matlab for full details) <<BR>>

Tips

If you have any handy tips or have struggled with a problem, and solved it, share your tips here.

How to Visualize Regressors

Hopefully this example piece of script should allow you to visualize your block or event regressors individually so as to check that everything is being modelled the way it should be.

It's a Simple three step process:

1. Load your SPM design after having run your first level analysis

2. Save the regressor information within the SPM.mat file to another variable

3. Create a figure and plot your regressor of interest.

Example

1. Load SPM Design:
a) Drag and drop the SPM.mat file into your command line.
b) type: <load('/imaging/you01/yourfilesaddress/SPM.mat')>
2. Save the regressor information:
in the command window, type: <desmat = SPM.xX.X>
3. Display your regressor:
in the command window, type: <figure; plot(desmat(:,1))>
* the 1 corresponds to the first regressor in your DM. To view the second regressor change this to a two and so on... Voila! 

Display

display.jpg

Quick Check for correlation between regressors

Use the matlab functions corr or corrcoef (use help corr in matlab for full details)

1. Navigate to subject first level directory. Load SPM struct 
   >> load SPM 
2. Your design matrix is called SPM.xX.X within this struct
3. Correlate your regressors of interest e.g.
   >>[R,P]=corr(SPM.xX.(:,1),SPM.xX.X(:,2)) 
For example, this calculates the correlation between the 1st and 2nd columns of your matrix.
The output is the correlation co-efficient (R) and the p value (P).

These are matlab functions so for more information and options use help.

CbuImaging: Tips (last edited 2013-03-07 21:23:02 by localhost)