For example, say you have two ROIs placed in distinct locations, and you wish to extract parameter estimates from the contrast A-B from each of those ROIs. Marsbar can do this easily, even flippantly, such a saucy and irreverent child it is. After your ROIs have been created, simply specify the SPM design you wish to extract parameter estimates from. In the case of second-level analyses, the SPM.mat files generated by these analyses will contain a number of time points equal to the number of subjects that went into that analysis; where Marsbar comes in is taking all of the parameter estimates for each subject and averages them over the entire ROI, generating a list of averaged parameter values for each subject.

Once this is done, save the results to a .mat file, load the file into memory, and check the output of SPM.marsY.Y (as in, "Why, Black Dynamite? Why?").

More deets can be found in the following tutorial; for a text-based walkthrough, complete with pictures, check out this link. I believe that both of these approaches are valid with both SPM5 and SPM8 distributions; if not, I apologize.

Unlike when Black Dynamite was denied the chance to apologize for the life he took so needlessly.

can you explain what the parameter estimate is? can the parameter estimate be interpreted as a magnitude of the signal, or effect size across the whole ROI?

ReplyDeletethanks!

Strictly speaking, a parameter estimate is the amount of variance explained by a particular regressor; however, it is also usually interpreted as the amount that the HRF needs to be scaled by to best fit the data at a given voxel. Note that looking at a parameter estimate (or beta, as it is sometimes called) by itself tells you nothing about the variability in that parameter estimate, which is in the error term. However, this variability is usually ignored when carrying out second-level analyses (although some programs, such as AFNI's 3dMEMA, do take this into account).

DeleteBest,

-Andy

Thank you for your reply. I have extracted parameter estimates using MarsBar, as you describe above for a ROI for each contrast of interest (say a>base, b> base and c>base) and then plotted this parameter estimate for each animal (I have two treatment gps). I am interpreting this as showing me which gp have a greater BOLD response in each task (a, b and c) - does this sound sensible to you?

Deleteps thanks for a really great site that is really helpful!

best

Anji

Hey Anji,

DeleteThanks for the kind words! As for your ROI, how are you defining it? It is best to create the ROI as independent of any of the contrasts that you are examining within that ROI, just so that it is unbiased towards showing significance for any of the individual contrasts. For example, it could be an ROI defined anatomically, or based on an orthogonal contrast that theoretically shouldn't share any (or very much) variance with any of the other contrasts.

Assuming that you are extracting parameter estimates from an independent ROI, your approach does sound reasonable.

Hope this helps,

-Andy

Great! I am indeed defining my ROI based on anatomy - it is a mask of the amygdala. Thanks again for your help.

ReplyDeleteAnji

Your blog is very good and clear.

ReplyDeleteI have a question.

What do you think about the obtained by MarsBar the contrast value for different rois and introduce this value in SPSS? (for correlations or comparison between groups)

¿is correct and reliable this approximation?

Thanks!!!

Hi, thanks! Yes, the results obtained by Marsbar can be used in any other statistical analysis package; you get a value for the average activation within that ROI for each subject, and at that point you can use it for any kind of analysis that you want.

DeleteBest,

-Andy

Hi, and thanks!!!!

DeleteI just another question..

In the data of ROI. I have a contrast value and p-value (corrected and uncorrected).

For a correlation with clinical data, Is possible use all contrast-value?, or I need make a filter for the p-values?

Thanks!!

Hey there,

DeleteYou don't need to filter the p-values; you can just use the contrast values to test your hypotheses.

-Andy

Thanks a lot!!!!

DeleteRegards!

Excellent blog, everything is clear.

ReplyDeleteBut I have a question.

I've done n-back task with 3 different load levels (0 back, 1 back and 2 back) in 2 different conditions (pre and post sleep deprivation), I want to make a correlation between conditions and behavioral data (0, 1 and 2 back) at frontal lobe, in order to test the hypothesis that decay in performance (incorrect answers) is related with "smaller activations".

I have 2 second level contrasts (1back>0back and 2back>0back) and I would like to test this hypothesis for both contrasts in both conditions.

I've defined ROIs anatomically (frontal lobe mask) and I've already extracted the parameters but I don't understand what the parameters represent in order to make correlations with incorrect responses.

Sorry for my bad english.

Thanks.

Hi Diana,

DeleteWhat you extract from those ROIs are the average parameter estimate of the BOLD signal across all the voxels in that ROI. It seems that you already have what you need to test your hypothesis; you would just need to plot the average parameter estimate for each subject for each condition. Then you could test for a linear increase or decrease across conditions, depending on their performance.

Best,

-Andy

Hi,

ReplyDeleteI am still puzzled about using MarsBar for ROI analysis of VBM data. Where will I get the SPM.mat file from?

I have the same question as above regarding VBM- how do I extract the density values for each person out of an ROI? I do not want the parameter estimates (no contrast SPM.mat), just the density values that I can use in other analyses.

ReplyDeleteTerrific video! Really helpful.

ReplyDeleteJust a quick question: If parameter estimates are (kind-of) betas for regressors, can their (absolute) value be greater than one?

I am getting parameter estimates that are greater than one and I am wondering if I did something wrong. In your video, all your betas are less than 1.

Thanks!

Thanks! I find that Black Dynamite helps in any situation.

DeleteAs for your question, yes, parameter estimates are unconstrained and can be any number (although generally anything greater than 2 or 3 starts to become suspect).

-Andy

Hi Andy,

DeleteThanks for the blog. It's really helpful.

I was wondering what can be gone wrong when parameter estimates are greater than 2 or 3?

Best,

Jin

Hey Jin,

DeleteThat's not necessarily a problem; parameter estimates can get into that range, although it's not very common. It depends on what kind of effect you're looking at; some robust effects do generate parameter estimates around 2 or 3, although lower ones are more common. If you get into parameter estimates greater than 5, for example, you may want to double-check how your model was specified, and whether you are accounting for all possible sources of variance.

-Andy

Hi Andy,

ReplyDeleteThank you for all your youtube videos and blog, they have been like gold dust to me!

I have a question regarding extracting parameter estimates for a contrast within MarsBar.

I have a 2x2 within subject design and have defined contrasts for main effects and interaction at the first level. If I extract the paramater estimates in my ROI (defined with independent data) for the interaction term 1 -1 -1 1 in MarsBar and do a one sample t test, will I have a way of understanding in what direction the interaction lies? Or should I look to the extracted paramater estimates for simple main effects to try and understand this interaction?

Many Thanks,

Corrina

Hi Corrina,

DeleteGold dust - can I use that for the testimonial page of my new website?

In any case, I would do your second method of extracting the simple effects, and then plotting those to see what is driving the interaction. As far as I know, Marsbar isn't able to show the full interaction, since the necessary data is compressed in calculating the interaction term.

Best,

-Andy

Hi Andy

DeleteGreat site, thanks! A related question... I have a significant 2 (group) x 2 (condition) interaction and have extracted/plotted the parameter estimates to understand the nature of the interaction. It appears the controls show a difference between conditions and the patients do not. I am wondering though if it is also valid to directly compare the beta estimates across the two groups or whether the beta values are arbitrary between-group if they are relative to each groups’ implicit baseline?

Thanks.

Hi there,

DeleteYes, it is valid to compare them. Even though both groups may have different average levels of activity, they are both scaled relative to the same number: 100. In other words, we are comparing the same thing - the amount of activity relative to 100.

Best,

-Andy

Appreciate your speedy response! Is that also true if the parameter estimates were obtained using a sphere centred on the cluster of interest within SPM? (not ROI within marsbar). I've used a flexible factorial model at the 2nd-level. Many thanks again.

DeleteIf memory serves, there is a slight difference between the two approaches - but I can't remember why. What I do remember is that the difference was trivial. You should be OK using either method.

DeleteIf you want to satisfy your own curiosity, try it with both approaches - using a sphere centered on the cluster within SPM, and then creating an identical sphere with Marsbar. My guess is that the parameter estimates won't be that different at all.

Best,

-Andy

Hi Andy,

ReplyDeleteFor sure, use the quote, I stand firmly behind it!

Ok great, I will extract the simple main effects and have a look at those.

Good luck with the new website.

Many Thanks,

Corrina

Hi Andy,

ReplyDeleteI have a question for the %percent change function in Marsbar. Actually I have a group of subjects that have been scanned twice on a 2-year follow-up. I have build 4 ROIs, and I would like to calculate the %change for these ROIs between Time1 and Time2 (I need my 2 spm.mat). Do you have any idea how I could achieve this?

Best regards,

Nick

Hi Nick,

DeleteYou could extract the percent signal change from the ROIs for each time using Marsbar, and then subtract those values from each other. Is that what you want?

Best,

-Andy

Hi Andrew,

ReplyDeleteI didn't know it was that simple! I thought about this possibility at first, but since there was a function called ''%percent change'' in Marsbar, I thought there was a savant way to calculate it via the program (I still consider myself as a rookie, first year graduate student here ;)).

Thank for the quick reply!

Nick

Hi Andrew,

ReplyDeleteI want to ask whther the following marsbar script is used to extract beta values? And is it the same as the way you showed us using marsbar?

% Make marsbar design object

D = mardo(spm_name);

% Make marsbar ROI object

R = maroi(roi_file);

% Fetch data into marsbar data object

Y = get_marsy(R, D, 'mean');

% Get contrasts from original design

xCon = get_contrasts(D);

% Estimate design on ROI data

E = estimate(D, Y);

% Put contrasts from original design back into design object

E = set_contrasts(E, xCon);

% get design betas

b = betas(E);

% get stats and stuff for all contrasts into statistics structure

marsS = compute_contrasts(E, 1:length(xCon));

Best regards,

Sharon

Hi Sharon,

DeleteI don't recognize some of the functions in that script (e.g., set_contrasts); maybe they are part of the Marsbar library, but I haven't been able to find them.

It does look like it extracts beta weights, and if you get it to work it should do the same thing as in the videos. Another option is to use the spm_get_data command (http://andysbrainblog.blogspot.com/search/label/spm_get_data).

Best,

-Andy

Hi Andrew,

DeleteThanks for your reply.

Yes, I make the script worked and it can extract the parameter which is looks like beta weights. In fact, the result has little difference between the scripts and videos (e.g., 0.188869511 and 0.163862783 for one subject in one contrast).

But the tendency of the results is the same, thus I think I can use the script to extract the beta weights in an easy way.

(I guess the copy script is part of the Marsbar library, http://marsbar.sourceforge.net/faq.html).

Best,

Sharon

Hi Andrew,

ReplyDeleteI want to ask about the extracting data from ROI.

I have 2 level analysis (to compare 2 groups, VBM analysis). I have saved one cluster (ROI) from the contrast (1st group-2nd group). I want to extract the beta values to performe some correlation (this ROI (beta values) with some behavioral measures. Could you give an advice- should I use the option ,,scaling from -raw values, 0) or use some scaling in Marsbar? What is the difference?

Bests,

Natalia

Hi Natalia,

DeleteThe scaling options in Marsbar are similar to what SPM does with intensity for the FMRI scans; however, since the data you're working with has likely already been scaled (since you've preprocessed it), I would stick with the "raw" option.

Best,

-Andy

Thanks Andrew for your replay! I will use the ''raw'' option according to your advice.

ReplyDeleteBest regards,

Natalia

Hi Andy,

ReplyDeleteThanks so much for the helpful tutorials! I'm running my ROI analysis at the first levels because the mask created at the second level by SPM for some reason is excluding a particular region I'm interested in(ventral striatum). I've followed the same steps for parameter extraction that you supply for second level, for the first. The only problem is, when I go to view my beta value for a given contrast(SPM.marsY.Y) I expect to get a single beta value, equivalent to the beta value I see for that same individual when I do SPM.marsY.Y at the second level. Instead, I get a list of large values(on the level of hundreds) which seem to correspond to every timepoint). Unfortunately my contrast weights aren't as simple as 1, so it isn't the case that my contrast value in marsbar stats table is the same as my contrast value. Is there a quick way, similar to SPM.marsY.Y to get the beta value for an ROI at the first level? Thank you!

Sam DeWitt

Hi Sam,

DeleteIn that case, you can try using the command spm_get_data, which will extract values for each voxel for a given ROI. You can then average across all of those voxels using Matlab's "mean" command; see this post for steps how to do it, and let me know if you have any questions!

-Andy

Hi Andrew,

ReplyDeleteThanks for the info! Do you a good way to generate a peri-stimulus histogram using spm?

Omri

Hi Omri,

DeleteAfter you have loaded a contrast through the "Results" tab and thresholded it, you will click on the following buttons:

plot (located under the Display header) -> Event-related responses -> select your regressor -> plot in terms of fitted response and PSTH

This will create a PSTH at the selected voxel with estimates of the activity at each scan following the onset of the stimulus, along with error bars representing the amount of variance around the estimate. A dashed line is superimposed on the estimated timecourse, representing the best estimate of the HRF's amplitude at that voxel.

To explore other voxels, you can click and drag the red arrow in the MIP window (maximum intensity projection; the three panes at the top of the results screen showing the activity projected onto a glass brain); the PSTH will automatically update according to where your cursor is pointing.

Best,

-Andy

Hi Andy, the video you posted regarding the parameter extraction was very helpful. I am also trying to extract the percent signal change from the ROIs for each of my contrast (e.g., condition 1-baseline) using MarsBar. Did you post anything with regards to this? Thanks a lot.

ReplyDeleteHi Andy,

ReplyDeleteThank you for your video which is very helpful. I am running into issues trying to extract ROIs in very frontal regions, as some of the voxels might be outside the brain for some subjects. Even though I have implemented their suggestion, I can't get it to work:

roi_filename = 'my_roi.mat';

my_roi = maroi(roi_filename);

my_roi = spm_hold(my_roi, 0); % set NN resampling

saveroi(my_roi, roi_filename);

Would you have any ideas on how to fix it?

Many thanks in advance,

Lucia

Hi Lucia,

DeleteTry this ROI approach instead: http://andysbrainblog.blogspot.com/2014/07/quick-and-efficient-roi-analysis-using.html

When you calculate the mean across the ROI, omit the NaNs; e.g., mean(spm(get_data(P, XYZ), 2, 'omitnan')

Best,

-Andy

Hi Andy, thanks for your help. In the end, I made a very tiny edit to the original Marsbar code which fixed my problem.

DeleteIn C:\spm12\spm12\toolbox\marsbar-0.44\@maroi there is a script called: get_marsy.m.

In line 76, you can force NN sampling, by adding 'n' to the command:

[y vals vXYZ mat] = getdata(o, VY,'n');

This fix seems to ignore NaNs at the edge of the brain.

Thanks again for your suggestions!

Best wishes,

Lucia

Hey Lucia, that's good to hear; glad you got it to work!

Delete-Andy

Hi Andrew,

ReplyDeleteI have tried your method to extract betas values from a contrast. SPM says I have 9 clusters, but Marsbar tells me 6. I found out that MarsBar keeps ignoring my 3 clusters that show hypoactivations (negative activations). Even when I give it the coordinates, it acts like there is nothing there and it selects the closest activated voxel (which is not what I want).

Do you have any idea how I can get these clusters?

Thanks a lot,

Nick

Hi Nick,

DeleteHere are a couple of suggestions:

1. Flip the contrast so that the hypoactivations are positive, and then extract from those clusters (being sure to flip the sign of the values that you extract).

2. Try the command spm_get_data, which I describe in this post: http://andysbrainblog.blogspot.com/2014/07/quick-and-efficient-roi-analysis-using.html

Best,

-Andy

Thanks you very much for your answer!! :)

DeleteHI

ReplyDeleteGreat blog!

I have a question regarding correction for ROI analysis.

If I have an apriori assumption of 10 ROIs, after extracting the betas for each subject using MarsBar. I ran a 2*2 repeated factorial analysis with SPSS. Most regions show a significant main effect and 1 shows an interaction p=0.03.

My question is how do I correct for these multiple ROIs? Bonferroni (dividing by 10)will allow only a p<0.005, which is way too strict.

What would you suggest?

Hello me,

DeleteYou will need to do some kind of correction for multiple tests. A Bonferroni correction may be too conservative, as you say, especially if the ROIs are correlated.

Unfortunately, I don't know of a method that is more lenient for that kind of correction. I would ask a statistician for more options, or restrict your analysis only to those ROIs that are absolutely essential for your story.

Best,

-Andy

This comment has been removed by the author.

ReplyDeleteHi Andy,

ReplyDeleteCould you help me with a question about parameter estimates at 1 level within particular ROI in MarsBar? I want to extract a parameter/ value for single subject for a specific contrast within particular ROI and than correlate this value with behavioral measures. My task - Mix Design (1 and 2 back conditions). At the 1 level in the model I have 1 back condition, 2 back condition and head movements as a regressor.

I have done my analysis as follow:

1) Created ROI as a sphere (for example precuneus) and used this ROI as a mask to see the results within particular region for single subject for one contrast (for me it was 2back-1back contrast)

2) Wrote this ROI for each subjects

