Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project 3: Hot Hands Description. Are a basketball player's chances better for sinking a basket after 5 consecutive successes? (i.e., is there evidence in basketball

Project 3: Hot Hands

Description.

Are a basketball player's chances better for sinking a basket after 5 consecutive successes? (i.e., is there evidence in basketball statistics for the phenomenon of "hot hands"?) Is a gambler more likely to win after 10 consecutive losses? ("gambler's fallacy"). Do you think that a couple that has three boys is bound to have a girl next? Such questions have been the subject of intense study for centuries and are often used to illustrate the failing of human intuition for statistical reasoning. The question of "hot hands," in particular, seemed settled until recently, when a re-examination of the data revealed that not only the phenomenon is real, but that mathematicians who had "disproved" it, had themselves fallen prey to a similar sort of fallacy of statistical reasoning, which brought the question of "hot hands" into the media spotlight (see for example these WSJ and Slate articles). An introduction and background to the problem can be found in Jordan Ellenberg's blog, where you will also find references including the original paper that occasioned a re-examination of a subject that seemed settled by statisticians long ago.

In this project we will create a simulation to investigate a question that is at the basis of Hot Hands and is also related to the Gambler's Fallacy:

In a trial consisting of 100 coin tosses, what is the conditional probability of obtaining a fifth head after four heads? The Gambler's fallacy can be summed up in the gut feeling that after a run of four heads, the next coin toss is bound to be a tail. We know that the coin tosses are independent, so that gut feeling, no matter how strong, must be incorrect. What if we measure how often you get a fifth head in an actual trial by counting how many hhhh's are followed by another h? That is not exactly the same question. Its answer will surprise you and it is thought to be one motivating reason for the Gambler's fallacy.

Your program should run 5000 trials. For each trial, it should generate 100 coin tosses and store them in an array; using the array, you can compute for that trial how many runs of 'hhhh' are followed by a head, and the ratio of the two numbers. For example, the following trial contains 9 runs of 'hhhh' but only 3 of them are followed by another 'h', giving us a ratio of 0.33333333333

After the 5000 trials the program should print the average of the ratios. You should expect that the average should be about 0.41.

Experiment with your code and see what happens as the trials get shorter (eg, 20 coin tosses) or longer (1000 or more). In all cases, make sure you are running at least 5000 trials, so that the averages that you compute are meaningful. Additionally, you may explore a similar question, say, how often a 5th head is followed by yet another head. Other things to try might be a biased coin (eg, basketball players are not assumed to have a 50-50 chance to sink a basket, it varies) and the ratio of male/female babies, though pretty close to 1, varies a lot by species.

Sample output:

Trial #1 Count hhhh = 9 Count hhhhh = 6 ratio = 0.6666666666666666

Trial #2 Count hhhh = 2 Count hhhhh = 1 ratio = 0.5

Trial #3 Count hhhh = 3 Count hhhhh = 1 ratio = 0.3333333333333333

[ some output deleted here ]

Trial #4982 Count hhhh = 4 Count hhhhh = 1 ratio = 0.25

Trial #4983 Count hhhh = 2 Count hhhhh = 1 ratio = 0.5

Trial #4984 Count hhhh = 4 Count hhhhh = 1 ratio = 0.25

Trial #4985 Count hhhh = 2 Count hhhhh = 1 ratio = 0.5

Trial #4986 Count hhhh = 3 Count hhhhh = 1 ratio = 0.3333333333333333

Trial #4987 Count hhhh = 3 Count hhhhh = 1 ratio = 0.3333333333333333

Trial #4988 ***** did not produce any hhhh runs ****

Trial #4989 Count hhhh = 2 Count hhhhh = 0 ratio = 0.0

Trial #4990 Count hhhh = 3 Count hhhhh = 1 ratio = 0.3333333333333333

Trial #4991 Count hhhh = 3 Count hhhhh = 2 ratio = 0.6666666666666666

Trial #4992 Count hhhh = 4 Count hhhhh = 2 ratio = 0.5

Trial #4993 Count hhhh = 6 Count hhhhh = 3 ratio = 0.5

Trial #4994 Count hhhh = 7 Count hhhhh = 4 ratio = 0.5714285714285714

Trial #4995 Count hhhh = 7 Count hhhhh = 3 ratio = 0.42857142857142855

Trial #4996 Count hhhh = 9 Count hhhhh = 6 ratio = 0.6666666666666666

Trial #4997 Count hhhh = 6 Count hhhhh = 3 ratio = 0.5

Trial #4998 Count hhhh = 1 Count hhhhh = 0 ratio = 0.0

Trial #4999 Count hhhh = 3 Count hhhhh = 1 ratio = 0.3333333333333333

Trial #5000 Count hhhh = 4 Count hhhhh = 1 ratio = 0.25

Average ratio over 5000 runs: 0.4077585131619748

Style and Documentation

In addition to working well, your program should adhere to the general style and documentation guidelines expected(javadoc). This includes:

  • Appropriate indentation and use of white space for readability. Make sure that matching braces are lined up on the same column and that statements that are executed conditionally (part of the if/else) are indented further.

  • Use descriptive names for your variables.

  • Comments should be used to document tricky parts and to explain the use of variables, where that is not obvious from their name.

  • Comments should describe the overall goals of the program and give some details of its history, including when and by whom it was written, filename, when it was modified, its purpose, etc.

  • Avoid long lines in the program: generally, no line of the program should be more than 80 characters long. This ensures that when you paste your program into Word, the lines will not be broken and it will still look the same as it looked on your screen.

.

Project report checklist

  • Source code

  • Standard sample run with 100 tosses and 5000 trials. Crop most of the output, as in the example above, to print in single page. Be sure that enough is left to show you did this right.

  • At least two more runs showing other things you have explored with this problem.

  • Brief personal statement about the project:

    • how long did it take?

    • was it easier/harder than you expected?

    • difficulties/problems you encountered and how you solved them

    • what you enjoyed and/or learned from this project

    • help you received (please specify: TAs, peer tutor, professor, classmates, friends, relatives)

    • anything else you would like to mention

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago