Tutorial 0: Stats Refresher

Goals

  • To refresh knowledge of statistics

  • To learn how to understand and present data intuitively through well-chosen graphs

  • To develop a foundation in familiar statistics upon which to build an understanding of fMRI statistics

Relevant Lectures

*UPDATE LECTURE SLIDES

Accompanying Data and Question Sheet

*UPDATE TUTORIAL DATA

Tutorial 1 Data

Tutorial 1 Questions

Background

This tutorial will provide a refresher on basic statistics principles, which we will later build upon to understand the role of statistics in fMRI analysis. In general, experiments manipulate one or more (independent) variables and measure the consequences on one or more (dependent) variables. In the case of fMRI, we specifically manipulate the stimuli and/or task and we measure the effect on brain activation.

While the statistics required for fMRI experiments can seem daunting at first, the statistical tests that are commonly used are the ones you will likely already be familiar with, such as t tests, analyses of variance (ANOVA), and correlations. In fMRI, the added complexity comes from the way we extract activation data to be subjected to these tests. When analyzing fMRI, there is much more data than with other approaches. The data also has certain properties that can lead to violations about statistical assumptions. However, before diving into the complexities of fMRI statistics, we will cover some basic statistical principles in this tutorial. Here we will begin by exploring our intuitions about statistics. We will then explore statistics for between-subjects designs, followed by within-subjects design. Next we will cover the problem of multiple comparisons, and then how to understand interactions. Lastly, we will apply all of this to the interpretation of fMRI data.

Two Levels of Analysis for fMRI

First level of analysis

In the first level of analysis, we extract estimates of the activation levels for each subject for each condition for each unit of analysis. The units of analysis are either individual voxels or regions of the brain.

Second level of analysis

In the second level of analysis, we perform statistical tests on the outputs from Step 1, such as t tests.

Starting with Intuitions

Figure 0-1. Effects of hypothetical Drug X on Intelligence.

Statistical evaluation of data relies upon the size of the effect, the amount of data, and whether the study compared effects between different groups or within a single group.

Imagine that the figure on the right shows that a new drug, Drug X, is said to improve intelligence. Focusing on statistical logic, what would you need to know before deciding whether you should take the drug?


 

Between Subjects Example

In this example, 12 participants receive a placebo and 12 participants receive Drug X. Afterwards, IQ is measured.

Generating Simulated Data: Null Result

  1. Open the file StatsTutorial_n=24_Between.xlsx and go to the tab Between n=24 NULL

    The data in this sheet were randomly generated in Excel as samples from a population with known parameters (mean = 100 and standard deviation = 15 for both groups).

  2. In Excel, go to Formulas and click on Calculate Now multiple times. Look at the Actual Mean and Standard Deviation values each time you click. What do you notice about these values?

Generating Simulated Data: Known Difference

  1. Navigate to the tab Between n=24 DIFF.

    The data in this sheet were randomly generated in Excel as samples from a population with known parameters, where the mean differs between both groups.

  2. Now click on Calculate Now multiple times. Look at how the sample means and standard deviations vary after each click.

BONUS QUESTION: How would you determine if the effect is statistically reliable?

Exercise: Exploring Data

Figure 0-2. Descriptives tab on JASP

Good scientists look at their data before running any tests.

  1. Open the app JASP. If you do not already have JASP installed, you can download it here.

  2. Click on the menu, then Open, then Computer, then Browse. Select the file Between_n=24.csv.

  3. Explore the features of the data by clicking on the Descriptives tab. Move the variable IQ to Variables to set it as your dependent variable of interest, and move the variable Group to Split to look at a statistical description of IQ, separated by group. You can do this by either dragging the variable name or using the arrow buttons.

Exercise: Quality Assurance

Next, we will look at plots of the data so that we can visually inspect it.

  1. Within the descriptives window, click Customizable plots. Then check Boxplots, and check the settings Violin element, Jitter element, and Label outliers.

    From the plot, our visual assumptions tell us that the distributions look normal, there are no outliers, and that the variance looks similar between groups.

Exercise: Independent Samples t test

An independent samples t test can tell us if the distributions are different between conditions, and if this difference is meaningful in light of how variable the distributions are. In other words, what is the likelihood that this effect could arise purely due to chance?

  1. In JASP, navigate to the T-Tests tab and select Independent Samples T-Test.

  2. Move IQ to Dependent Variables and move Group to Grouping Variable.

  3. Under Additional Statistics, select Raincloud plots.

    Bonus question: What is this plot telling you?

  4. Under Assumption checks, select Normality, Equality of variances, and Brown-Forsythe.

Viewing Functional Slices

  1. Next click File/Open... , select sub-10_ses-01_task-Localizer_run-01_bold.fmr , and open the file.

Essentially, the FMR (Functional MR) file is a text file containing information about the functional scan, including information about the spatial and temporal resolution.

Figure 1-7. Functional slices shown in a 2D matrix (.fmr file)

Figure 1-8. The fMR properties show the key details about the spatial and temporal resolution of the scan.

 

Bonus question: Try opening sub-10_ses-01_task-Localizer_run-01_bold.fmr in a text editor like Notepad or TextEdit. What information is included in the file? Most of this information is also displayed in the FMR Properties window which opens automatically when opening the FMR file.

Question 2: Look closely at the FMR Properties window. (Note: If you've closed this window, you can open it again using File/Document Properties/FMR Properties)

a) What is the temporal resolution (TR)? How many time points (i.e., volumes) were sampled in this run? Given the number of volumes and the time it took to collect the volume (TR), how long in minutes and seconds did this run take?

b) The number of skipped volumes is 0. What are skipped volumes and why is it essential to fully understand whether your scanner saved the initial dummy scans or not?

c) What was the original or “raw” spatial resolution of the functional scan? Are the voxels isotropic or nonisotropic?

Opening an FMR (text) file also automatically reads in the associated STC or Slice Time Course (data) file (in this case Sub-10_ses-01_task-Localizer_run-01_bold.stc). Keep in mind that a functional scan involves multiple time points and therefore functional data is comprised of mulitple slice arrays (volumes) over time. Although, opening an FMR file will show you the array of functional slices for the first time point only, we can visualize the 4th dimension (time) by watching the arrays as a movie.

4) Close the FMR Properties window , then select Options/Time Course Movie . Then click Preload All , wait roughly 5 seconds, and click > to visualize each the functional data over time.

Click the First<->Last button to toogle between the first image that was acquired and the last one.

This is a simple, important step for performing basic quality assurance of your functional data.

Question 3:

a) What might you determine by viewing the Time Course Movie? Select all that apply.

  1. You can determine whether the participant moved during a run.
  2. You can determine in which areas of the brain were active during the scan.
  3. You can determine whether there are susceptibility artefacts.
  4. You can determine whether there were any scanner malfunctions.
  5. You can determine what the participant was thinking about.

b) Do you think this is good quality data? Why or why not?

Figure 1-9. Time course movies allow you to visualize functional volumes over time to check for head motion and other artifacts.

Viewing Anatomical Volumes

5) Click Open , navigate to the folder containing the tutorial data, select sub-10_ses-01_T1w.vmr , and open the file.

 

Figure 1-10. Anatomical data shown in a 3D volumetric view (.vmr file)

 

This VMR provides a 3D view of the anatomical scan generated by "stacking" the 2D slices in a third dimension. The VMR shows three orthogonal planes (sagittal, coronal, and horizontal) centred on a single point (the white crosshairs). Try moving one of the crosshairs to change the view! Note that the views in the other two slice planes change accordingly. It is much easier to get your bearings in a 3D view (the VMR) than the 2D slice arrays (the AMR), which is why we'll be using only the VMRs from this point forward.

Click File/Document Properties/VMR properties .

Similar to the FMR Properties window (functional slices), the VMR Properties window can give you important information about your data.

Question 4:

a) In what type of view are the images present in? To what side of the brain does the left side of the image correspond to in the coronal view? Fill in the blanks.

The images are presented in the __ view, which means that the __ side of the image in the coronal view corresponds to the __ side of the brain.

b) What is the spatial resolution of the image? Select all that apply.

  1. 1 mm isotropic
  2. 1 mm3
  3. 1 x 1 x 1 mm
  4. (1 mm)3
  5. 1 mm x 1 mm x 1 mm

c) How many time points does this file have?

  1. 1 time point
  2. 340 time points
  3. 680 time points
  4. None of the above