3) Design- set design from file (252 scans, timeponits)

4) Extract ROI (full options), raw data (0)

5) Results- estimate and save results to file

As a output I get 252 values (each value 700-900- more than hundreds) for single subject. I am wondering if I did something wrong. I am not sure also what represent each value- it is not a beta value, am I correct? How can I interpret results (values more than hundred)? Whether it could be raw (unstandardised) values of b regression coefficient (in other words: regression coefficient in in the original measurement units)? Can I export these values to SPSS and calculate the mean for each subject?

Many thanks in advance,

Natalia

Hi Andrew, can you direct me to any documentation that clearly explains how the BOLD signal is transduced in SPM into Beta values/parameter estimates? I have extracted significant clusters from an SPM analysis and created ROIs in MarsBar, which gave me an excel file with mean values for each experimental condition which I then analysed further in SPSS. I am really struggling with the concept of positive and negative values and what they mean. I know that fMRI is different to EEG in that a more positive value always indicates more activation (as opposed to more negative also being greater activation).. But I don't know why and how these values come to be as they are. Are you able to explain this for me at all?!

ReplyDeleteHey there,

DeleteAssuming you're modeling the BOLD response with a Gamma function, the beta weight would be the height of the Gamma. Usually we only have to estimate one parameter: its height. Under conditions where there is a more neural activity and thus more signal, a better fit to the BOLD signal would be represented by a greater beta-weight for the Gamma function.

