1. Learn
  2. /
  3. Courses
  4. /
  5. Statistical Simulation in Python

Exercise

Purchase Flow

After signups, let's model the revenue generation process. Once the customer has signed up, they decide whether or not to purchase - a natural candidate for a binomial RV. Let's assume that 10% of signups result in a purchase.

Although customers can make many purchases, let's assume one purchase. The purchase value could be modeled by any continuous RV, but one nice candidate is the exponential RV. Suppose we know that purchase value per customer has averaged around $1000. We use this information to create the purchase_values RV. The revenue, then, is simply the sum of all purchase values.

The variables ct_rate, su_rate and the function get_signups() from the last exercise are pre-loaded for you.

Instructions

100 XP
  • Model purchases as a binomial RV with p=0.1.
  • Model purchase_values as an exponential RV scale=1000 and the appropriate size.
  • Append rev with the sum of purchase_values.