Say we flip a fair coin n (for example n=100) times. How would one calculate the expected value of how many time a sequence occurs (for example HHT where H:heads, T:tails)?
Can't figure this problem out other than that it would be the same for any sequence that the expected value would be: \[n\times \frac{1}{2^3}\]
How did you get 98? How would that change if the sequence was for example HHH?
i have a few other ideas to try so i ask
I understand your solution but It's a part of a problem problem involving Penney's game which I know isn't a fair game thus I would expect different expectations for different sequences?
or is it only when comparing relative probabilities of different sequences one would find different probabilities/expectations for different sequences?
dan i was thinking maybe usin combinations or permutations not too sure tho
thats hwat i mean
for example you look at the first 3 in the 100 flips, are you allowed then look at the next 3 starting from the 2nd one, and say that is also 1/8 , i dont think u can because it is included when you checked the first 3
my other method was
lets check 3 at a time differently
sigh maybe i shouldht have deleted that stuff, it doesnt seem wrong
oh nvm it is wrong!
i see what u mean if they are all HH you can have a chance of 98 sequences but there is no way to have more than a sequence of 33 hot HHT
do you know what hte right answer is?
Unfortunately there are no answers to the questions but I can ask my professor next week. I really appreciate you taking the time to discuss my question, thank you.
wait lol
I actually can get the right answer
we can work backwards
iam writing a program for it right now
oh, cool, what do you mean with working backwards?
like see what the probability really is
and then we can try some ideas and see which one is actually giving us the right answer
okay done!
ok
nice :)
i will run it for 100 times
100 times
and see what hte average is
then we will see for 1000 flips and avg that over 100 times
ok, interesting
okay i got
avgc() 11.83 >>> avgc() 11.87 >>> avgc() 11.88 >>> avgc() 11.78 >>> avgc() 12.15
avg 12.23
always hobering around 12
12 HHT for 100 flips
lets see if the ratio remains for 1000 flips
avgc() 124.833 >>> avgc() 124.711 >>> avgc() 124.499
the 1000 one is a lot more accurate
always hovering around 124.5
so for 100 we should be getting something like 12.45
avgc() 124.833 >>> avgc() 124.711 >>> avgc() 124.499 >>> avgc() 124.507 >>> avgc() 124.546 >>> avgc() 124.719 >>> avgc() 124.792
yep
ok, is it the same result for other sequences?
nope
what sequence you want to try ?
do you know how to use python
Somewhat, had an introductory course to programming in python.
for example HHH
i did avg of the 100 range 100 times and it is always 12.1 ish
here is my code
on the 9th line you can change it any sequence you want
as long as its length 3
i will try HHH
Thank you, I'll try it
oh its actually the same for HHH :O
samething for htt
12.1 to 12.15 ish
you can improve the accuracy if you tweak final part of the code
if you make the last part range 1000 and divided by 1000
but it might slightly lagg your computer
ok, i'll try it. Thanks for the program! What led me to believe that the expectation was different was the analysis in this wikipedia article: http://en.wikipedia.org/wiki/Penney's_game#Analysis_of_the_three-bit_game
wait a second let me check my code!!
it looks right
the brute force method cant be that off -_- unless i made some mistake in code let me check again
from random import* def check(a): x=['h','t'] slist=[] for i in range(a): slist.append(x[randint(0,1)]) count = 0 for i in range(len(slist)-2): if slist[i:i+3]==['h','h','t']: count=count+1 return count def avgc(): sum2=0 for i in range(100): sum2=sum2+check(100) avg=sum2/100.0 return avg sum1=0 for i in range(100): sum1+=avgc() avg2=sum1/100.0 print avg2
i fixed a mistake, but its pretty much the same thing
12.25* is your avg answer
for HHH and HTT and HHT
I read a document discussing how to find the probability of a "triplet" (for the diagram se attached file): "It is clear from the figures that one can arrive at either goal state by many different paths involving many different numbers of steps. To find the expected number of tosses for any given triplet, one could multiply the length of every unique path to that triplet with its probability of occurrence and take the sum of products over all unique paths".
@kingGeorge
i keep getting 12.25 for all the possible sequence of 3
maybe that wikipedia article is saying
The way I would approach finding the expected value of HHT, is to find the total number of length 3 sequences, and then multiply by the probability of getting HHT, or 1/8. So if you flip the coin 100 times, there are 98 total sequences of length 3. So the expected value would be 98/8=12.25.
if you consider the choices like one guy picks HHH and the other guy picks HHT then for that game, there is a difference chance of winning
that is what i thought the first time around too
but he said this wikipedia article had something else to say about it http://en.wikipedia.org/wiki/Penney's_game#Analysis_of_the_three-bit_game
i think that wikipedia article is saying something different that is how to win, based on the opponents choice or something
The game is completely different than what we want to solve. Penney's game is asking for the probability that a certain sequence occurs \(first\). The problem we're given has a fixed number of coin flips.
ya for example if u pick HHH and I pick THH then my 2HHs after i get a T can result from 2 of your waits so i have a chance of finishing faster
"An intuitive explanation for this result, is that in any case that the sequence is not immediately the first player's choice, the chances for the first player getting their sequence-beginning, the opening two choices, are usually the chance that the second player will be getting their full sequence. So the second player will most likely "finish before" the first player.[2]"
ok, I understand, thank you for taking time to answer my question, really appreciate it!
the probabililty you see for the HHH and THH will be the same but which one is faster is different
u want a program for this too xD
These nontransitive games are weird to think about for me. But the way I see it, every sequence is equally likely to show up at some point, but some are more likely to occur before certain other sequences. To get the nontransitivity bit, it requires you to choose two sequences in a certain order, but when we're talking about expected value, we only choose a single sequence.
or you can try fiddling around with that program yourself its pretty easy to implement it
you set up 2 counters for each game and award victory to the first sequence completed and repeat this process see the prob of win over 100 times and so on
yes, I can try it on my own, good exercise in python as well :) Thanks again!
sure !! see ya around
see ya :)
Join our real-time social learning platform and learn together with your friends!