On Probability

As lottery, that would be a fraud.
It's a system to reroll (defect recycling) your pet's level in a free-to-play MMORPG. The currency is ingame gold to buy other pets to sacrifice.

pic-pet_defect_recycling.png

We are talking about reaching the best level of a tier C pet (level 4). You can use either another tier C pet (6%) or tier A (9%) and S (15%). I left out the tier B chance since it's the same as tier C (also 6%) but more expensive.

Tier C pets are ~20 mio, tier A ~60 mio and tier S pets are 120 million. Depends on the other players who farm and sell them.
 
such a game with be illegal in the usa and maybe elsewhere because the win should reflect probability of winning. see roulette rules for a hint :)
at 15% chance you probably have to win 6x or ticket price
 
in real world the house has usually a few percent advantage and the rest is math based. otherwise either the house goes bust or people move the more fair bets when they find out
 
in real world the house has usually a few percent advantage and the rest is math based. otherwise either the house goes bust or people move the more fair bets when they find out
Currently there are AI system monitoring house prices and in real time adjusting prices related to parameters number of chambers , square meters , area...
PS : pytorch is good for that :)
 
Well the question asked by the op is what is the "sum" of the geometric distribution. Well like all distributions the sum is always 1.

First the math :
What's the sum of : 1 +x + x*x +x*x*x +x*x*x*x +x*x*x*x*x + ....... =S
Multiply S by (1-x) and you get 1.
Meaning the sum S=1/(1-x)

Now discrete statistics:
E.g. : Probability of winning is 80%=0.8
What is probability of first winning on first time -> 0.8
What is probability of first winning on second time
---> It's the probability of not winning on first time i.e. 0.2 multiplied by probability of winning on second time i.e. 0.8
And so on
What is the total probability of winning ?
It's the sum ie :
0.8+ 0.2*0.8 +0.2*0.2*0.8 +0.2*0.2*0.2*0.8+......
=0.8(0.2^0+0.2^1 +0.2^2 +.....)
=y

So x=0.2 in the math formula so S=1/(1-0.2)=1/0.8

y=0.8*S=0.8/0.8=1
 
That does not answer the question.

You have two tickets of type 3.

What is the probability that you win with both, do not win with anyone, win with the one and not the other, the other and not the one. For this there are many possibilities and you cannot know it.

You only know the distribution of a ticket: win 6%, lose 94%.
 
I had an argument with our new QA manager.
We were submitting a condition report and for repaired size Tolerance she put ZERO. I told her you cannot have zero tolerance even at subatomic particle level.
You go putting zero tolerance on a government document and they will hold you to it. How do you measure that I dunno.
There is no such thing as zero tolerance.
"But there is no tolerance on the blueprint so it must be zero."
My god the stupidity of people.
 
if you have 2 tickets of 6% the chance to win is 12%
to win with both is about 0.4 %
to lose is 88%
To give you an example that you cannot do that.

I do it with probability 5% to simplify it.

Let we have a lottery with numbered 100 balls, ticket 1 mean a ball between 1 and 5 is taken, ticket 2 a ball between 6 and 10, etc.

For each of the 20 tickets, the probability to win is 5%. But the probability to win with 2 is 0, not 0.25%.

In this case, having two tickets duplicates the probability, but this is not always the case.
 
I have a suspicion the answer may be ticket 1. You pay 120 dollars, but you get 15% chance to win. For the same money, I can buy 6 tickets with 6% chance to win (option 3), but each of them only has a 6% chance of winning. The fact that you get 6 tries doesn't increase the probability of winning, it remains at 6% every time.

If you get struck by lightning while walking across a field, what is the chance you will be struck by lightining again a week later? Exactly the same. If I bought 100 lottery tickets last week, buying another one today has no greater chance of winning the lottery just because I bought the 100 tickets previously.
 
What does the statistican do to be safe from a bomb in the airplane? He brings one himself, because the chance for TWO bombs on the same flight is much much lower...

I have a suspicion the answer may be ticket 1. You pay 120 dollars, but you get 15% chance to win. For the same money, I can buy 6 tickets with 6% chance to win (option 3), but each of them only has a 6% chance of winning. The fact that you get 6 tries doesn't increase the probability of winning, it remains at 6% every time.
Chained chances are different. You have a 6% chance for winning, so a 94% chance for loosing. Your chance of loosing 6 times in a row (so not winning in 6 tests in a row) is 0.94^6 is 0.689, which means 31% chance of a win in these 6 tries. With ticket 1, you get 15% for the same money.
 
