NeuroPowerTools
  • NeuroPower
    • NeuroPower
    • Tutorial
    • Methods
    • FAQ
  • NeuroDesign
    • NeuroDesign
    • Tutorial
    • Methods
    • Beyond the GUI
    • FAQ

Neurodesign Tutorial

  • Getting Started
  • Experimental outcomes
  • Input
  • Options
  • Genetic Algorithm

Getting Started

This toolbox is for the optimisation of experimental designs for fMRI. Minimising the variance of the design matrix will help detect or estimate (depending on the outcome of interest) the effect researchers are looking for. The genetic algorithm for experimental designs was introduced by Wager and Nichols (2002) and further improved by Kao, Mandal, Lazar and Stufken (2009). We implemented these methods in a userfriendly web-application and introduced some improvements and allows more flexibility for the experimental setup.


Goal of the optimisation


Stimulus order

Let's say a researcher wants to design an experiment with 3 possible conditions: A (seeing happy faces), B (seeing sad faces) and C(seeing angry faces). The first goal of the optimisation is to provide an optimal order of the conditions.

For example: compare the designs with stimulus order AAAABBBBCCCC and AABBCCBBCCAA. With the first design, you'll have an optimal BOLD response to distinguish the different stimuli, but it will be hard to distinguish the design from scanner drift. Moreover, the first design is very predictable. In this case, it might be advisable to use the second example. This is an example of how we optimise the stimulus order.

Stimulus timing

A second example is the exact timing of the stimuli. For example: a whole brain scan is taken every 2 seconds (TR=2s), and the stimuli are also presented every 2 seconds (ITI=2s). We assume that the HRF (the fMRI signal after activation) is a continuous function that peaks somewhere around 4 seconds and then has a slow decay. However, with this design, you will measure the exact same timepoint on the HRF. You won't be able to estimate the whole HRF. Moreover, a whole brain scan is taken in slices. For example: the temporal lob (or part of it) will be measured 0.5s after stimulus presentation and the parietal lobe will be measured after 1s. This is clearly unwanted.

A layman's solution is to set the ITI different from the TR. But an even better solution is to spread the stimuli at specific timepoints that will enable to estimate the hrf at many different time points, with a variable ITI. This toolbox searches for optimal stimulus timing.

Output

Once the design optimisation is run, the output will be a file for each stimulus type (or condition) with stimulus onsets. As such, it captures both the stimulus order and the exact timing.



Next: Experimental Outcomes

There is no global way to improve an experimental design. It depends on what the researcher wants to measure. There are two statistical properties and two psychological properties that can be optimised. It is the researcher's choice to decide the relative importance of each of those properties. The two statistical properties define the main possible outcomes of an experimental design. However, there are two potential unwanted psychological effects that can be avoided by optimising the psychological properties.

Statistical properties
  • Estimation efficiency: A possible goal of the research is to estimate the exact shape of the signal (the haemodynamic response function - HRF ) after a stimulus has been presented. This can be interesting for research into how the HRF varies accross subjects/regions/... This outcome is also desirable when estimating connectivity between region/time series. The optimisation algorithm will improve the likeliness to have a good estimate of the brain response at following a stimulus with a good temporal resolution.
  • Detection power: Another potential goal of an fMRI study is to detect brain activation related to a certain task. The keyword is contrast. For example: the researcher wants to find which part of the brain is responsible for the contrast between seeing faces and houses, the contrast between angry and happy faces, or the contrast between auditory stimulation and nothing (baseline). In this case, the optimisation algorithm will improve the statistical separation between the modeled conditions.
  • Estimation vs. detection: The difference between the two testing settings is in the design matrix. Estimation uses a finite impulse response (FIR) model, while detection uses HRF-convolved regressors. In general, detection power is more common.
