RSFgen

 

RSFgen is a useful program for assisting in design of randomized experiments.

 

For further information on this little command line program please see the documentation for 3dDeconvolve.  Note also that all the following examples deal only with randomized block designs.  If interested in event related design  then see the 3dDeconvolve manual. (available in both pdf and ps).

 

Probably the best way to go about doing this is to just list what I want the program to produce...write out the code and then backtrack and explain.

 

So if you were reading the Experimental Design document.  We came to a point where we wanted to create a stim file with 64 volumes of which 32 are acitveations and 32 are control and also where each activation would be 4TRs and these would be placed randomly.  OK Here is the code...

 

RSFgen -nt 64 -num_stimts 1 -seed 14536 -prefix Example1b -nreps 1 8 -nblock 1 4

 

This generates a file Example1b.1D that contains the following single column of numbers

0   0   1   1   1   1   1   1   1   1   0   1   1   1   1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   1   1   1   1   0   1   1   1   1   0   0   0   0   0   1   1   1   1   0   0   0   0   0   1   1   1   1   0   0   0   0   1   1   1   1

 

Note the following                -nt 64                                      the stim_file should contatin 64 timepoints

                                                -num_stimts 1                        there is only when condition: active

                                                -seed 14536                      random number used to generate the sequence

                                                -prefix Example1b                             store result as Example1b.1D

                                                -nreps 1 8                              For condition one there will be 8 reps

                                                -nblock 1 4                           For condition one...activations will occur for 4 TRs

 

Suppose that you have created an experiment with two mutually exclusive conditions.  For example, you will present the patient pictures a glass of beer.  Condition one will be with the beer full and condition two will be with the beer spilled.  Let's say you want  3 repeats of each condition and full beer will be shown for 5 TR and spilled beer will be shown for 2TR (much more shocking).

 

The code that follows is this...

 

RSFgen -nt 100 -num_stimts 2 \

-nreps 1 3                 -nblock 1 5 \

-nreps 2 3                -nblock 2 2 \

-seed 83247 -one_file -prefix Beer

 

The a random array produced is

0   2   2   0   1   1   1   1   1   0   0   0   1   1   1   1   1   2   2   0  0   0   0   2   2   0   1   1   1   1   1   0   0   0   0

 

Now, this is stored in the file Beer.1D with two columns.  Column 0 corresponds to condition 1 and Column 1 corresponds to condition 2.  The information is stored as 1s and 0s so in column 0 (condition1) where there is a 1 on the above array that will stay the same and where there is a 0 or a 2 now that will be a 0.

 

Hard to explain easy to understand by looking at Beer.1D

 

Let's see...how's about we try an example without mutual exclusion.  I am running an experiment with two conditions: condition one occurs when a clown with no pants rides a unicycle across the screen and condition two occurs when Stairway to Heaven played backwards is piped in over the speakers.  These two events can occur simultaneously.  We'll stay with three repeats of each condition and clown will stay for 5TR and the music for only 2.  All you have to do is run RSFgen two times and nsure that you use a different seed number so that you do not get "identical random" sequences.  Here goes...

 

RSFgen -nt 35 -num_stimts 1 -nreps 1 3 -nblock 1 5 -seed 1576 -prefix Clown

RSFgen -nt 35 -num_stimts 1 -nreps 1 3 -nblock 1 2 -seed 0666 -prefix Stairway 

 

Clown:

 0   0   0   0   0   1   1   1   1   1   0   0   0   0   1   1   1   1   1   1   1   1   1   1   0   0   0   0   0   0   0   0   0   0   0

 

Stairway:

 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   1   1   0   0   0  0   0   0   0   1   1   0   0   0   0   0   1   1   0   0

 

Notice how there is overlap of the two diferent conditions.  You can also combine these separate 1D files into a matrix with a column for each condition.  This is not necessary but if you wish it is on page 73 of the 3dDeconvolve manual.

 

OK finally now on to the most complex example.  Hope you are still following along.  Suppose you as an experimenter want to set up a randomized experiment but you do want to set some parameters for the conditions.  Here we have an experiment with 3 mutually exclusive conditions.

 

Condition A (sitck in the eye) will be repeated three times with 2 TR duration

Condition B (punch in the groin) will be repeated 3 times with 1 TR duration

Condition C (sweet apologies in the ear are whispered) repeat 3 times for 4 TR

 

Now we have the following conditions

                A can follow any of A, B or C

                B can't follow B (that is too cruel)

                C can't follow C (you have nothing to apologize for)

 

This is represented as a transition matrix

                                                                                                A                B                C

                                                                                A                0.33                0.33                0.34

                                                                                B                0.5                0.0                0.5

                                                                                C                0.5                0.5                0.0

 

Reading accross rows we see that A can be followed by A B or C at equal probabilities (had to round up to add up to one).  Also B can't be followed by B or C by C.  So save this matrix (numbers only) as Pain..mat