All of this is relative to a baseline, which you can think of as the average signal when the subject isn't doing anything - isn't making any responses, isn't thinking about any of the experimental conditions. (There are variations between software packages in how the baseline is modeled, but that's the general idea.) If the BOLD signal in a voxel is below this baseline for whatever reason, such as neurons in that voxel being inhibited from firing, or because the bloodflow in that voxel is less relative to other regions, then the best fit would be from assigning a negative beta weight to the Gamma function.

Unless you are looking at the beta weights for individual conditions (e.g., simple effects), negative results should be interpreted with caution. If you are looking at a contrast like A-B, a negative value could be because A is positive and B is negative, or because both are positive but A is less than B. You would need to examine the beta weights of each to determine what is driving the contrast.

Hope this helps! This concept drives a lot of people nuts; you are not alone.

-Andy

I've been struggling to interpret my negative marsbar estimates for hours and hours and hours for my dissertation and I am honestly overjoyed to have just found your page and this explanation! Thank you.

DeleteHi Andrew,

ReplyDeleteI don't know if you are familiar with Freesurfer analysis (I hope you are!). I used this program to make group analysis with structural data (MCI vs Control). I also analyzed fMRI data with SPM with these same subjects. My plan is to investigate functional activity where there are group differences in thickness. Is there a way to make a ROI using Freesurfer and to transfer it into SPM/MarsBar format (.mat) so I can get the functional beta values in this ROI?

