OH! The probability

KittyKat7373

New Member
Joined
Aug 25, 2019
Messages
1
So I have a small issue with reading and greatly need help with a problem I am having and trying to get it to proof on my College homework.
I get the actual math behind it but trying to get the right formulas in Excel to work has been a major issue.

So the problem goes like this.

You are playing a game of flipping a coin. You have 10 flips of the coin to get 4 heads in a row.

Then I have to do that 10000 times. Yes. 10000 times, and get the percentile of the probability that you'd win....

College teachers why you do this too me!
 

joeu2004

Well-known Member
Joined
Mar 2, 2014
Messages
2,580
Office Version
2010
Platform
Windows
@KittyKat.... Since you "get the actual math", perhaps you can regale us with your knowledge, and tell us how you would calculate the probability mathematically. (BTW, it is not the same as the probability of getting 4 heads in any of the 10 flips.)

Then perhaps we could help you with the Excel formulation.

-----

In any case, I do not think that is what your instructor expects you do in Excel, unless it is also a part of the assignment that you did not state.

Instead, I think your instructor is asking for a simulation (10,000 samples of 10 flips each) that estimates the probability by counting the number of samples that have exactly(?) 4 heads in a row.

(Regarding "exactly": That is my interpretation. It is up to you to decide if "4 heads in a row" means "4 or more heads in a row".)

To that end, you might build a row of 10 formulas of the form =--(RAND()<0.5), which returns 0 or 1.

If one row of formulas is in A1:J1, note that COUNTIF(A1:J1,1)=4 tells you that there are exactly 4 "heads" (1s). However, you would need to do more to determine if the 4 heads are "in a row" (contiguous).

One idea.... Enter the following formula into K1: =CONCATENATE(A1,B1,...,I1,J1). Fill in the ellipses ("..."). In Excel 2016 and later, I believe you can write =CONCAT(A1:J1). Then in L1, use =AND(COUNTIF(A1:J1,1)=4, ISNUMBER(FIND("1111",K1))) to recognize 4 "in a row".

Repeat that row of formulas 10,000 times.

In M1, =COUNTIF(L1:L10000,TRUE) is the number of times we encounter 4 heads in a row. With a VBA macro (or manually), repeat the experiment many times (I did 100). Then the average of values in M1 divided by 10000 should approximate the probability of 4 heads in a row of 10 flips.

Of course, if you know how to calculate the probability mathematically, it would helpful to verify the experimental result.

-----

Forgive me for doing your homework assignment for you, if indeed I did it correctly. It was fun! And it was too difficult to offer "guidance" without being explicit.
 
Last edited:

Forum statistics

Threads
1,081,989
Messages
5,362,581
Members
400,683
Latest member
LogChief

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top