Psychological properties
  • Predictability: When a subject in the scanner can predict which stimulus will follow, the effect of that stimulus might be biased. As such, it is important to avoid certain contingencies.
  • Stimulus frequencies: Sometimes, you can get higher detection power or estimation efficiency when the frequencies of the stimuli are slightly changed. For example: in a stop-signal experiment, you want 30% of the stimuli to be stop-trials and 70% to be go-trials. However, the genetic algorithm has a better detection power when the frequencies are changed from 30-70 to 25-75%. In certain tasks (like a basic stop-signal task), changing these frequencies can have a large psychological impact and you want to avoid changing the frequencies.


Previous: Getting Started Next: Input

In the first step, you are asked some parameters about your design/scanner:

Design parameters

General
Scanner TR (seconds)The repetition time of your scanner. How many seconds are there between two whole brain scans?
Stimulus typesThe number of different stimuli in your design, often the same as the number of conditions. If you're comparing seeing faces with seeing houses, you have 3 stimulus types.
Stimulus durationHow long does one stimulus last on the screen? We expect brain activation for the duration of the stimulus. Please exclude the duration of non-target parts of a trial (such as fixation crosses) and add this duration to the ITI.
Total number of trialsHow many trials does the experiment consist of in total?
Trial structure

We ask to specify the stimulus duration. However, very often your trial consists of fixation cross etc, where you don't expect activation. Therefore, you should specify the duration of the trial before the stimulus (or target) and the duration of the trial after the stimulus.

Contrasts

If you are comparing conditions (or a condition with baseline), you need to prepare contrasts for your analysis. The optimisation of your design also depends on these contrasts. If you have 3 conditions, and you want to compare all of those, your contrast matrix would be:

1-10
01-1
10-1

The first line compares condition 1 with condition 2. The second line compares condition 2 with condition 3 and the last line compares condition 1 with condition 3.

By checking to inclide all pairwise contrasts, all these one-by-one contrasts will be added.

If you want to specify custom contrasts, you can do so too. In an example with three conditions - seeing angry faces, seeing sad faces and seeing neutral faces - you'd want to compare the average of emotional faces with neutral faces. Your contrast would look like this:

0.50.5-1
Inter-trial interval (ITI)

You want to specify the time between stimuli, the inter-trial interval (ITI) or also known as the inter-stimulus interval (ISI). You can specify a fixed ITI, but also a variable ITI. We strongly suggest a variable ITI for a better estimation of the activation. For a fixed ITI, you only have to fill out the average ITI; for a variable ITI, you can either sample from a uniform or a truncated exponential distribution. You can also specify a minimum and a maximum and. For a truncated exponential distribution, you can additionally add the mean of the ITI's (which should be smaller than the mean between the minimum and the maximum).

Rest blocks

Very often, a researcher would include some rest blocks during the experiment to let the subject rest and refocus. You can choose how long these rest blocks are and how many trials there are between rest blocks.

Note that if you're modeling a very long experiment, it might be advisable to optimise 2 different runs rather than 1 long run with a long rest block.

Design optimisation parameters

On the previous page in the tutorial, we explained the different optimisation criteria. Here, you are asked to give weights to each of those criteria. Each criterium is scaled between 0 and 1, with higher being better. The total optimisation will be the weighted average of those criteria.

Psychological confounding factors

Trial contingencies

Trial blockedness

Imagine an experiment with 3 stimulus types. The probability to have randomly a block of 6 stimuli of the same type is 1/3^6. However, with a design of 300 trials, the probality of a random design to have a block of 6 stimuli is close to 0.4. As such, even a design that is completely random has a large chance of containing a long block of the same stimuli. You might want to avoid such long blocks, it might interfere with the expectance of the subject by setting a maximum number of repeated stimuli.

Watch out though. In an experiment with only 2 stimuli, there is on average a block of 6 repeated stimuli every 64 trials. With only two stimuli, it will not only be difficult to randomly find a design without such blocks, but it might also inversely impact the expectance of the stimuli. You might want to set the maximum number of repeated stimuli higher or leave this field empty.

Contrasts and Probabilities

Stimulus probabilities