I tried to make functional ROIs with MarsBar by taking the coordinates of the thickness clusters, but the size and shape of those ROIs are kind of arbitrary. Do you have anything to suggest?

Regards,

Nick

Hey Nick,

DeleteYou can do this with tksurfer and mri_label2vol. First, open a template brain with tksurfer; for example, if your activation is on the left hemisphere, open up an inflated template to display it on: tksurfer fsaverage lh inflated.

Then click on the region you want, click the custom fill button (it looks like a bucket pouring paint), and select the option "Up to functional values below threshold." Click "Fill," then File -> Label -> Save Selected Label. Think of a label as an ROI on the surface.

Now you can use mri_label2vol to convert the label to a volumetric ROI (in this example, I'm using the TT_N27.nii template that comes with AFNI, and I'm using a label in the LIFG that I created from a surface ROI):

mri_label2vol --label LIFG.label --temp TT_N27.nii --regheader TT_N27.nii --o LIFG2Vol.nii

Hope this helps!

-Andy

Hi Andrew,

ReplyDeleteI have one question.

So I want to extract the mean activation for specific ROIs, as you did in that video.

My goal is to perform regression between some behavioral data and the mean of the activity of each subject for a specific ROI and for a specific contract that I have defined in my SPM mat e.g. Cond1> con2.

