Data Matters with SPSS®
Activity 1.2
The project in Section 1.2 requires these four steps.
- Use the random number generator to create random observations. When you are done, each cell will have a single number produced by the random number generator.
- Look at the first 20 random numbers. There should be no sequences in them that you can see. Most random number generators have a way to produce random decimals between 0 and 1, in which every decimal is equally likely and shows up an equal number of times. Figure out how to get this kind of random number in your software.
- Repeat these steps to see how the random number generator produces new random numbers.
- Figure out what the chances are that the random number generator will produce a number less than .5. (This may be tough, and I strongly recommend you ask friends for help in thinking this through.) Write down your answer and how you figured it out.
Heres how to do each step.
Step 1: Use the random number generator to create random observations. When you are done, each cell will have a single number produced by the random number generator.
Once you are in the SPSS data editor, select Variable View and name a new variable. Lets use random for the name. Select Data View and enter any number on the third row of random. That will set SPSS to be ready for three observations.
Left-click on Transform, then Compute. Enter Random for the target variable. In the box on the right, enter rv.uniform(0,1) (rv stands for random variable). There are different kinds of random variables. We are filling our variable, random, with values that are uniformly (evenly) spread from 0 to 1. Click OK. SPSS asks, Change existing variable? Click OK.
Enter a number on the 20th row, then refill random with random numbers by selecting Transform, Compute, OK, OK.
Step 2: Look at the first 20 random numbers. There should be no sequences in them that you can see. Most random number generators have a way to produce random decimals between 0 and 1, in which every decimal is equally likely and shows up an equal number of times. Figure out how to get this kind of random number in your software.
The function you used in Step 1, rv.uniform(0,1), produces random decimals that range from 0 to 1. So youre all set.
Step 3: Repeat these steps to see how the random number generator produces new random numbers.
Select Transform, Compute, OK, OK.
Step 4: Figure out what the chances are that the random number generator will produce a number less than .5. (This may be tough, and I strongly recommend you ask friends for help in thinking this through.) Write down your answer and how you figured it out.
This might help: Create a new variable, lessthan. Select Transform, Compute. Type lessthan for the target variable. In the box on the right, enter random < .5. This will fill your new variable with 1s and 0s. 1 means true, on this row, random is less than .5 and 0 means false, on this row, random is not less than .5. Look carefully at the data, and you will see that there is a 1 next to each of the random numbers that is less than .5, and a 0 next to each random number that is greater than .5.
Get the proportions (analyze, descriptive statistics, frequencies, and so on) for the variable you just created, lessthan.
As you think about this problem, it might help to consider that when you use rv.uniform(0,1), every decimal from 0 to 1 is equally likely.
It might help to have more observations. To add more observations, type a number into a cell in the row you want the data to go to. Lets say you want to have 5,000 observations. The easiest way to do this is to select Data, Go To Case, then enter 5000 and press Enter. Type a number into the cell on row 5,000 and press Enter again. Then recalculate random and lessthan.
Check how the additional cases affects the proportion of lessthan that are 1s.
| ©2008 Key College Publishing. All rights reserved. |
|