Here, we review the time value of money concept and its application to optimizing marketing (or other asset investment) spend. Time value of money A popular lifetime value (LTV) variant is built on top of the "time value of money" concept. Essentially this says that we'd rather have a dollar now than in the future. To formalize this, we imagine …
A regression fit can sometimes look surprisingly poor when plotted on top of data, with the two having visually different slopes. The reason is that the line that visually seems to go through the data best is that which minimizes total projection error, while the least squares fit minimizes squared \(y\) -error at each fixed \(x\) (e.g., see this …
Here, we consider the problem of allocating limited inventory across demand sites, given the availability of a lower-quality substitute that can be used when inventory runs out. We find that it can be optimal to send the premium item to only a subset of locations. Problem and general solution strategy In our first post on allocation , we argued that to …
We ask at which floors we should place a set of idle elevators in a building so as to minimize the expected wait time of the next caller. If there is just one elevator, we show that it should be placed at the "median of the demand distribution" — i.e., it should sit at the floor at which half the …
When steady traffic limits the speed on a road, we argue that its throughput becomes independent of traffic density. As a result, the time required to reach a destination depends only on the number of cars ahead. In this regime, a road behaves much like a standard queue. We explore several consequences of this perspective. Constant Throughput In a prior …
We review the classical framework for profit-maximizing pricing under steady demand. Here, demand elasticity is the key quantity governing price sensitivity, and we show how it can be estimated from historical data. Once elasticity is known, retailers can plug it directly into the profit-maximizing pricing formulas: one for setting prices before a selling period, and another for adjusting prices…
Forecast error leads to misallocation of inventory across demand channels, driving lost sales. For example, for a product with \(100\) units of demand split across two channels, we find that relying on a single prior sales cycle to guide allocation leads to a loss of roughly \(3\%\) of potential sales. In general, we find that misallocation losses scale as \begin …
Brands often sell through both the direct-to-consumer (DTC) and wholesale channels, with demand in each uncertain before the season starts. Wholesale orders happen first at a lower price, and whatever inventory remains goes to DTC. This introduces a key gamble: Should we always accept a wholesale order if it comes in now, or should we reserve some pre-determined amount of …
Retailers prefer to carry products that have both high expected demand and low demand uncertainty. Unfortunately, these are competing concerns, and so it's not always obvious which product to choose when one option has both higher expected demand and higher demand uncertainty. Here, we present a simple formula for a product's risk-adjusted expected profit, using the newsvendor model. This score …
We consider the problem of allocating a fixed inventory across multiple locations. To maximize expected sales, units should be distributed so that each site reaches the same sell-through probability. Interestingly, this implies we should often send more units to sites with greater demand uncertainty. We walk through an example that shows how operations teams can apply the strategy in practice …
E-commerce apparel return rates today average around 20% — but this average is rising, and rates on individual products vary widely. In this post, we introduce simple equations to estimate an item’s expected profit and margin based on its return rate, damage rate, and price. Inventory managers can use these formulas to assess true profitability across their assortment over time …
Why do grocery stores often carry over 100 options for both cheese and wine — but just a handful for pasta? In this post, we explore the economic forces behind that imbalance, highlighting four key traits that determine whether a product category can realistically support a broad assortment. To test the framework, we review assortments across various industries and find that …
I'm obsessed with optimizing complex assortments – catalogs in categories like apparel, wine, and beauty, where many products compete for the same customer attention. In these cases, a product should only be carried if it satisfies demand that would otherwise go unmet , lifting net sales. But that kind of uplift impact is harder to measure – and far less intuitive – than a …
The newsvendor model provides inventory planners with a framework for setting optimal order quantities when demand is uncertain and there is a limited selling window – as in seasonal apparel. Buy too little and you run the risk of early stockout and missed sales, too much and you risk write-offs and markdowns. Here, we cover: The classical formula for profit-maximizing order …
In our last note, we discussed safety stock analysis — how to decide when to reorder. Here, we turn to the question of how much to order each time, using the classical Economic Order Quantity (EOQ) model. Three key takeaways: The optimal order size balances capital costs (which favor small, frequent orders) against ordering costs (which favor larger, less frequent orders …
In this back-to-basics post, we review three results from safety stock theory that can help retailers to maintain a lean inventory without compromising service levels. Key insights: Stockouts can’t be eliminated entirely—the goal is to balance acceptable stockout risk against inventory costs. The two major drivers of stockout risk are uncertainty in customer demand and supplier lead time …
Merchandisers often carry a single garment in multiple prints or colorways. This can lift net sales by appealing to different preferences, but beyond a certain point, new variants might simply compete with the others — lifting expense but not sales. To understand where that tipping point lies, we’ll explore here two limiting cases. The results: For products where customers usually …
Accurately identifying a garment's color is essential for many modeling applications. However, a quick glance at any single garment image reveals a mix of colors—e.g., consider the many shades of purple in the sweater above. This suggests the question: Are the colors in a "single-color" garment image related in any meaningful way? By analyzing images, we find that …
It's risky for a business to invest in new, unproven products. Yet, there are two strong forces pushing apparel businesses to invest heavily in new styles. In this post, we examine how these competing forces shape strategy across different apparel sectors and introduce a mathematical framework for rationally setting new style investment. By applying this model, businesses can make data-driven …
I confess I sometimes don't pay the parking meter when I just need to pop into a store to quickly grab an item. In times like these, the risk of a ticket can feel ... worth it -- but is it? To decide, we posit that parking enforcement officers random walk about and effectively check a given spot with rate \(\lambda\) (E …
My friend Andrew is an advocate of the "spaced repetition" technique for memorization of a great many facts [1]. The ideas behind this are two-fold: When one first "learns" a new fact, it needs to be reviewed frequently in order to not forget it. However, with each additional review, the fact can be retained longer before a refresher is needed …
There are four ways to make change for \(N=10\) cents: \(\{\) 10 pennies; 1 nickel and 5 pennies; 2 nickels; 1 dime \(\}\) . How many ways are there to make change for one trillion dollars -- using just pennies, nickels, dimes, and quarters? To answer this, we present here a hybrid dynamic programming / analytic strategy that allows us to count the number …
In this note, I consider a generalization of Dollar Cost Averaging -- a popular investing strategy that involves gradually building up one's holding in a stock over a pre-specified period of time. The generalization I consider can guarantee better prices paid per share -- relative to the standard approach -- but its use comes at the cost of requiring one to have a …
Textbook proofs of the duality theorem often apply abstract arguments that offer little tangible insight into the relationship between a linear program and its dual. Here, we map the general linear program onto a simple mechanics problem. In this context, the significance of the theorem is relatively clear. The general linear program and its dual The goal of a linear …
We review how one can price a dividend-bearing stock by simply discounting its dividend stream using the value suggested by the Capital Asset Pricing Model (CAPM). As an example, we consider the price of AT&T common stock. The model result matches the current market price quite well. Varying inputs to the model also allows us to explore how its …
A person's happiness does not depend only on their current lot in life, but also on the rate of change of their lot. This is because a person's prior history informs their expectations. Here, we build a model that highlights this emotional "path-dependence" quality of utility. Interestingly, we find that it can be gamed: One can increase net happiness via …
I was struck the other day by the following: The cooking instructions on my Bob's tri-colored quinoa package said to combine 2 cups of water with 1 cup of dried quinoa, which would ultimately create 4 cups of cooked quinoa. See image above. My first reaction was to believe that some error had been made. However, I then realized that …
Pooling of test samples can be used to reduce the mean number of test counts required to determine who in a set of subjects carries a disease. E.g., if the blood samples of a set of office workers are combined and tested, and the test comes back negative, then the full office can be ruled out as disease carriers …
CPPI* is a risk management tactic that can be applied to any investment portfolio. The approach entails banking a percentage of profits whenever a new all time high wealth is achieved, thereby ensuring that a portfolio's drawdown never goes below some maximum percentage. Here, I review CPPI and then consider the mean growth rate of a CPPI portfolio. I find …
We consider the equilibrium drawdown distribution for a biased random walk -- in the context of a repeated investment game, the drawdown at a given time is how much has been lost relative to the maximum capital held up to that time. We show that in the tail, this is exponential. Further, when mean drift is small, this has an exponent …
We give a simple class for marking the time at different points in a code block and then printing out the time gaps between adjacent marked points. This is useful for identifying slow spots in code. The TimeMarker class In the past, whenever I needed to speed up a block of python code, the first thing I would do was …
Here, we highlight one of the most important benefits of tax protected accounts (eg Traditional and Roth IRAs and 401ks). Specifically, we review the fact that not having to pay taxes on any investment growth that occurs while the money is held in the account results in compounding / exponential growth with a larger exponent than would be obtained in a …
We consider how the GDP or utility output of a city depends on the number of people living within it. From this, we derive some interesting consequences that can inform both government and individual attitudes towards newcomers. Edit 9/2022: The model here can't be complete because it doesn't take into account city capacity. The true utility functions should be …
We use a simple argument to estimate the speed of traffic on a highway as a function of the density of cars. The idea is to simply calculate the maximum speed that traffic could go without supporting a growing traffic jam. Jam dissipation argument To estimate the speed of traffic as a function of density, we'll calculate an upper bound …
We illustrate the application of two linear compression algorithms in python: Principal component analysis (PCA) and least-squares feature selection. Both can be used to compress a passed array, and they both work by stripping out redundant columns from the array. The two differ in that PCA operates in a particular rotated frame, while the feature selection solution operates directly on …
This is a tutorial post relating to our python feature selection package, linselect . The package allows one to easily identify minimal, informative feature subsets within a given data set. Here, we demonstrate linselect 's basic API by exploring the relationship between the daily percentage lifts of 50 tech stocks over one trading year. We will be interested in identifying minimal …
This note addresses the typical applied problem of estimating from data how a target "conversion rate" function varies with some available scalar score function -- e.g., estimating conversion rates from some marketing campaign as a function of a targeting model score. The idea centers around estimating the integral of the rate function; differentiating this gives the rate function. The method …
We review the math and code needed to fit a Gaussian Process (GP) regressor to data. We conclude with a demo of a popular application, fast function minimization through GP-guided search. The gif below illustrates this approach in action -- the red points are samples from the hidden red curve. Using these samples, we attempt to leverage GPs to find the …
Here, I give a quick review of the concept of a Martingale. A Martingale is a sequence of random variables satisfying a specific expectation conservation law. If one can identify a Martingale relating to some other sequence of random variables, its use can sometimes make quick work of certain expectation value evaluations. This note is adapted from Chapter 2 of …
We review binary logistic regression. In particular, we derive a) the equations needed to fit the algorithm via gradient descent, b) the maximum likelihood fit's asymptotic coefficient covariance matrix, and c) expressions for model test point class membership probability confidence intervals. We also provide python code implementing a minimal "LogisticRegressionWithError" class whose…
I review -- and provide derivations for -- some basic properties of Normal distributions. Topics currently covered: (i) Their normalization, (ii) Samples from a univariate Normal, (iii) Multivariate Normal distributions, (iv) Central limit theorem. Introduction This post contains a running list of properties (with derivations) relating to Normal (Gaussian) distributions. Normal distributions are…
The AUC score is a popular summary statistic that is often used to communicate the performance of a classifier. However, we illustrate here that this score depends not only on the quality of the model in question, but also on the difficulty of the test set considered: If samples are added to a test set that are easily classified, the …
We demo a script that converts python numerical commands to LaTeX format. A notebook available on our GitHub page will take this and pretty print the result. Introduction Here, we provide a simple script that accepts numerical python commands in string format and converts them into LaTeX markup. An example input / output follows: s = 'f(x_123, 2) / (2 + 3/(1 …
Here, we provide a brief introduction to reinforcement learning (RL) -- a general technique for training programs to play games efficiently. Our aim is to explain its practical implementation: We cover some basic theory and then walk through a minimal python program that trains a neural network to play the game battleship. Introduction Reinforcement learning (RL) techniques are methods that can …
Here, we briefly review a subtlety associated with machine-learning model selection: the fact that the optimal hyperparameters for a model can vary with training set size, \(N.\) To illustrate this point, we derive expressions for the optimal strength for both \(L_1\) and \(L_2\) regularization in single-variable models. We find that the optimal \(L_2\) approaches a finite constant as \(N\)…
We review the Metropolis algorithm -- a simple Markov Chain Monte Carlo (MCMC) sampling method -- and its application to estimating posteriors in Bayesian statistics. A simple python example is provided. Introduction One of the central aims of statistics is to identify good methods for fitting models to data. One way to do this is through the use of Bayes' rule: If …
We review classical linear regression using vector-matrix notation. In particular, we derive a) the least-squares solution, b) the fit's coefficient covariance matrix -- showing that the coefficient estimates are most precise along directions that have been sampled over a large range of values (the high variance directions, a la PCA), and c) an unbiased estimate for the underlying sample variance…
Queries ping a certain computer server at random times, on average \(\lambda\) arriving per second. The server can respond to one per second and those that can't be serviced immediately are queued up. What is the average wait time per query? Clearly if \(\lambda \ll 1\) , the average wait time is zero. But if \(\lambda > 1\) , the queue grows indefinitely …
A common task in applied statistics is the pairwise comparison of the responses of \(N\) treatment groups in some statistical test -- the goal being to decide which pairs exhibit differences that are statistically significant. Now, because there is one comparison being made for each pairing, a naive application of the Bonferroni correction analysis suggests that one should set the individual …
Two microphones are placed in a room where two conversations are taking place simultaneously. Given these two recordings, can one "remix" them in some prescribed way to isolate the individual conversations? Yes! In this post, we review one simple approach to solving this type of problem, Independent Component Analysis (ICA). We share an ipython document implementing ICA and link to …