# Technology Exercise 4: Randomness & Probability

## General Social Survey (Question 1)

### Getting the data

1. Visit the General Social Survey website at http://www.icpsr.umich.edu:8080/GSS/homepage.htm
2. Click on Analyze
3. Select Frequencies or crosstabulation and then click Start
4. Enter these values (without the quotes) on the screen that appears.
1. The Row variable should be "sex"
2. The Column variable should be "race"
3. The Filter variable should be "year(2000)"
5. Uncheck any percentaging boxes.
6. Click Run the Table

### Entering the data into Minitab

1. Label three empty columns as "sex", "race", and "frequency"
2. Enter "male" three times and then "female" three times in the sex column.
3. Enter "white", "black", and "other" in the race column. Repeat the sequence so the whole sequence is there twice.
4. Enter the frequencies from the webpage for each pair of categorical variables.

Your data should look something like this (but be sure to use your data from the year 2000)

row sex race frequency
1 male white 1002
2 male black 144
3 male other 86
4 female white 1239
5 female black 256
6 female other 105

### Saving the data

1. Choose File / Save Project As
2. Navigate the file system to the R: drive
3. Choose section 01 or 02 as appropriate
4. Choose the tech4 folder
5. Save your data under a name that is unique to your group.

Be sure to open up this file any time you need to do further work on your project.

### Creating the contingency table

1. Choose Stat / Tables / Cross Tabulation from the menu
2. The classification variables are sex and race. The one you list first will be the row variable and the one you list second will be the column variable.
3. Check the Frequencies in box and tell Minitab that the frequencies are in the frequency column.
4. Display the Counts and nothing else.
5. Click OK

### Creating a joint probability distribution

Repeat the above steps for the contingency table, except display the Total percents. Typically, probability distributions are written as decimals, but Minitab displays them as percents. Be sure to answer as a decimal when you answer the questions later.

### Creating conditional probability distributions

Repeat the above steps for a contingency table, except display the Row percents or the Column percents (depending on which conditional percents you want).

After you have created all of the probability distributions, you can use them to answer the questions.

## Demonstrate the Law of Large Numbers (Question 2)

Your output for this section will be a graph similar to the one to the right. My example uses 0.5 as the probability of success for each trial. Be sure you use the probability given you in class.

### Generating the data

1. Choose File / New / Minitab Worksheet. This data is so very different from the last problem that we'll put it in a different worksheet just to keep it separate.
2. Label empty columns as "n", "x1", "x2", "x3", "x4", "p1", "p2", "p3", and "p4".
3. Fill in the numbers from 1 to 1000 into the "n" column
1. Choose Calc / Make Patterned Data / Simple Set of Numbers
2. Store the patterned data in "n".
4. Go to the last value of 1000
5. Click OK
4. Generate the random data
1. Choose Calc / Random Data / Bernoulli
2. Generate 1000 rows of data
3. Store in columns x1, x2, x3, and x4
4. Use the probability of success that was given to you. Enter it as a decimal.
5. Click OK
5. Find the accumulated probabilities
1. Choose Calc / Calculator
2. Store the results into "p1"
3. The expression is "pars(x1)/n"
4. Click OK
5. Repeat steps a-d, but change the variables. Use p2 with x2, p3 with x3, and p4 with x4.

### Making the Graph