Now that we have the anatomical scan in 3D ( VMR ), we also want to look at the functional scan in 3D (VTC ).

Figure 1-11. Showing VMR propeties.

Viewing Functional Volumes

6) Click Analysis/Link Volume Time Course (VTC) File... and select the file sub-10_ses-01_task-Localizer_run-01_bold_256_trilin_2x1.0_NATIVEBOX.vtc .

Figure 1-12. To use or visualize functional data, after opening a .vmr file, link it to a .vtc file.

The VTC file provides a 3D view of the functional scan, and, similar to the VMR file, is generated by "stacking" the 2D functional slices in a third dimension. In addition to stacking, the VTC file undergoes two other types of transformation. The functional data is first resampled to a resolution of either 1, 2 or 3 mm isotropic, and then it is aligned to the anatomical data. This will allow us to use the participant’s brain anatomy to guide preliminary functional analysis.

Seeing as we wish to focus more specifically on data analysis, steps invovled in generating the VTC file will be done for you. For now, step 6) allows you to link a VTC that we have generated for you to the anatomical data (i.e., the VMR file).

Open the VTC file properties by clicking File/Document Properties/VTC properties .

Question 5:

a) What is the spatial resolution of the functional image? Select all the correct ways of reporting the spatial resolution of this functional image.

  1. 8 mm
  2. (2 mm)3
  3. 2 x 2 x 2 mm
  4. 2 mm isotropic
  5. In-plane resolution of 2 mm with a slice thickness of 2 mm

b) Compare the spatial resolution from the DICOM file (Figure 2 at the very beginning of this tutorial) with the spatial resolution of the VTC file. In one sentence, why are they different?

c) Now, compare the spatial resolution of the VMR(anatomical volume) and VTC (functional volume). How many anatomical voxels would fit in one functional voxel?

  1. 1 voxel
  2. 2.5 voxels
  3. 2 voxels
  4. 4 voxels
  5. 8 voxels
  6. 15.625 voxels

Differences between functional and anatomical volumes

Before comparing anatomical and functional images, we will introduce you to a useful tool called 3D Volume Tools.

7) Click on the blue box at the top of the menu bar on the left side of your screen (hereafter affectionately called "blue box mode"). The 3D Volume Tools window will appear in minimized dialog box, which you can change to the full dialog box by clicking Full Dialog.

 

Figure 1-13. You can visualize and control many features of 3D volumetric data by opening “blue box mode”.

Figure 1-14. The reduced window for blue box mode shows only the 3D coordinates. To expand the view, click the “Full Dialog >” button.

 

The first thing you will notice is the x, y, z coorinates in the 3D Coords tab. When moving the cursor, you will notice that the coordinates displayed in the window change according to the cursor's position.

Question 6: Which axis (x, y, z) correspond to each direction: front-back, up-down and left-right, anterior-posterior, dorsal-ventral?

Figure 1-15. The full window for blue box mode gives many more options.

8) Next, go to the Spatial Transf tab, and look at the section called Show a volume of attached VTC data.

As mentioned above, once you've attached the functional data to the anatomical data, you can go back and forth between the two types of images. If you click on Show VTC , a functional volume will be displayed instead of the anatomical volume(Note: there is a quicker way of doing this in the next paragraph). Furthermore, remember that functional data has a fourth dimension, namely time. In order view functional volumes at different time points, simply change the number on the right of the Show VTC button to the desired volume.

In the same section, there is a box labeled Trilinear interpol. Try checking and unchecking this box and using the Show VTC button after each change. (Hint: Use the short key ctrl+t to toggle from a 3-slice to single slice view.) Notice that checking the Trilinear interpolation box makes the image look much smooth, whereas leaving it unchecked makes the image look more pixallated. We will keep the Trilinear interpol. box unchecked in future steps and tutorials to help you keep in mind that the actual data is pixellated (voxelated?).

Figure 1-16. To visualize one volume of the 3D functional data, click “Show VTC Vol” for the volume number you want to see.

Figure 1-17. Sagittal slice without trilinear interpolation

Figure 1-18. Sagittal slice with trilinear interpolation

