Chapter 10. Introducing Probability
Topics Covered in this chapter:
•
•
Simulations
Continuous Probabilities and Normal Probabilities
Simulations
Example 10.3: Some coin tossers
The Problem: The French naturalist Count Buffon tossed a coin 4040 times. The
result was 2048 heads or 2048/4040 = .5069 for heads. Suppose, like Buffon, you
would like to flip a coin 4040 times. This can be simulated using SPSS.
1. Set up the variables to simulate the coin tosses.
a. Go to Variable View.
b. Under Name in row 1, type “heads”, corresponding to the total
number of heads flipped.
c. Under Name in row 2, type “proportion”, corresponding to the
proportion of coin tosses that result in heads.
d. For proportion, increase the number of decimals to 4.
2. Simulate the process of 4040 coin tosses:
a. Click on Data View.
b. Enter the number “1” in the first entry. This will allow SPSS to run a
process.
c. Click on Transform then Compute Variable.
d. Under Target Variable, type heads.
e. Under Function group, select Random Numbers.
f. Under Functions and Special Variables, double-click on RV.Binom.
80
81 Chapter 10
g. Type in “4040” for the first question mark (the number of trials). In
the place of the second question mark, type in “0.5” for the probability
of a success (the probability of flipping a head).
h. Click the OK button.
i. You will be asked Change existing variable? Click OK.
j. The number of heads flipped will be shown in the Data Editor.
Introducing Probability 82
3. Find the proportion of heads flipped in the 4040 trials.
a. Click on Transform then Compute Variable.
b. In the Target Variable box, type “proportion”.
c. In the box below, click on heads, then hit the arrow to the right of the
box. This will place heads in the Numeric Expression.
d. Using the numeric function buttons, type “/4040”. This will divide the
number of heads by 4040, giving the proportion of heads flipped.
e. Click OK.
f. Change existing variable? Click OK.
83 Chapter 10
The result shows up in the Data Editor window. In this case, the proportion of
heads was 0.499. If the same simulation was run again, different values would
result due to the randomness of the distribution.
Example 10.5: Rolling dice and counting the spots
The Problem: Gamblers care only about the total number of spots on the upfaces of the dice. Simulate 100 rolls of two dice and look at the frequency of the
total number of spots showing on the total value.
1. Steps to simulate two dice rolled simultaneously 100 times:
a. Click on Variable View.
b. Under Name in row 1, type die1, corresponding to the number of spots
showing on the first die.
c. Under Name in row 2, type die2, corresponding to the number of spots
showing on the second die.
d. Under Name in row 3, type total, corresponding to the number of
combined spots on the two dice.
e. Under Decimals, change the “2” in each row to a “0”.
f. Click on Data View.
g. Scroll down, then hit enter until line 100 appears.
h. Enter the number “1” in the first column of row 100. Entering a value
in row 100 tells SPSS that an experiment with 100 trials will be
conducted.
Introducing Probability 84
2. Randomize the number of spots for each die.
a. Click on Transform then Compute Variable.
b. Under Target Variable, type die1.
c. Under Function group, click on Arithmetic.
d. Under Functions and Special Variables, double-click on Trunc.
e. Under Function group, select Random Numbers.
f. Under Functions and Special Variables, double-click on
Rv.Uniform.
g. For the bounds, use “1” and “7”.
85 Chapter 10
Now, a number from a uniform distribution between 1 and 7 will be randomly
generated for each of the 100 cases. Using the Trunc procedure will give us just
the integer value. For example, a random uniform number of 4.27881 will yield a
roll of a 4 for that case.
h. Click the OK button.
i. You will be asked Change existing variable? Click OK.
j. Repeat this process for die2.
3. Sum the results from die1 and die2.
a. Click on Transform then Compute Variable.
b. Under Target Variable, type “total”.
c. In the box below, click on die1, then hit the arrow to the right of the
box. This will place die1 in the Numeric Expression.
d. Click on the “+” button.
e. Click on die2, then hit the arrow to the right of the box. The Numeric
Expression will now read “die1 + die2”.
f. Click the OK button.
g. You will be asked Change existing variable? Click OK.
Now the third column of data for total will equal the sum of die1 and die2.
Introducing Probability 86
4. Analyze the frequencies of total sums of spots on the two dice when rolled
simultaneously.
a. Click on Analyze.
b. Select Descriptive Statistics.
c. Select Frequencies.
d. On the left-hand side, click on total, since we are interested in the total
number of spots, not those of an individual dice.
e. Click on the arrow pointing right. This will place total in the
Variable(s) box.
f. Click OK.
SPSS viewer will provide the following page with the frequency distribution of
the sample space S = {2,3,4,5,6,7,8,9,10,11,12}.
87 Chapter 10
5. Produce a graphical summary of the data.
a. Click on Graphs.
b. Scroll to Legacy Dialog and select Bar.
c. Click on Simple.
d. Click on Define.
Introducing Probability 88
e. On the left-hand side, choose total.
f. Click on the arrow pointing right that is next to the Category Axis
box. This will place total in the Category Axis box.
g. Click OK.
Continuous Probabilities and Normal Probabilities
Example 10.9: The heights of young women
The Problem: What is the probability that a randomly chosen young woman has
a height between 68 and 70 inches? The heights of women are normally
distributed with a mean of 64 inches and a standard deviation of 2.7 inches.
1. Steps to finding the probability in the example.
a. Click on Variable View.
b. Label rows 1-3 as lower, upper, and probability.
c. Change the number of decimals for probability to four.
89 Chapter 10
d. Click on Data View.
e. Enter the values 68 and 70 in the lower and upper columns. The
names lower and upper refer to the bounds that the height must be
between.
2. Computing the probability.
a. Click on Transform.
b. Choose Compute Variable.
c. Under Target Variable, type “probability”.
d. For Numeric Expression, choose Function Group.
e. Choose CDF & Noncentral CDF.
f. Double-click on Cdf.Normal.
g. For the bounds, select upper, type 64, type 2.7.
h. Choose the “–” button.
i. Repeat steps e through g, except select lower instead of upper.
Introducing Probability 90
j. Hit OK.
k. Change existing variable? Click OK again.
The correct probability of .0561 appears.
Chapter 10 Exercises
10.47 Birth order.
10.51 Did you vote?
372
Chapter 10 SPSS Solutions
10.47 The possible arrangements are: BBB, GGG, BGG, GBG, GGB, BBG, BGB, GBB.
If all arrangements are equally likely, 3 of the eight arrangements have two girls, so the
probability of two girls becomes 3/8 = 0.375. To find the probability distribution for the
number of girls, we can see that one arrangement results in 0 or 3 girls, so P(X = 0) = P(X
= 3) = 1/8. Similarly, there are also three arrangements that lead to one girl (two boys),
so P(X = 1) = 3/8. We’ll learn in Chapter 12 that this random variable is Binomial. We
can create the probability distribution for this
variable by entering values 0 through 3 in a
column of the worksheet we have named
Girls and using Transform, Compute
Variable to find the probabilities as shown
below.
10.51 We use Transform, Compute Variable to find the probability of between 52%
and 60% of respondents claiming to have voted as shown below.
373
Similarly, we find the probability of at least 72% voting by subtracting the cumulative
probability from 1. This is (to four decimal places) 0.
© Copyright 2026 Paperzz