Beruflich Dokumente
Kultur Dokumente
Spring 2010
An example situation
For the sake of simplicity, let us assume that we have six participants, and that we want to give
three of them treatment A, while the rest should have treatment B. Since treatment is a factor
(independent variable) in our experiment, it should be represented by a column in the design matrix
(you can think of the design matrix as the spreadsheet in Excel or data sheet in SPSS which contains
all the factors and their values for each trial that we want to run in our experiment).
Figure 1. Excel example with one column for treatments and an extra column prepared for random
numbers.
DEDA at ITU
Spring 2010
Next, a random number should be put in each cell in the Random column. Excel will do this if we
click the Insert Function button (or just enter = in the selected cell to enter the formula mode) and
then enter the function name RAND() (this function, which, by the way, does not need any
arguments between its parentheses, produces random numbers between zero and one). This step is
illustrated in Figure 2.
Figure 2. Using the RAND() function to produce a random number in the first row of the Random
column.
Now that the formula is in place in the first cell of the Random column, we can just highlight this
cell together with the remaining five cells in the column and use the fill function (or just Ctrl+D) to
copy the formula to the remaining cells.
DEDA at ITU
Spring 2010
DEDA at ITU
Spring 2010
box, tick the Select Active Generator box and then click OK. The random number generator of
SPSS is now ready to go.
Figure 7. Calling the uniform random number function from the Compute Variable dialogue box.
DEDA at ITU
Spring 2010
In the Data Editor window, you should see something like what you see in Figure 8 (although your
numbers will very likely be different, since they should be random).
Figure 8. A new variable (and corresponding column), called Random, has been created, filled with
random numbers.
As you might guess from the Excel example, it only remains to sort the trials (i.e. the rows) by the
values in the Random column. Right click on the head of the Random column and select Sort
Ascending (actually, whether you choose Sort Ascending or Sort Descending is of no importance
here). The final result for our example is shown in Figure 9.