+ Reply to Thread
Results 1 to 9 of 9

Simulate outcomes of combinations, with probability of rank among other competitors

  1. #1
    Registered User
    Join Date
    03-30-2021
    Location
    Netherlands
    MS-Off Ver
    2016
    Posts
    5

    Simulate outcomes of combinations, with probability of rank among other competitors

    Hello,
    The title may be a little bit confusing so I'll explain.
    I'm running a sports prediction competition, for which I use Excel to calculate the scores.
    In each match, there are a few outcomes that can happen. When I enter the results, the scores of the participants update automatically.
    After that, the participants will be ranked from highest to lowest score totals up to the current round.
    Everything up to this point I have already automated in my Excel sheet after I simply enter the outcomes of matches.
    However, I thought it would be cool if I could calculate the probabilities of each player ending up at a certain rank based on all the possible combinations of results that can happen.
    The number of combinations is quite large, about 18,5 million combinations, which is a multiplication of 7 different matches' possible outcomes.
    Assuming each outcome is equally likely to happen, how can I calculate the probabilities of each participant ending up at a certain position? And is this even possible to run with the amount of combinations that can happen?
    I'd like the end result to show a percentage likelihood of each participant of the competition to end up at a certain rank.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,152

    Re: Simulate outcomes of combinations, with probability of rank among other competitors

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file.

  3. #3
    Registered User
    Join Date
    03-30-2021
    Location
    Netherlands
    MS-Off Ver
    2016
    Posts
    5

    Re: Simulate outcomes of combinations, with probability of rank among other competitors

    Hello JohnTopley,
    I don't need a particularly fast answer with this. Receiving an answer is also not necessary for me.
    I don't want to share Excel files here so I'll explain it using cells (note that I'm not an expert of sorts)

    There are 7 matches for which participants can enter predictions. The possible results are arranged in cells A1:A13, B1:B13, C1:C13, D1:D13, E1:E13, F1:F10 and G1:G5. When a result is correct, I enter a 1. All other cells remain 0.
    I have a column called Leaderboard with the names of the participants, and in the cells next to them are the formulas that calculate the scores they receive based on the 1's I entered. So they are in cells I1:I10 (there are 10 participants right now).
    Next to this column of cells - J1:J10 - I use the RANK function which denotes the rank each participant has in the competition. When someone has the third highest score, their rank is 3.
    This is what I've got so far.
    Through the installation of the Solver, I have learnt to use only binary because then, in extra cells, I can add up the total of cells A1:A13, B1:B13 and so on so that they are a specific number. In this case, for all 7 matches, that sum cell would need to be 1, since there is one result for each matchup. I don't know if I can use the Solver widget for this, but I thought I should mention. These sum cells are in A14, B14 up to G14.
    13*13*13*13*13*10*5=18564650, this is the number of combinations of results that can happen on this week's matches. I don't know if this is very large or not large at all.
    What I'd like to add is a chart that shows the percentage likelihood of each participant ending up at each rank, from 1st to 10th. When they get first in 1000000 of the 18564650 combinations, that percentage would be approx. 5,4% for 1st. To achieve this, I assume I need to know the following:
    - How can I run Excel to simulate all these combinations and their outcomes.
    - How can I extract from that data, the percentage of times each participant achieves a certain position on the leaderboard.
    For this to work I guess I need to assume that every outcome of every match is equally likely to happen so that I only have to worry about the combinations.

    Any help is greatly appreciated. I have no idea of the complexity of this question but it's something I'd like to be able to do properly.

  4. #4
    Registered User
    Join Date
    03-30-2021
    Location
    Netherlands
    MS-Off Ver
    2016
    Posts
    5

    Re: Simulate outcomes of combinations, with probability of rank among other competitors

    I should probably add that I want Excel to run all the possible combinations by changing one of the cells in each group of possible outcomes from 0 to 1. I know this is something that's possible with the Solver by adding sum cells and adding conditions that each of those cells is 1 (where the Solver considers all possibilities by changing the designated cells in binary fashion to determine the preferred result), but the other parts of this problem make it seem like it can't be done within the Solver alone. Also because the final result I'd like to have - the likelihood of the participants ending up at a certain rank in percentages - is not a result you can select in the Solver.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,152

    Re: Simulate outcomes of combinations, with probability of rank among other competitors

    If you cnnot provide a sample file then you are unlikely to get any answer

    Receiving an answer is also not necessary for me
    Any help is greatly appreciated.

  6. #6
    Registered User
    Join Date
    03-30-2021
    Location
    Netherlands
    MS-Off Ver
    2016
    Posts
    5

    Re: Simulate outcomes of combinations, with probability of rank among other competitors

    Hello John,

    I will add a file now, but it's a simplified version of the spreadsheet I use because that one contains more data. I'll also simplify the problem, since what I proposed earlier seems unachievable.

    In the file, I have seven columns of 0's. These represent the possible outcomes of matches 1 through 7, which are represented in columns A through G. The amount of cells in each column varies per match. The result of the match is denoted by a 1, the other cells remain 0.
    On the right side I have five players in column I.. These players get points based on the results of the matches as calculated with the 1's that are added. The score is shown in column J. In column K, it shows the rank of each person based on highest to lowest scores.

    I will simplify the task to this:
    I would like to (not manually) randomly change one cell in each column from 0 to 1. As explained earlier, this automatically changes the score and rank cells in columns I and J respectively.
    This should be an automated process.
    This should be repeated, say, 10,000 times.
    The amount of times each person gets a certain rank in these 10,000 randomly selected combinations need to be returned as a percentage of times out of all combinations generated. Example: if John gets rank 2 3,000 times, he is 2nd place 30% of the time.
    I want this percentage to be calculated for each player and for each rank possible.

    Is this something you can do in Excel?

    P.S. I tried to add an attachment but I don't know if I did it right. If I didn't, I'll be trying it again.
    Also, I didn't put in the effort of adding the formulas from the cells in columns I and J that calculate the scores and ranks since that took quite some time and this is not the actual spreadsheet.
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,814

    Re: Simulate outcomes of combinations, with probability of rank among other competitors

    Now the problem is starting to sound more like a Monte Carlo simulation kind of problem. You might look at this tutorial I put together https://www.excelforum.com/tips-and-...l-problem.html simulating the Monty Hall problem. The main idea I try to get across is to put each "game" simulation in a single row so that it is easy to make more/fewer copies. Then you can summarize the results of however many simulations you want to run (up to the limit of 1E6 rows in an Excel spreadsheet).

    It's not clear to me how you intend to choose which cells are 1 and 0 in each row of your sample file, nor how you calculate the final points and rank from those rows of 1/0. If I have correctly understood that you are wanting to use a Monte Carlo simulation type of approach here, adjust your spreadsheet so that each simulation fits into a single row, then calculate scores and ranks for each row. Then you can summarize those simulations to get approximate probabilities for different scenarios.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  8. #8
    Registered User
    Join Date
    03-30-2021
    Location
    Netherlands
    MS-Off Ver
    2016
    Posts
    5

    Re: Simulate outcomes of combinations, with probability of rank among other competitors

    Hello MrShorty,

    I have heard of the Monte Carlo simulations. I'm not sure how they apply here, though, because the number of combinations exceeds 18 million.
    I decided to share the actual file since it seems otherwise I can't get helped out but removed some information. The formulas are the same.

    Left of the leaderboard are a few sections. In the top left, there are 10 sportsmen. One of them is the winner, four of them are semi finalists and two get eliminated. When one of these applies to a player, the value changes from 0 to 1 in the columns C2:C11, D2:D11 and E2:E11.
    In the bottom left are the matches of the first week. There are 13 possible results for each of the five matches. The result of a match gets signified by a 1, while the rest remains 0. So in each column, one of the cells from C16:C28 - G16:G28 changes to 1.
    Using the Solver widget for other projects I did in the past, I learnt to add a cell that sums up these columns of relevant cells, so that I could add a condition that that cell, say, equals 1.
    When I enter a 1 in a cell, the scores of the participants of the prediction competition, which are in the top right, get calculated automatically with the formulas in the cells J2:J12 and K2:K12. In the cells L2:L12, the rank of each participant among the pool of players gets shown.

    What I'd like to add to that, is a table where each player's probability of achieving a certain rank gets shown. This would be having the names of the players, each position (1st through 11th) and the percentage of times they achieved that rank.
    I would like to do this by running about 10,000 simulations, where in each simulation, exactly one cell for each match gets changed from 0 to 1, while the rest remain 0's. Then, I would like it to note the rank each player received in that simulation, and this 10,000 times. I do not need it to show the amount of points each player got.
    At the end, I would like for each player to get a percentage of times it got a certain rank. So if Indy got 1st rank 1,000 times out of 10,000 simulations, they'd get first 10% of the time.

    I really hope this is enough explanation for you to be able to help me out. Please don't try to sound too mean; I feel offended by my seeming incapabilities to cooperate with people that know better than me.
    Attached Files Attached Files

  9. #9
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,814

    Re: Simulate outcomes of combinations, with probability of rank among other competitors

    I have heard of the Monte Carlo simulations. I'm not sure how they apply here, though, because the number of combinations exceeds 18 million.
    A total population of 18 million combinations is exactly why a Monte Carlo simulation can apply here. The idea is, rather than generate all 18E6 possibilities and analyze the result, select 10000 (or however many we deem appropriate) random samples from among the 18E6 combination, analyze the results of that sample, and use that result to estimate the probabilities.

    After getting a handle on what your sheet is doing (inputs of 1 and 0 in C2:E11, and C16:G28, calculate score and rank J2:M12 and rules as described in post #8 [I hope I understood them]), I decided to use a Data Table (https://www.excel-easy.com/examples/data-tables.html ) to compute several simulation results, then analyze the results from the data table to get the probabilities. Step by step (see sample file):
    1) Generate random inputs.
    1a) I reduced the C2:E11 inputs to the problem of sorting the 10 players into a random order (which reduces to the problem of shuffling the numbers 1 to 10 in random order). The 1 player will have a 1 in the winner column, players 2-5 will get a 1 in the Top 4: column, and players 6 and 7 will get a 1 in the Elim'd: column. Players 8-10 will be 0 in all three columns. Shuffling the numbers 1 to 10 in random order is accomplished by generating 10 random unique numbers (Excel's RAND() function in columns S:AB), then ranking those unique numbers (=RANK() function in columns AC:AL My older version does not support the RANK.EQ() function).
    1b) The inputs to C16:C28 simplified down to choosing a random position (a random number between 1 and 13) and enter a 1 in that position in each column. There are 5 columns/"matches", so I need 5 random numbers between 1 and 13 (RANDBETWEEN() function in AM:AQ).
    2) I need a way to get my random inputs from step 1 into the appropriate 1's and 0's in the main input cells.
    2a) I need to get the random numbers for 1 simulation into a block that is easily accessible to the input and calculation block. I enter a 1 (sim#) in P1, then I use an INDEX() function to extract the random numbers for that sim# (See the TRANSPOSE(INDEX(...)) array function in P2:P16).
    2b) I need to translate the random numbers in P2:P16 to the appropriate 1's and 0's in C2:C11. I use IF() functions for this (see C2:E11). I also need IF() functions in the C16:G28 block (note the numbers 1 to 13 I entered in B16:B28 for this IF() function).

    3) At this point, I can enter a sim# into P1 and get the results for that set of random numbers. Now I use a Data Table as mentioned above to have Excel enter a bunch of different sim#s into P1 (taken from column AT) and output the result of each sim in the adjacent columns AU:BG.
    3a) Enter the numbers 1 to whatever in AT3 and down (I went to about row 200). In AU2:BG2, I enter the "output" function that will tell the data table what outputs to bring back to the data table. I use another TRANSPOSE() function to bring the rankings from M2:M12 over to AU2:BG2.
    3b) Select AT2:BG200 (or however far down you decide to go with this) and create a data table with a column input cell of P1. Excel creates the data table by putting each value in AT into P1 and pulling the values from M2:M12 and putting them into columns AU:BG.
    4) Now I can analyze the results of the simulations.
    4a) I need to count the total (=COUNT(AT2:AT10000) in BV1
    4b) I need to count how many times each leaderboard was ranked in each position. I used a FREQUENCY() function (https://support.microsoft.com/en-us/...7-fd9ea898fdb9 )for this though a COUNTIFS() function would also work. See the upper table in columns BJ:BT
    4c) Estimated probability for each rank for each leaderboard is simply the count of each rank divided by the total. See the lower table in BJ:BT.

    From here, the only thing needed to expand the simulations is to copy formulas generating the random inputs down farther and create the Data Table so that it extends farther down.

    If I started from scratch, I probably would have done something different with your calculations in columns A:M, but I did not try to reverse engineer those so I could understand them well enough to start from scratch. This is part of why I resorted to a Data Table instead of something else.

    Of course, this assumes that you want to use a Monte Carlo simulation type of thing for this analysis. At only 200 simulations, I was noticing a short (1-2 sec) lag for each calculate event. I have no idea how long it would take to calculate all 18E6 permutations this way. This kind of Monte Carlo approach allows us to avoid needing to calculate all 18E6 permutations and estimate the probabilities off of a much smaller sample of the available permutations. These estimates will probably have some uncertainty in them. However, even at only 200 simulations, I could see patterns in the estimated probabilities -- places in the table that tended to be 5% and others that were more like 15%, so there seemed to be some reason to believe that the results would be acceptable with more simulations.

    See if that helps.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Formula for Probability with multiple outcomes
    By hollacost69 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-26-2020, 09:50 AM
  2. Replies: 3
    Last Post: 09-05-2016, 08:34 PM
  3. Generating random outcomes based on probability
    By JP2008 in forum Excel General
    Replies: 9
    Last Post: 12-07-2015, 04:48 AM
  4. Placing competitors in rank order based on two scores
    By Gemsie in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-10-2013, 04:59 PM
  5. using @risk to simulate the probability
    By bruceday in forum Excel General
    Replies: 1
    Last Post: 11-05-2012, 03:29 PM
  6. generate numbers given probability of outcomes
    By jerdjets in forum Excel General
    Replies: 5
    Last Post: 11-15-2007, 07:25 AM
  7. Probability Question:probability outcomes
    By Myles in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-01-2006, 06:45 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1