E.g. Plot with x axis : age and y axis : mean activity of a specific ROI for a specific contrast A>B

So in order to get these mean activations for specific ROIs I was thinking about using marsbar as you did in this video.

My question:

What do the final Y values represent?

Is it the mean activity, the beta values or values extracted from the spmT images?

Thank you in advance,

S

Hey Serafeim,

DeleteY is a variable containing the contrast estimate averaged across all the voxels in your ROI. Whether it is a beta value (i.e., parameter estimate) or a T-value depends on what image you are extracting from - if it is the contrast image then it will be the contrast estimate, if it is the t-image it will be the t-value, and so on.

Best,

-Andy

Hi Andrew,

ReplyDeleteThis is a great site. I'm using Marsbar for the first time and it has helped me a ton.

I have a question about the average activation I am getting for each of my ROIs. So I've followed the instruction to obtain the contrast means from SPM.marsY.Y and got a value for every participant in every ROI. But I have two design files I am comparing. Both have the same subjects but with different covariates that I used in the 2nd level analysis (i.e. I am running a multiple regression on one of my con maps with a covariate of choice). Basically I want to see the difference in mean activation of the ROIs between my two different designs (i.e. covariate in first design matrix is age and covariate in second design is weight). But when I run everything, I get the same output for both designs. Why is that? Should I be doing something differently?

Sorry if it is a little confusing. Please let me know if I should clarify anything.

Greatly appreciate your help!

-Nicole

Hi Nicole,

DeleteTry clearing the variables values by typing "clear" at the Matlab prompt before you run another ROI analysis; maybe that will solve the problem.

Best,

-Andy

Hi Andy,

ReplyDeleteFirst of all, your blog is amazing!

