# User:Tameem/Segment (14)

### Problems

#### To Calculate

1. Suppose the stopping rule is "flip exactly 10 times" and the data is that 8 out of 10 flips are heads. With what p-value can you rule out the hypothesis that the coin is fair? Is this statistically significant?

Answer:

Data this extreme or more should occur under <math>H_0</math> only (where <math>H_0</math> : a coin is fair with P(heads) = 0.5):

<math>2\cdot{(\frac{1}{2})}^{10}\cdot({10\choose 0}+{10\choose 1}+{10\choose 2}) = 0.109375 </math>

so, p-value = 0.109375, which is not statistically significant.

2. Suppose that, as a Bayesian, you see 10 flips of which 8 are heads. Also suppose that your prior for the coin being fair is 0.75. What is the posterior probability that the coin is fair? (Make any other reasonable assumptions about your prior as necessary.)

Answer:

Assuming that the prior for the coin being fair is 0.75, and for the remaining 0.25, something else weird is happening, we need to consider two cases:

Case A: <math>0.75 \cdot (0.5)^{10} = 0.000732 </math>

Case B: <math>0.25 \cdot \int_0^1 x^{8} {(1-x)}^{2} dx = 0.25\cdot(\frac{1}{9}-\frac{2}{10}+\frac{1}{11}) = 0.000505 </math>, where x is the probability of getting a head, (1-x) is the probability of getting a tail. As we know nothing about x, we use the law of de-Anding, assuming a uniform prior: p(x) = 1 for <math> 0 \leq x \leq 1 </math>.

So, P(Coin is Fair | Data) = <math> \frac{0.000732}{0.000732+0.000505} = 0.591754 </math>

3. For the experiment in the segment, what if the stopping rule was (perversely) "flip until I see five consecutive heads followed immediately by a tail, then count the total number of heads"? What would be the p-value?

Let X be a random variable indicating the position of the last tail.

Clearly, P(X = 1) = P(X = 2) = P(X = 3) = P(X = 4) = P(X = 5) = 0

Note that it took us 10 flips to stop the process according to the rule defined above. Therefore, we define "data this extreme or more" to be the trials in which we need 10 or fewer flips to stop the process. In addition, we only care about the last 6 flips in calculating the probabilities.

P(X = 6) = P(X = 7) = P(X = 8) = P(X = 9) = P(X = 10) = <math> {(\frac{1}{2})}^6 = \frac{1}{64} </math>

so, p-value = P(Data this extreme or more) = <math> \frac{5}{64} = 0.078 </math>

## Class activity

Teamed with Rcardenas, Jzhang and Trettels.

Participated in a debate "Are most published research findings are false or not?" ..