Here, you are asked to set the probability of each stimulus type. You can fill this out in whatever unit, as long as they are relative to one another. If you want a design with 200 trials with 4 stimulus types with equal probabilities, you can fill out [0.25, 0.25, 0.25, 0.25], or [50,50,50,50], or even [1,1,1,1].

You can fill out integers or decimal values, but not fractions. For fractions that have infinite decimals (like 1/3), you can ignore the denominator. For example [1/3,2/3] can be written as [1,2].

Hard limit on the probabilities

During the design optimisation, it might (and it probably will) occur that the final probabilities are not exactly what you wanted for the sake of having an optimal design. To avoid this, you can set the probabilities as an optimality criterion, but it might still not be perfect. If you only want designs with the exact probabilities you wanted, you can check this box.

However, this will have a large impact on the optimisation. It will largely restrict the number of designs to search over, and the optimisation will take a lot longer and we might even end up without optimal design. If you check this box, we will automatically set the number of designs in each step of the algorithm a lot larger to avoid finishing without design, but there's nothing we can do about the duration.

Contrasts

We've explained in short how to construct a custom contrast above. For a clear overview and more information, see this video from Jeanette Mumford's blog.



Previous: Experimental Outcomes Next: Settings

In the review panel, there is a button that will take you to some settings of the design and the genetic algorithm. These settings are based on research, so you might leave those to the default settings. We will explain all these parameters in short here.

Design and optimisation parameters
Temporal autocorrelation coefficientWe have to make an assumption about the autocorrelation structure of the data. We assume an AR(1) model with a correlation of 0.3 between each subsequent timepoint.
A-optimality or D-optimalityThere are two measures of design optimality. Read up on the methods to see what these mean. There is a good overview on Wikipedia. We choose A-optimality as the default.
ResolutionThis parameter sets the resolution of the design, and will define the minimal difference between two ITI's. You can change this setting, but it should be a divisor between both the TR and the ITI in the case of a fixed ITI. For a design with variable ITI, this should be divisor of the TR.
Genetic algorithm parameters

To understand these parameters, ideally you read about the genetic algorithm (see methods). Here's the algorithm in very basic terminology.

  1. First parent generation: A certain number of designs are constructed to start
  2. Cross-over happens: The designs make babies by mixing part of one design with part of another design.
  3. Mutation: Babies aren't perfect clones of their parent designs. A certain percentage of trials are randomly changed for other trials.
  4. Immigrants: To avoid inbred designs, new baby designs are added to the already existing baby designs.
  5. Natural selection: the best babies are selected and now become the next generation of parents.
  6. Step 2 to 5 are repeated for a large number of generations
Some parameters with respect to this algorithm you can change:
The size of each generationThe number of designs that go from one generation to another.
Percentage mutationThe number of trials that get mutated in each design.
Number of immigrantsThe number of new designs in each generation.
Number of generationsHow many generations are run before coming to the final optimal design?
Fun fact: since anatomically modern humans arose, there have been between 5,000 and 10,000 generations of this natural selection mechanism (source: google) and we're still nowhere near perfection.
Pre-run generationsTo have an accurate scale of the optimality criteria, we have to do a prerun to find the optimal efficiency and detection power. This should be more or less equal to the number of generations in the genetic algorithm.
Previous: Input Next: Genetic Algorithm

In the tab 'Genetic Algorithm Status', you can start the genetic algorithm by clicking 'start'.

The first step will be to find the maximum values of two of the optimality criteria (unless they are set at 0). You'll be able to see the percentage done.

Next, the genetic algorithm starts. You'll see a figure with the weighted optimality, and the individual optimality criteria. You can hover over the lines to see the exact values. Below, a figure will show the expected BOLD signal (in a perfect voxel without noise) for your design for the different conditions of the best design so far.

Once the optimisation is done, there will be download button visible that will allow you to download a zip-file with a file for each stimulus with the onsets of that particular stimulus.

During the optimisation, you can go to the different tabs to check your settings. However, once the algorithm has started, changing these parameters will not affect the optimisation.



Previous: Options