Second, I need your help! I need to work on really old fMRI data (~2000). All the scans have been analyzed with SPM (version SPM 99 I think) and I can't seem to open the design matrix with my SPM12 version. Also, I wouldn't know exactly how the experiment was made. What I want is get the activation map image (after SPM analysis) and extract coordinates and t-values for each voxel that has t statistics bigger (or p-value smaller) than a certain value of my choice and save it in a txt file. (I could extract all coordinates and tvalues for all voxels and then choose the one I want accordingly). I have this image (I think it should be the spmT_000x.hdr) and I can open it. I was thinking of repeating the analysis with FSL FEAT but as I said before I have no idea how's the design of the experiment and since the images are old, FSL automatically appoints a TR of 1s and I know this TR is wrong. I tried using fslmeants command to extract the information I want but I don't know the criteria that FSL uses in chosing the voxels, plus it does not extract the t values(or z scores) but the signal intensity of the voxel (which I am not too sure what this means in the spmT_000x.hdr image).

Any way you could help me out?!!

Thank you for your help!

-Jess

Hi Jess,

DeleteAre you still able to open the results? If so, then you can threshold it, see the overlay map, and then type "xSPM.XYZmm" into the Matlab terminal. This will return a list of the coordinates of each superthreshold voxel. If you want the associated Z-value, type "xSPM.Z" into the terminal. I don't know how to return t-values; maybe you could do some kind of Z-to-T conversion based on degrees of freedom.

-Andy

Hi Andy!

DeleteWhich is the overlay map? When you say superthreshold voxel what do you mean? How do I set the minimum z-score?

Thank you again

-Jess

Hi Jess,

DeleteWhen you click on the "Results" button, you can open an SPM.mat file and its associated beta and contrast images. You weight the contrasts to create the contrast you want (e.g., a contrast vector of [1 -1]), and then threshold it at whatever p-value you want - for example, 0.05. This will create a maximum intensity projection (MIP) map that shows which voxels remain after the thresholding - what I have called "superthreshold" voxels. You can then return the location of each with xSPM.XYZmm, and the z-score for each superthreshold voxel with xSPM.Z.

-Andy

Unfortunately when clicking "Results" and trying to load the SPM.mat file it doesn't load..it seems like it doesn't read the file.. any idea how to convert the SPM.mat in a readable format for SPM12?

DeleteHi Jess,

DeleteUnfortunately, I don't know how to convert it; maybe you could download an older version from the SPM website, and try loading it from there? I know that the xSPM structure is generated in SPM5 at least. Give it a try.

-Andy

Hi - I LOVE this site and your YouTube videos are even BETTER, if that were possible!

ReplyDeleteMy question: I have a 2way design (two groups; two treatments) and I see a nice cluster in a functionally relevant area in the SPM interaction. Can I extract the parameter estimates from this cluster to investigate the direction of effects?

Thanks for your help,

Anj

Hey Anj,

ReplyDeleteThanks for the kind words! I hope you've found everything useful!

Regarding your question, it would be better to extract your parameter estimates from an independent ROI - either one that's been defined by a cross-validation approach (i.e., leaving one subject out of the model estimation and extracting the resulting parameter estimates for that subject from the resulting cluster), or by an anatomical region through the WFU atlas or any other atlas, or by an ROI based on results from another study. There are other approaches, but these are three of the most popular ones.

I understand why you want to look within that cluster just to see the direction of the effects; however, depicting your ROI results (which you should do, to give a sense of the size of the effect) will probably give an inflated estimate of the effect size, since you're only looking within voxels that are showing a strong effect.

Think of it this way: If you're doing a behavioral study and you see a significant interaction effect for the group, that's great; however, it's not likely that everyone showed a significant effect. If you then decided to only look at the subjects who had a significant interaction and then reported the size of that effect, that will give a biased effect size. It's analogous to how the voxels are being selected here, and how the interaction effect would be reported.

If you absolutely cannot find any way to look at those effects within an independent ROI, then you may decide to show the interaction effect within the significant ROI, but only with caveats that it is a biased analysis, and that the effect size is uninterpretable. There is a debate over whether you should or shouldn't do it; I tend to be more lenient, but that's because I'm such a nice, swell person.

-Andy

More about circular analyses here: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2949251/pdf/jcbfm201086a.pdf

thank you so much for your detailed reply. VERY helpful indeed!

DeleteAnj

Hey!

ReplyDeleteFirst, thanks for all yours tutorials and clear explanations.

I have a little question concerning the beta. When I extracted the beta using marsbar, I get some wired values compare to what I am use to see..

So my question is: Is there a specific range for those beta values (for example between -2 to 2) or not?

Is that correct to get beta value close to 20 or -20?

Thanks a lot.

RÃ©mi

Hi Remi,

DeleteBeta values (or parameter estimates) of more than 2 are suspect; most values are within the -2 to +2 range, and for subtle effects beta values of less than 1 are common.

