ComenzarEmpieza gratis

Probability of losing money

In this exercise, we will use the DGP model to estimate probability.

As seen earlier, this company has the option of spending extra money, let's say $3000, to redesign the ad. This could potentially get them higher clickthrough and signup rates, but this is not guaranteed. We would like to know whether or not to spend this extra $3000 by calculating the probability of losing money. In other words, the probability that the revenue from the high-cost option minus the revenue from the low-cost option is lesser than the cost.

Once we have simulated revenue outcomes, we can ask a rich set of questions that might not have been accessible using traditional analytical methods.

This simple yet powerful framework forms the basis of Bayesian methods for getting probabilities.

Este ejercicio forma parte del curso

Statistical Simulation in Python

Ver curso

Instrucciones del ejercicio

  • Initialize cost_diff, the difference between the 'high' and 'low' cost options, to 3000.
  • Get the revenue for the high-cost option and assign it to rev_high.
  • Calculate the fraction of times when rev_high - rev_low is less than cost_diff. Call it frac and use it to print your results.

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

# Initialize cost_diff
sims, cost_diff = 10000, ____

# Get revenue when the cost is 'low' and when the cost is 'high'
rev_low = get_revenue(get_signups('low', ct_rate, su_rate, sims))
rev_high = ____

# calculate fraction of times rev_high - rev_low is less than cost_diff
frac = ____
print("Probability of losing money = {}".format(____))
Editar y ejecutar código