# Portfolio optimization applied to marketing

You can find the R gist here.

What has option pricing and portfolio optimization to do with digital marketing? Let’s recap a bit the basic ideas related to options and investments;

• options are a type of security more specifically a financial derivative which can be acquired or sold
• the price of an option is regulated by the stock market but has nevertheless a strong stochastic fluctuation
• a portfolio is usually a combination of cash, bonds, options etc but can be considered for our purposes as just a collection of options
• the investment question related to a portfolio is in essence; given a collection of options, how much of each should one buy in order to optimize the return? The problem is related to the balance between buying high-return/high-risk options and low-return/low-risk ones.

So, the portfolio optimization is related to digital marketing based on the following mapping (homomorhism);

• an option is just a stochastic variable with risk corresponding to the standard deviation and the return corresponding to the expected value. Typically, a high expectation value is linked to a big variation i.e. risk.
• a feature is just a stochastic variable giving the usage and a high usage presumably corresponding to a high chance of classifying the client (buy). One can discard the noisy features in order to ensure that potentially high-usage features are related to non-buying information.
• a large deviation corresponds to attracting a larger amount of clients and presenting information not immediately related to the buying process
• a portfolio corresponds to a selection of features which can be presented a marketing optimizations

Loosely speaking this leads to the following table;

Price Usage Clicks
Portfolio Suggestions Placement
Profit Conversions Clicks
Risk Sales drop Click through drop

According to the information available (mostly US patents, scientific articles and newspapers) the way that Efficient Frontier and Adobe are using this technique relies on the following steps;

• Stage 1
• tracking; usage of keywords, pages and other data
• search engines; data from search engines analytics
• keyword scoring and relations between pages (page ranking)
• Stage 2

Model creation and parameter estimation. Forecasting of how much hits a feature will have within a geographic region.

• Stage 3

Compare forecasting with reality, tuning the model. The model is being updated continuously.

### Details

The following is a sligfhtly more mathematical translation of the portfolio optimization described above

Let’s say you want to invest some money in the stock market. You choose a set of stocks and have a sum of money to invest. How should you distribute the money into the different stocks? There is a general tradeoff between risk and return; with higher potential return we often face higher risk. If we have a goal return in mind, then we should choose the portfolio allocation that minimizes the risk for that return. How can we do this?

Say, we have a series of options

symbols = [‘GOOG’, ‘AIMC’, ‘GS’, ‘BH’, ‘TM’, ‘F’, ‘HLS’, ‘DIS’, ‘LUV’, ‘MSFT’]

how do we find a vector x with length one such that it optimizes return?

You need to look at the options as stochastic variables Xi and the past values can tell you what the mean, variance and other statistical parameters are of the variable. Once the stochastic is parametrized the optimization amounts to maximizing the expectation of

$X = \sum_i x_i\;X_i$

but one usually looks at the maximization of the square

$\mathbb{E}(X^2) = x^T. C . x$

with C the covariance matrix. The goal to have a minimum return amounts to

$r^T_{avg}\;x\geq r_{min}$

$\sum x_i = 1, \; x_i\geq 1$

This is a so-called convex optimization problem which can be solved via a quadratic programming technique.

The quadratic equation shows the optimal return for a given risk. Below the line the portfolio has a too low return for the given risk.

### Concrete R code to calculate the efficient frontier

Many resources across the web give information in Python, R and other languages. The following was take from Building an Optimized Portfolio with R. The site contains in fact a whole course on so-called Modern Portfolio Theory(MPT) which is equivalent to the Markovitz theory and the efficient frontier.

Note that “efficient frontier” is both a technical term from MBT and the name of the company that Adobe bought on the way to their digital marketing cloud.

Key concept in all of this is mean-variance optimization approach (Markowitz’s Modern Portfolio Theory).

### Sketch of a custom solution for digital marketing

• one of the assumptions to apply MPT to marketing is that the usage of a feature is directly linked to a classified client. This of course is not true in general since one can have in principle a highly used webpage with, say, movie information which is unrelated to the goal or conversion while still being of interest to users. The way to alleviate this is by applying MPT to the signals and not to all (noisy) features. This would means that one takes the chi2 reduced features and apply MPT to end up with a way to order them.
• calculate the statistical mean and variations of the signals using either a large amount of data or estimating the probability distribution (with an implicit assumption about the normality of the stochastic variables)
• the Markovitz technique then immediately gives the efficient frontier and thus a feature portfolio for a an investor’s profile

What one should have in the end is a cube with

• the geographic nominal
• the scores (chi2, PCA, apriori)
• the centrality with respect to pagerank
• possibly info from search engine analytics
Tags: