General Information
  Home
Author Bio
Product/Purchase Info

Instructor Resources
Registration Required
  Register
Download Instructor Resources

Computer Activities
and Data Sets
  Table of Contents
Excel
Fathom
SPSS

Community
  Contact the Author
Ideas/Comments for Publisher
Testimonials
Coming soon!

Other Key Sites
  Key Curriculum Press

Key College Publishing

Data Matters with SPSS®

Activity 1.3

The law of large numbers claims that as a random sample gets larger, the proportions in the sample tend to approach the probabilities that are generating those proportions. This project lets you check that for yourself.

The simulation will use four variables. In Variable View, name the variables trial, flip, sum, and percent.

Each coin flip is a trial and has its own row in the data editor. Trial will hold the number of each flip. Switch to Data View. To tell SPSS how many trials you want, type 1 in the trial column for row 1. Press “Enter” to get down to the last trial’s row. Type the last row’s number in the trial column. Try it with 100 trials at first, then try 400 trials.

To fill trials, select Transform, Compute. Enter trial for the target variable. Then type lag(trial)+1 for Numeric Expression. Click on If, Include if case satisfies condition: . In the condition box, type trial>1 or missing(trial). Click on Continue, then OK. SPSS asks, “Change existing variable?” Click OK.

Check trial. It is now numbered—row 1 has 1 for trial, row 2 has 2 for trial, and so on. The way this works is that lag(trial) is the value of trial on the row just above. For example, on row 2, lag(trial) is 1. On row 4, lag(trial) is 3. To that value, you want to add 1, but only for rows 2 and above. To indicate that you want to do this only to rows 2 and above, mark that the computation should apply only if trial > 1 or missing(trial), which means “there is no value for trial on this row.”

To fill up the flip column, select Transform, Compute. Enter flip for the target variable. For Numeric Expression, type rv.binom(1, .5) . Rv.binom(1, .5) randomly fills a column with 1’s and 0’s using a routine such that the probability of 0 is 50% and the probability of 1 is 50%. Select If, Include all cases, Continue, OK, OK.

You are going to put a running total in the sum variable. For each trial, the running total is the count of how many heads have come up so far. To calculate sum, get into Data View, then on row 1, type 1 if the first trial’s flip is a 1. Type 0 if the first trial’s flip is a 0. Then select Transform, Compute. Enter sum for the target variable. For Numeric Expression, type lag(sum) + flip . Click on If and select Include if case satisfies condition: . The condition box should read trial>1 or missing(trial) . Click on Continue, OK. SPSS asks, “Change existing variable?” Click OK.

Finally, fill in the percents. Select Transform, Compute. Type percent for the target variable. For Numeric Expression, type 100*sum/trial . Click on If and select Include all cases. Click on Continue, OK, OK.

Look at the data for the first 10 cases. Look over the flips. Make sure you understand what they are. Make sure you understand why I can say they are “simulated coin flips.” Make sure you understand why for each trial, sum has the number of heads that have appeared so far. Make sure you see why percent is the percent of flips that has come up heads. Check the first several to make sure that percent is right.

Now you need to plot what happened. Click on Graphs and select sequence. Select percent, then click on the black triangle to put percent into the Variables box. Select trial and click on the black triangle to put trial into the Time axis labels box. Click OK.

To see what is constant about the patterns that appear, repeat the steps starting with computing the flips.

Report

Include some of the charts and write a few sentences explaining what this simulation shows you about where you expect proportions to fall when you flip coins.


©2008 Key College Publishing. All rights reserved.