1. Choose Graph / Time Series Plot
2. Double click on p1, p2, p3, and p4 to select the variable to graph for graphs 1, 2, 3, and 4.
3. Turn off the symbols. There are too many data points to show symbols.
1. Click on the word Symbol in row 1 of the Display column
2. Click Edit Attributes
3. Click on the word Type at the top of the first column. This will highlight the entire column.
4. Use the pull down menu button next to the word Type and change the type to None.
5. Click OK
4. Change the line style.
1. Click on the word Connect in row 2 of the Display column
2. Click Edit Attributes
3. Make sure each line is solid. If not, click on the words Line Type at the top of the first column to highlight the entire column, then use the pull down menu to change the line type to solid.
4. (Optional) Change the lines to be different colors. This will print in black and white, but it will be easier to visualize if you generate them with different colors. If you want different colors, you'll have to use the pull down menu separately for each row.
5. Click OK
5. Place all the graphs on one screen.
1. Click on Frame and choose Multiple Graphs
2. Check Overlay graphs on the same page
3. Click OK
6. Add a reference line at your probability so we can see the values getting close to it.
1. Click on Frame and choose Reference
2. The direction should be Y
3. The position should be your probability
4. Make it a dashed red line of size 2
5. Click OK
7. Add a title by going into Annotation / Title. You should probably add a second line that includes the probability of success that you're using.
8. Relabel the axes
1. Click on Frame and choose Axis
2. Type "# of trials" for the label for row 1
3. Type "Probability" for the label for row 2
4. Click OK
9. (Optional) Make your graph bigger. By default, Minitab leaves a lot of extra space on the right and top of the graph that is wasted.
1. Click on Regions and choose Data. The default values are 0.2 and 0.8 for both the X and Y variables. The space to the left of 0.2 is used for labels, but the space to the right of 0.8 is wasted (empty).
2. Set the X minimum and maximum to 0.15 and 0.95.
3. Set the Y minimum and maximum to 0.1 and 0.95
4. These should be reasonable. If you see text getting cut off of the left, then increase the X minimum. If text is cut off the bottom, then increase the Y minimum.
10. (Optional, recommended) If you find that there are not enough probabilities listed on the y-axis, you can tell Minitab to list more. For example, when I ran through this project to create the example, it only gave me values at 0.0, 0.5, and 1.0. I would really rather have values every 0.1.
1. Click on Frame and choose Tick
2. Figure out the number of tick marks you want on the y-axis. In my example, the values go from 0 to 1 and I want them to count by 0.1. That means I need 11 tick marks (0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, and 1.0).
3. For the Y direction (should be row 2), enter the number or ticks you want as the Number of Major ticks.
4. Click OK
11. Click OK

Check your graph and make sure everything is okay. If it is, then copy and paste it into Word.

## Jalen Rose (Question 3)

### Generating the data

1. Create a new worksheet to hold the Jalen Rose data.
2. Label two empty columns as "shots made" and "probability"
3. The number of shots made can be anywhere from 0 (a really bad game) to 19 (a most excellent game). Jalen can't make less than 0 shots, nor can he make more than attempts. Fill in the "shots made" column with the whole numbers from 0 to 19
1. Go to Calc / Make Patterned Data / Simple Set of Numbers
2. You should be able to figure it out on your own by now.
4. Find the probabilities for each of those shots made.
1. Choose Calc / Probability Distributions / Binomial
2. Choose Probability
3. The number of trials is 19
4. The probability of success is 0.406
5. The input column is "shots made"
6. The output column is "probability"
7. Click OK

### Copying the probability distribution into Word

1. Highlight the "shots made" and "probability" columns by clicking on the C1 and C2 at the top.
2. Copy the data
3. Switch to Word
4. Paste the data.
5. Highlight the data in Word
6. Add a tab at about 1" so that the data lines up with the headings. To add a tab, just click on the ruler where you want the tab to go. If the ruler isn't showing, go to View / Ruler.

As an alternative, you can go to Manip / Display Data in Minitab. Display both variables and then you can copy and paste into Word as normal. This includes the row number, which isn't necessary, which is why I gave the previous instructions.

### Making a graph

1. Choose Graph / Plot
2. The Y variable should be "probability"
3. The X variable should be "shots made"
4. Add a title by choosing Annotation / Title
5. Fix the scale on the X axis so that it goes from 0 to 19
1. Click on Frame and choose Min and Max
2. Change the X minimum to be -0.5 and the X maximum to be 19.5. It is necessary to subtract and add 0.5 for the graph to appear properly.
3. Click OK
6. Fix the tick marks for the X axis so that they appear for every value.
1. Click on Frame and choose Tick
2. For the X direction (should be row 1), tell Minitab that you want the Number of Major ticks to be 20 (there are 20 numbers when you start at 0 and count to 19).
3. (Optional) - change the ticks on the Y axis. You really won't know what to change them to until you've generated the graph, so you may want to leave this alone the first time through and come back and revisit it later.
4. Click OK
7. (Optional, Recommended) Change the color and size of the symbols by clicking on Edit Attributes and making the changes. A point size of 1.5 works out nicely.
8. Make the graph take up more of the available space. This may be necessary so that you can see all of the values on the x-axis.
1. Click on Regions / Data
2. Set the X minimum and maximum to 0.15 and 0.95
3. Set the Y minimum and maximum to 0.10 and 0.95
9. Click OK