User Tools

Site Tools


public:condition_functions

What is a condition function?

A condition function is used to define the temporal pattern of experimental states that are represented in your data. It is used for categorical experiments, in which different categories of experimental states (e.g., ITI, delay period, stimulus presentation, upright face, inverted face, etc.) are presented to the subject. A simple condition function contains a single value corresponding to each observation (image) present in an experiment, in which case the temporal resolution of the condition function would be equal to the TR of your experiment.

Each value in the condition function codes for the state of the experiment at that particular point in time. The values themselves must be integers, with zero as the lowest value. By convention, the condition coded as zero is the baseline (or unmodeled) condition in a reference coded analysis. A good choice for the baseline (zero) condition might be (for example) the inter-trial-interval of an event-related fMRI design, or the “fixation” condition of a blocked design.

While it is often simplest to code the condition function with each element representing each TR (image) of your data, this does not have to be the case. Consider an experimental design where stimuli were presented every 19 seconds, yet the TR of the experiment was 2 seconds. In such a case, some stimuli would be presented at the beginning of a TR, while other stimuli would be presented in the middle of the TR. A condition function that coded each TR as either a “stimulus” or an “ITI” experimental condition would be unable to handle this circumstance.

Fortunately, the condition function can be created with (nearly) arbitrary temporal precision. In this example case, one would create a condition function that codes for each second of the experiment, as opposed to every TR. As a result, there will be twice as many elements in the resulting condition function as there are observations in the TES files. If higher temporal precision is needed (e.g., you need to specify events with 500 msec temporal precision), simply increase again the number of elements in the condition function.

Condition functions are loaded automatically by the “Design G Matrix” software, and are used to create parameters in the G matrix that are contrasts of one condition with another (e.g., upright face vs. ITI, inverted face vs. ITI).

How do I create a condition function?

VoxBo stores one-dimensional arrays of values as text. Thus, you can create condition functions using any software that allows you to save text files. This includes spreadsheet programs such as Excel that are available on personal computers.

VoxBo files can contain comment lines. These are useful for indicating the meaning of the code used in the condition function. For details on comment lines, see the chapter on file formats. While not strictly necessary, the file should also begin with a VoxBo header. Therefore, the header of a typical condition function file might look like this:

;VB98
;REF1
;
;  Condition function for face encoding experiment
;  Condition code:
;     0 - fixation (baseline)
;     1 – upright faces
;     2 – inverted faces
;     3 – scrambled faces
;     4 – trials in which the subject failed to respond
;

Where do I save my condition functions?

You have two options regarding where to save condition functions. The first option is to make a condition function that corresponds to each TES file. The condition function should be given the same stem name as the TES file, plus the suffix “.ref” (e.g., “MySubject03.ref”), and stored in the same directory as the TES file. This arrangement is advantageous as the condition functions for the different TES files will automatically be loaded and concatenated when you select the dependent data for your GLM analysis.

The second option is to create a single file that contains a concatenated condition function. This file can then be loaded at the time the G matrix is designed. Some may prefer using the single file approach to the alternative of making and saving many separate .ref files.

What about ordinal (parametric) designs?

Sometimes an experiment does not present different categories of experimental conditions, but instead presents the subject with a single, continuously varying experimental state. For example, an experiment might parametrically vary the luminance of a stimulus over time. A condition function would not be used to model the data from such an experiment. Instead, one might create an ordinal vector file. Similar to a condition function, this file would contain a value for each point in time of the experiment, where the value expresses the experimental state. In this case, the values can be non-integer. The specifics of the coding are up to you and depend upon the specifics of your experiment. For example, a common situation might be a linear mapping from experimental level to ordinal file. To model the data from such an experiment, this vector would be added to the G matrix using the “Single Covariate” option from the “Add” menu in the G matrix design workshop. Depending upon the goals of the analysis, it might be reasonable to mean center this covaraite or create quadratic terms.

public/condition_functions.txt · Last modified: 2009/09/04 20:15 by aguirreg