First off: yes, this is a homework question. Anything leading to the right answer or hints would be much appreciated! (Rather than simply providing an answer).
Okay, so say we have a coin where H = 0 and T = 1. And we flip it 100 times to create a binary sequence such as X = 00110100001001110.
Then we count the number of occurrences of the substring '100' (two, in the case above). And then we lose the original strip. In our strip, we counted 21 occurrences of the substring '100' (which cannot overlap with itself).
Question: Can we use the fact that we counted 21 occurrences to prove whether or not the coin is biased?
My line of thinking:
So I was dumbfounded to begin with, so I found the maximum and minimum number of times '100' could occur: 0 and 33, respectively.
Then I found the number of "frames" in a string that was 100 characters long: 100 - 3 + 1: 98.
And that really didn't seem to help, so I found the probability of any given sequence, provided we have a fair coin, as: $$(\frac{1}{2})^{100}$$
And thus the number of unique possibilities is the reciprocal of that.
For example, the number of times '100' could occur just once is 98 times that: $$98 \times (\frac{1}{2})^{100}$$
But calculating this for 1 occurrence, 2 occurrences, up to 33 is time consuming, so instead I calculated the chance it wouldn't occur as: $$(1 - (\frac{1}{2})^3)^{100}$$
And from there derived the probability it would occur exactly 21 times as: $$((1 - (\frac{1}{2})^{22})^{100}) - ((1 - (\frac{1}{2})^{20})^{100})$$
But then... I hit a roadblock. I'm not sure how to connect that probability back to the original question. Is it too high or low to be considered "normal"? What is "normal" in this context? Or am I just completely wrong?
Thanks so much!
(This is being done in R by the way, so any code/packages that lead in the right direction would be great as well).