Get startedGet started for free

Sign up Flow

We will now model the DGP of an eCommerce ad flow starting with sign-ups.

On any day, we get many ad impressions, which can be modeled as Poisson random variables (RV). You are told that \(\lambda\) is normally distributed with a mean of 100k visitors and standard deviation 2000.

During the signup journey, the customer sees an ad, decides whether or not to click, and then whether or not to signup. Thus both clicks and signups are binary, modeled using binomial RVs. What about probability \(p\) of success? Our current low-cost option gives us a click-through rate of 1% and a sign-up rate of 20%. A higher cost option could increase the clickthrough and signup rate by up to 20%, but we are unsure of the level of improvement, so we model it as a uniform RV.

This exercise is part of the course

Statistical Simulation in Python

View Course

Exercise instructions

  • Initialize ct_rate and su_rate dictionaries such that the high values are uniformly distributed between the low value and \(1.2 \times\) the low value.
  • Model impressions as a Poisson random variable with a mean value lam.
  • Model clicks and signups as binomial random variables with n as impressions and clicks and p as ct_rate[cost] and su_rate[cost], respectively.
  • We then print the simulated signups for the 'high' cost option.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Initialize click-through rate and signup rate dictionaries
ct_rate = {'low':0.01, 'high':np.random.uniform(low=0.01, high=1.2*0.01)}
su_rate = {'low':0.2, 'high':____(low=0.2, high=1.2*____)}

def get_signups(cost, ct_rate, su_rate, sims):
    lam = np.random.normal(loc=100000, scale=2000, size=sims)
    # Simulate impressions(poisson), clicks(binomial) and signups(binomial)
    impressions = ____
    clicks = ____
    signups = ____
    return signups

print("Simulated Signups = {}".format(get_signups('high', ct_rate, su_rate, 1)))
Edit and Run Code