Practical Methods for Long-Only Return-Replication Portfolios
Summary
The document frames return replication as a least-squares portfolio problem: choose weights on a set of assets so their daily returns track a target asset. It introduces the unconstrained regression solution, then explains that requiring weights to be nonnegative and sum to one turns the task into constrained optimization. Additional preferences, such as holding only a few assets, can motivate regularization methods like ridge or lasso, which generally require iterative procedures.
The answer proposes parameterizing positive, fully invested weights with a softmax transformation and using gradient descent on the resulting utility. To discourage many tiny holdings, it suggests adding a linear charge for investing in each name. The discussion is conceptual and gives no implementation details, empirical comparison, or proof that this approach is best in practice. Its initial least-squares expression also omits the usual squared residual notation, while the later derivation uses squared error; readers should distinguish those formulations. The document raises broader questions about industry practice but does not resolve them comprehensively.
Key ideas
- Return replication can be expressed as fitting asset weights to a target return series.
- A fully invested long-only constraint makes the weights nonnegative and requires them to sum to one.
- Sparse portfolios may require regularization or a penalty on the use of individual assets.
- A softmax parameterization can enforce positive weights, with gradient descent used to optimize them.
Tags
Full text
# How is target return optimized, in practice?
# How is target return optimized, in practice?
Suppose we have $A$ a $T \times N$ matrix of daily returns for an asset universe of $N$ items, $b$ a $(T,)$ vector of daily returns for a target asset, $x$ a $(N,)$ weighting vector. We want a portfolio that replicates daily returns $b$ as closely as possible, subject to the constraint that portfolio weights $x$ sum to 1 and $x$ is non-negative (no shorting). One might use this for tax loss harvesting or hedging.
If we first consider the unconstrained case:
$$ \min_x \sum_t^{T} (A \cdot x - b) $$
This is nothing more than least-squares approximation / regression, whose objective can be re-written as:
$$ |Ax-b|^2 = (Ax-b)^T(Ax-b) = x^T{A^T}Ax - 2x^TA^Tb + b^2 $$
Taking the derivative wrt $x$ and setting to 0,
$$ 2A^TAx - 2A^Tb = 0 \\ x = (A^TA)^{-1}A^Tb $$
To handle equality constraints such as $x$ summing to 1, and inequality constraints like $x$ being non-negative, one can set up a constrained least squares problem, solve the KKT matrix, and still derive a closed form solution, albeit one that has cubic complexity due to necessity of inverting matrices.
However, the portfolio manager may have a few other constraints - maybe they prefer to keep $x$ relatively sparse, so they can just buy about 3-4 assets rather than allocating a small percentage across thousands of assets. There are more complex techniques like ridge regression, lasso regression, and so on, but these start to involve stepwise optimization (e.g. coordinate descent).
My question is one about how the portfolio optimization industry actually optimizes in practice: is it more similar to analytic convex optimization with simple inequality / equality constraints, and maybe a bit of hacks on top of the Least-square regression (for instance, rounding off small values of $x$), or is more step-wise optimization the norm? Given a sufficiently complex objective, would it make sense just to switch to a more black-box optimization algorithm, like a genetic algorithm or some kind of stochastic gradient descent optimizer?
## Answer by demully (score 2, accepted)
https://quant.stackexchange.com/a/65443
Your practical problem here is the insistence on non-negative weights, that sum to 1. There is no closed-form equation that solves this problem.
However, it can be done via iterative methods. You weight each stock i by Ai that is unbounded, Its portfolio weight Wi is e(AI)/sum(e(Ai)). The weights sum to 1 and are all positive.
SumW = sum(e(Ai))
dWi/dAi = Wi x (1-Wi) / SumW
dUtility/dAi thus becomes above x dUtility/dWi
Which can be gradient-descended.
Using this in reality, you might run into to a “ridge vs LASSO” problem of hundreds of tiny weights. These can be excluded by charging a linear penalty cost to the use of any weight to any stock. Your utility is just charged an extra S x e(Ai) for the bother of investing in that name. Otherwise the process is unchanged, even if sadly iterative in nature.
Hope this helps. DEMShown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.