[Math] the probability of an item in a list being chosen if both the list and item have different probabilities

percentagesprobabilityratio

This is kind of a programming question, but more so a mathematical question.

I have two lists that contain various items inside of the lists. Each List has a rate of being chosen, then each item in the list has a rate in being chosen.

Each list has the items randomly shuffled each time we start the question, so the order of the items is never the same…

Like so…

List 1 - 5% Chance of Being Chosen
    - Item 3: 5% Chance of Being Chosen
    - Item 1: 30% Chance of Being Chosen
    - Item 2: 60% Chance of Being Chosen
List 2 - 30% Chance of Being Chosen
    - Item 2: 80% Chance of Being Chosen
    - Item 3: 20% Chance of Being Chosen
    - Item 1: 90% Chance of Being Chosen

First I generate a random number and check it against the rate of List 1 being chosen. If the number is less than or equal to the "Chance of Being Chosen" for the list, we enter that list and then loop through each item once.

For each item we generate a random number and again if the random number is less then or equal to 'Chance of Being Chosen' of that item then the item is chosen.

What I want to know is if there is anyway to determine the probability that an item is chosen if the list itself only has a 5% chance of being chosen… Because if the list has a 5% chance and the item has a 30% chance, I know then that the rate that the item will be chosen is in fact not 30%…

Best Answer

You just multiply your probabilities out. The probability for any given item $x_{i}$ being chosen is given by $P(X_{i})P(x_{j})$ where $X_{i}$ is a list (and thus the left probability is of $X_{i}$ being chosen) and $x_{j}$ is an item in $X_{i}$, and $P(y)$ denotes the probability of $y$ being selected for any given $y$..

The above is assuming that you're considering objects in different lists to be distinct (so the number $3$ in list A is distinct from the number $3$ in list B). Otherwise you sum all the various probabilities for your $x_{i}$ being chosen in each way that it can be chosen, and that will yield your answer.

You probably want your probabilities for your lists summing to $1$. If $List 1$ is chosen $5\%$ of the time and $List2$ is chosen $30\%$ of the time then what happens the other $65\%$ of the time when neither is chosen?

Related Question