Ad Spend Optimizer
In advertising, it's of interest just how much to spend on an ad before the investment is no longer worthwhile. In this demo I attempt to show how D3 can connect to both a regression model, as well as to a numerical optimization (don't worry, users don't have to be aware that it's actually doing so), to help determine this optimal amount.
Below you'll see three curved lines; these are the result of running a regression on the relationship between a hypothetical company's advertising spending (the 'X' variable), and the revenue from this company's customers who go on to make a purchase (the 'Y'), within three customer segments. The lines appear curved because of how these returns on this spending diminish: the greater the number of impressions already purchased for a segment, the lesser the impact in purchasing a new one.
[Continued below....]
Try these things with this demo:
 Change the "budget # impressions"  to show the expected resulting revenue or profit
 Click "optimize budget"  to discover the profitmaximizing investment total across segments
(To determine this amount mathematically, I'm having D3 connect to an independent optimization routine, which sets the segments' marginal ROIs to zero, the firstorder condition)
 Change to "profit view"  to see how the curves peak at their points of maximal profit
 Change the "cost per impression"  and then click "optimize budget" again to see how these maximal profit points change in response
 Drag a red dot  to intervene manually into a specific segment's budget; the visualization reoptimizes the other points using what budget remains
 Click "optimize budget allocation"  to reset the segmentbysegment budgets to optimal, subject to the total overall budget constraint
(Mathematically here, I'm having D3 solve a system of equations to determine the investment points at which the marginal ROIs become equal)