The only times when I see beta values in the >10 range is when I'm only looking at the group-level result of three or four subjects, and there is a lot of variability in the parameter estimate. Sometimes I do get an unusually large beta value for a single subject, and it's not always clear why; however, if you're getting that consistently for everyone, it may be an issue with one of the following:

1) Your scan quality; e.g., unusually large spikes for that condition, which may be correlated with motion or something else; or

2) Not modeling everything that could explain the variance, so that a particular beta value is picking up variance associated with some other condition or confound that isn't included in the model.

Best,

-Andy

Thanks for your fast reponse.

DeleteBest.

Hi Andy,

ReplyDeleteYour blog/youtube videos have been so helpful and instrumental to my fMRI education. Thanks heaps for simplifying such complex concepts!

I have a few questions about extracting ROI beta values using Marsbar:

1) Based on your video, it looks the ROI beta values were extracted from each subject's contrast image (N=14; generated at 1st-level) that went into a 2nd-level model. Is this correct?

2) If so, then each row in 'SPM.marsY.Y' is a beta value corresponding to each subject. Beta values are listed in the order at which contrast images (belonging to each participant) was listed in the batch file used to create your 2nd-level model. For example, if first contrast image in 2nd-level model belongs to subject P005, then first beta value in SPM.marsY.Y belongs to subject P005 too. Is this right?

3) What exactly does each beta value show? Does it tell you the 'mean beta value across a specific ROI' per contrast image/participant -- or in other words, 'mean effect size across a specific ROI' per contrast image/participant?

4) If so, then I suppose I can use the 'mean beta values' to answer this research question: "Is the magnitude/effect size of left IFG activation significantly correlated with emotion recognition accuracy (behavioural measure) from an in-scanner task?"

5) When would you extract beta values for ROI regions from a single-subject 1st-level model? I did this to see what the output would look like for one participant. I thought that this would allow me to check whether the beta values I extracted from the 2nd-level model corresponded to beta values extracted from each subject's 1st-level model. Instead, with the 1st-level model, I got beta values for each brain volume (e.g., 121 EPI files, hence 121 beta values) in the range of >700. Clearly this doesn’t align with the beta values extracted from the 2nd-level model.

6) I guess exploring the 1st-level stuff threw me off, and I became confused about which model to use to extract beta values. For example, do I stick with the method highlighted in your video (extracting beta values for each subject from 2nd level model), or do I extract beta values per brain volume from a single subject's 1st level model, then average them to get a mean beta value for that subject?

I hope my questions make sense. Sorry if you may have already answered some in previous posts—I just wanted to be absolutely sure before drawing further conclusions. Thanks heaps for your time.

Val

Hey Val,

DeleteI will respond to each of your numbered questions using numbers, to make me seem cool and connected like the other people answering questions on the neuroimaging listservs:

1. Yes

2. Yes, it should be in order

3. Each number is the parameter estimate averaged across all the voxels in the ROI. Typically it's the amplitude of the HRF that is estimated to best fit the model to the data. This isn't the same thing as mean effect size; that's a different concept.

4. Yes, that is a common method called "brain-behavior correlation." You would plot a pair of data points for each subject, one from the mean beta for the ROI and the other from the behavioral measure (or other auxiliary measure) that you have. Then, run the correlation and see what happens.

5. I can't think of a scenario where you would extract betas for each timepoint. (Someone may have a different idea of how to use them.) If you want to check the 2nd-level betas against your 1st-level betas, I would instead recommend using something like spm_get_data. There's a tutorial for it here: http://andysbrainblog.blogspot.com/2014/07/quick-and-efficient-roi-analysis-using.html

6. Stick with extracting the data using the method I showed. It doesn't actually use the 2nd-level data per se; it simply uses the list of beta images that went into estimating the 2nd-level model, and then goes into each subject's directory and averages the beta values for each subject across that ROI.

7. Honestly, I haven't used Marsbar for a very long time. The spm_get_data approach is more straightforward and is easier to script, so any questions about the nuts and bolts of Marsbar I have probably forgotten. I'm planning to do an ROI analysis video soon (one of my infamous "in preparation" videos), and I hope it will clarify some of these issues.

Best,

-Andy

Hi Andy,

DeleteThanks heaps for taking time out to answer my questions. Your advice has helped a lot! Keep up the good work with your blog + videos. All the best!

Val

Hi Adrew! Congratulations for your blog!

ReplyDeleteI would like to know what is the difference between the ROI parameter estimates extracted with Marsbar and the VOI extraction routine in SPM/Util. Should the mean of the VOI timeseries for a given individual in a given contrast be the same as the average parameter estimate extracted with Marsbar using the same ROI (supposing the location of the VOI is fixed and has the same extent)?

Thanks a lot for any help!

Clara

Hi Clara,