Which ticket offers the best value for money if you buy as much tickets until you win. Of course you want to spend as little money as possible.
I don't trust my intuition when it comes to translate a specification into statistics formula. So I created a simulation. I assume that this is a short of repeated lottery: I buy a ticket; if I win I stop; if I don't win I continue with another ticket and another lottery extraction, completely independent from the previous one.

These are the results

Markdown (GitHub flavored):
## TICKET SIMULATION RESULTS

Ticket Price: $60.00
Win Probability: 15.00%
Number of Trials: 1,000,000

Mean Cost: $400.27
Standard Deviation: $368.99

## TICKET SIMULATION RESULTS

Ticket Price: $60.00
Win Probability: 9.00%
Number of Trials: 1,000,000

Mean Cost: $667.07
Standard Deviation: $635.37

## TICKET SIMULATION RESULTS

Ticket Price: $20.00
Win Probability: 6.00%
Number of Trials: 1,000,000

Mean Cost: $333.76
Standard Deviation: $323.85

This is the code
Java:
import java.util.Arrays;
import java.util.Random;

public class TicketSimulation {
    private final double ticketPrice;
    private final double winProbability;
    private final int numberOfTrials;
    private final Random random;
    private double[] simulationResults;

    public TicketSimulation(double ticketPrice, double winProbability, int numberOfTrials) {
        this.ticketPrice = ticketPrice;
        this.winProbability = winProbability;
        this.numberOfTrials = numberOfTrials;
        this.random = new Random();
        this.simulationResults = new double[numberOfTrials];
    }

    /**
     * Simulates one experiment: buys tickets until winning
     * @return total cost spent
     */
    private double simulateOneExperiment() {
        int ticketsBought = 1; // At least one ticket
        
        // Keep buying tickets until we win
        while (random.nextDouble() > winProbability) {
            ticketsBought++;
        }
        
        return ticketsBought * ticketPrice;
    }

    /**
     * Complete all trials
     */
    public void runSimulation() {
        for (int i = 0; i < numberOfTrials; i++) {
            simulationResults[i] = simulateOneExperiment();
        }
    }

    /**
     * @return mean cost
     */
    public double calculateMean() {
        double sum = 0;
        for (double cost : simulationResults) {
            sum += cost;
        }
        return sum / numberOfTrials;
    }

    /**
     * @return variance
     */
    public double calculateVariance() {
        double mean = calculateMean();
        double sumSquaredDiff = 0;
        
        for (double cost : simulationResults) {
            double diff = cost - mean;
            sumSquaredDiff += diff * diff;
        }
        
        return sumSquaredDiff / numberOfTrials; // Sample variance
    }

    /**
     * @return standard deviation
     */
    public double calculateStandardDeviation() {
        return Math.sqrt(calculateVariance());
    }


    public void printResults() {
        System.out.println("");
        System.out.println("## TICKET SIMULATION RESULTS");
        System.out.println();
        System.out.printf("Ticket Price: $%.2f%n", ticketPrice);
        System.out.printf("Win Probability: %.2f%%%n", winProbability * 100);
        System.out.printf("Number of Trials: %,d%n%n", numberOfTrials);
        
        double mean = calculateMean();
        double stdDev = calculateStandardDeviation();
        
        System.out.printf("Mean Cost: $%.2f%n", mean);
        System.out.printf("Standard Deviation: $%.2f%n", stdDev);
    }

    public static void main(String[] args) {
        TicketSimulation t;
        int trials = 1000000;
        
        t = new TicketSimulation(60.0, 0.15, trials);
        t.runSimulation();
        t.printResults();
        
        t = new TicketSimulation(60, 0.09, trials);
        t.runSimulation();
        t.printResults();
        
        t = new TicketSimulation(20, 0.06, trials);
        t.runSimulation();
        t.printResults();
    }

}
 
OK, I was wrong. Cumulative probability increases with the number of tries:-
So considering option 3: the probability of not winning with the first 6% ticket is 94/100. If I try 6 successive tickets, the cumulative probability is (94/100)^6, which is 0.689.
Then the probability of getting a single win within the 6 trys is 1 - 0.689 which is 0.31, or 31%

Making the same calculation for option 2 gives a cululative probability of 17%.

So for my $120, the overall chance of winning is
option 1 - 15%
option 2 - 17%
option 3 - 31%

Therefore option 3 is the best chance.

Furthermore if the objective is to spend the least money, then I only need to buy 4 of the option 3 tickets to get a cumulative probability of 22% ( = (1 - ((94/100)^4)) ).

So 4 tickets of option 3 beats 2 tickets of option 2 and 1 ticket of option 1.
 
Back
Top