Finally, it's important to remember that, although they overlap a great deal, anatomical and functional images are different. This can be easily seen when toggling between the anatomical and functional images. To toggle between different types of views, press F8 . These differences become even clearer once we strip the images of useless voxels outside of the brain.

9) Click Volumes/Extract Brain from Head MRI Volume .

Question 7: Toggle again between the VTC and VMR. Name at least two out of the three major differences between the functional and anatomical images.

Question 8: On the VTC view, set the coordinates to x = 36, y = 136, z = 126 using the blue box mode and inspect the functional image. Now set the coordinates to x = 97, y = 63, z = 120 and inspect the functional image.

Indicate for each of the following statements whether they are true or false. If a statement is false, provide a short explanation as to why it is false.

  1. This participant must be warned that they have severe brain atrophy.
  2. The dark spot at coordinates x = 97, y = 63, z = 120 are caused by liquid in the sinuses.
  3. The dark spots at both coordinates are susceptibility artefacts.
  4. The dark spot in the image at coordinates x = 36, y = 136, z = 126 are caused by air in the ear canal.

Viewing time courses

The last thing we will learn to do in this tutorial is how to look at functional data time courses. Recall that functional MRI data is not just 3D but 4D, with the 4th dimension being time. We can examine the time courses of single voxels or larger regions. It can also be valuable to inspect time courses to understand what the raw data looks like and what types of artifacts might be present.

10) To examine these time series, simply use the mouse to right click over any area of the brain and select Show ROI Time Course (ROI stand for Region of Interest).

 

Figure 1-19. Viewing time courses.

 

The interpretation of the time courses is more meaningful if we know how they relate to the events in our expereiment. Close the ROI Signal Time Course window.

11) Click Analysis/Protocol… Once the Protocol window opens, click the Load .PRT ... button and select and open sub-10_ses-01_Localizer_run-1.prt then click Close .

 

Figure 1-20. A protocol file shows the order of conditions for a given scan.

 

Now you can right-click on a voxel anywhere within the boundaries of the functional data and again select Show ROI Time Course . Note that now you can see the time course superimposed on a graphical representation of the protocol. You can choose to show or hide the condition labels by right clicking on the time course and selecting Show/Hide conditions.

Figure 1-21. A time course superimposed on a protocol.

Question 9: In the 3D Volume Tools window, enter the system coords for the position x=105, y=204, and z=105. Then Right-click near the crosshairs and select Show ROI Time Course. You should see the following ROI Signal Time Course appear.

a) Does this voxel’s functional signal appear to be correlated to any of the experimental stimuli?

b) Does this make sense given the voxel’s anatomical position?

You can see that we could "voxel surf" -- randomly click around the expected locations of brain areas that we would expect to show activation -- but with 366,912 functional voxels, it would take an inordinately long time to look at them all! As such, we need a way to flag the voxels that show interesting patterns related to our protocol...

Viewing regions/voxels of interest (VOI/ROI)

Finally, we will how to view specific voxels/regions, a skill that will be useful for later analyses.

1) Select Analysis/Region-Of-Interest Analysis... Doing this will open the Region-Of-Interest Analysis window. Click Load... and open the file Voxels of Interest.voi . You will have noticed that there are 6 voxels (A to F) of interest in this file.

2) Expand the window by clinking on the > icon. Now we will link the .vtc to the .voi . Click Add... and open the sub-10_ses-01_task-Localizer_run-01_bold_256_trilin_2x1.0_NATIVEBOX.vtc .

Now you can click on any voxel in the VOI list and click Show Time course .

Figure 1-22. The Region-/Volume-of-Interest dialogue allows you to view time courses for a specific region (or here, voxel).

Conclusion

Congratulations! You have successfully learned the basics of anatomical and functional MRI data files.

In this tutorial, we learned about the 4 basic files formats used in fMRI analyses and, more importantly, their respective data structures. Important elements to remember for future tutorials include:

  • How to open an anatomical volume file (.vmr)

  • How to link the function volume file (.vtc) to the anatomical volume file (.vmr)

  • How to access properties for different types of files and understand what these properties are

  • How to use the “blue box mode”

  • How to visualize time courses

In the next tutorial, we will learn how to use statistics, specifically the general linear model, to make maps showing us where in the brain reliable differences between conditions can be found.