DeleteSPM's VOI analysis, according to the manual, is "the first eigenvariate of these time courses, i.e., the first principle component resulting from a principal component analysis."

Do you like being talked to like that? Do you like how the manual assumes you would know why SPM does a principal components analysis, instead of simply averaging across the values of all the voxels, and so doesn't bother to give you an explanation? I don't understand why they do it that way either.

The VOI analysis should give you results nearly identical to Marsbar, or with extracting data using a command like spm_get_data (see the post here: http://andysbrainblog.blogspot.com/2014/07/quick-and-efficient-roi-analysis-using.html). I prefer either using Marsbar or spm_get_data, since there is no eigenvariate hocus-pocus going on, and I have a better idea of why I get the results that I do.

If, in the future, you're ever unsure of what method to use, remember:

1) The word "Avoid" contains the letters VOI; and

2) spm_get_data can be rearranged to spell "get at damps."

Best,

-Andy

hahaha great! Thanks so much for the Ashburner-to-English transaltion, I don't know what we would do without you!;)

DeleteDear Andy,

ReplyDeleteThis may be a silly question, but let's go:

I have two conditions in my design, A and B. When I extract the contrast parameters for contrasts A>0 and B>0 separately and average across subjects, I see that, let's say, condition A has larger value than condition B. On the other hand, when I extract the parameter estimates of the contrast A>B, I observe a positive value, however much larger than the difference of the parameters obtained from the A>0 vs B>0 contrasts. Could you explain me why?

Thanks a lot!

Rebecca

Hi Rebecca,

DeleteIs condition B negative in this case? That may be why; else, it could have something to do with Marsbar. Nowadays I use a different approach by extracting the data directly from the ROI with spm_get_data.

Best,

-Andy

Thanks for the quick reply Andy!

DeleteYou are right in that a negative parameter estimate for B would give the observe difference, but in this case is positive. I used rfxplot. Do you mean, you extract the values for the ROI from the con images of each subject?

Hi Rebecca,

DeleteJust to make sure, are you looking at the raw parameter estimates, and not the t-values? That may explain the difference.

Unfortunately, I don't have much more insight than that; in my experience, if you extract the raw parameter estimates for a single subject and take the difference between them, you should get the same value as with the contrast map for A-B.

-Andy

OK, I am looking at the t values (from the con images)... that may be why?

DeleteRebecca

I think so!

DeleteDear Andy,

ReplyDeleteI’ve found the videos and discussion on your blog most useful. Thank you!

I would like to follow on this thread because I have a concern related to it that I was hoping you could help me with.

I would like to plot effect sizes (or contrast estimates shall these be comparable) for a given contrast/ROI across participants. The tricky issue is that effect sizes would have to be estimated from 1st level analyses. This is due to the fact that I only have 3 participants (case studies) and statistics concerns only 1st level analyses. I should also note that one of these participants has a slightly different experimental design, i.e. he has one condition (should be read contrast) less and the other contrasts in common are estimated differently (different parametric parameters).

Because no 2nd level analyses is possible, what I’d like to do is to plot in the same graph the effect sizes of a given contrast of all participants, so that I could have a visual depiction (comparison) of activity for that contrast in each subject/ROI.

My question is how to estimate effect sizes, or something equivalent, from a 1st level analyses? The Y matrices that I get give me activity in each voxel for each time point and not per subject.

So far what I’ve done was to extract individually for each participant, ROI and contrast, the parameter estimates and confidence intervals from the Marsbar SPM graph constrast estimate function. Then I’ve grouped them according to each contrast.

Any advice you may give me on this matter would be greatly appreciated.

Many thanks,

Rub

Hi Rub,

DeleteI don't know much about calculating effect sizes for single subjects, so I can't say anything definitive. However, you can extract contrast estimates from the same ROI for each subject, using this technique here: http://andysbrainblog.blogspot.com/2014/07/quick-and-efficient-roi-analysis-using.html

As for plotting the standard error around the contrast estimate, I don't know of any easy way to do that with SPM. The ResMS file is the error variance for the full model fit, not for an individual parameter estimate. You would need to do some kind of individual estimation for each beta weight for each trial, similar to AFNI's IM (individual modulation) option with their GLM. That may be worth looking into.

-Andy

Hi Andrew, thanks for the helpful video tutorial. I extracted beta values for two different experimental conditions separately (each of them against the implicit baseline). When I compare the the means (across all subjects) from the extracted values they barely differe in size. However, when I look at activation maps within SPM one shows activated voxels within my ROI (FWE, p< .05) while the other doesn't (no voxels survive). To me it seems as the beta values don't match/represent the activation maps I get in SPM. Could you think of anything I do wrong? Or maybe of an explanation of this difference? Thanks in advance

ReplyDelete