I'd like to estimate the Cost Per Lead for a given advertising campaign.

I have eight data points, each with Cost and # of Leads for a given week. Here are the Costs:

  1. 81.05
  2. 63.17
  3. 171.44
  4. 104.53
  5. 95.33
  6. 39.06
  7. 80.88
  8. 110.55

Here are the # of Leads:

  1. 4
  2. 1
  3. 3
  4. 5
  5. 2
  6. 0
  7. 6
  8. 2

The Cost Per Lead is the Cost divided by the Number of Leads. This works for all weeks except Week #6, when there is a Cost ($39.06) but no Leads (0). For Week #6, the Cost Per Lead is a divided-by-zero error.

How should one handle that situation?

In terms of my larger goals here, I'd like to calculate the sample mean, and then also calculate the sample standard deviation and use that to estimate a confidence interval around the sample mean.

How would you handle that divided-by-zero data point?

  • 1
    $\begingroup$ Why do you have a cost associated with 0 leads? $\endgroup$ Jan 19 '17 at 22:32
  • $\begingroup$ This is a Google AdWords campaign. In Week 6, six people clicked on my ad, but none of them became Leads. $\endgroup$
    – bobbyh
    Jan 19 '17 at 22:42

In addition to the method above, you could construct the formula $$leads=\frac{leads}{cost}costs+\text{Google independent leads}$$ as $$y=mx+a$$ where m is the cost per unit, or as $$leads=m\times{cost}+a.$$ This takes the denominator problem away. You would then form a confidence interval about m. It also is approximately what you are looking for. However, you should also consider the possibility of diminishing returns. That is that increased costs do not lead to linearly increasing leads so that $$y=m\log(x)+a.$$ It is possible for you to have a popular site that does not lead to a proportionate increase in leads. The only difficulty is that you end up with a $$\frac{lead}{cost}=\frac{m}{x},$$ and so you would have varying costs.

Unfortunately, the above is the inverse of what you asked, but I still constructed it in this manner because your leads should be a function of views whose proxy is costs. I also assumed that your ad cost function was linear, if it is not, for example, if the cost of 10,000 views is not $10\times$ 1,000 views then you need to include that in your model.

If you do need cost per lead, then you can perform the inverse equation, but you need to be aware that it does not make causal sense if $x$ is thought of as an explanatory variable and $y$ is thought of as a response variable. The only way flipping the variables makes sense is if costs are a function of views and leads, in which case you are missing a variable here.

The peculiar problem of solving your problem as $1/m$ is that when you do that with the boundaries of the confidence interval, you will get a skewed interval.


If you compute the ratio before you average you have an infinite value which prevents you from getting mean, standard deviation or confidence interval. You could drop the one case but there really is no justification for that. Also there is no particular reason to believe that the ratio has a normal distribution. You could sum the numerator and sum the denominator and then take the ratio.

If you take that approach you could bootstrap to get estimates of the mean and standard deviation and construct a confidence interval for the sample mean using say Efron's percentile method. No need to assume normality or use the standard deviation (standard error of the mean) to get the confidence interval.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.