Attributing Multiplicative Metric Changes Across Variables
Summary
The document explores how to allocate a total change in a metric among several multiplicative components. It frames the attribution as integrating a multivariable function’s total derivative between its initial and final values. Because partial contributions depend on the path taken through variable space, a single ordering of component changes can produce a different allocation from another ordering.
One proposed method averages contributions across all paths that change one variable at a time along the edges of the initial-to-final hypercube. For three variables, this means considering every ordering of the changes; the answer notes that this average coincides with a full finite-difference approach using all combinations of starting and ending values. The method offers a principled allocation of the total change, but the discussion concerns mathematical attribution rather than trading returns, and the chosen path-averaging convention is an assumption about how to divide interaction effects.
Key ideas
- Attributing a multivariable change requires a rule for dividing interactions among variables.
- Partial contributions can depend on the order in which variables are changed.
- Averaging across all edge paths gives each ordering equal weight.
- The full finite-difference approach evaluates the function at every combination of initial and final variable values.
Tags
Full text
# Multiplicative Metric Variance
# Multiplicative Metric Variance
I come from a math/statistics background and as learned some stuff as a data analyst I learned a certain technique to calculate period to period variances between some metrics.
I was wondering if anyone is able to identify the general concept of the following problem (I have never learned anything like this academically so I cannot
The idea is that from period 1 to period 2, x varies 1.6% where it's multiplicative components a, b and c have a certain amount of weight that adds up to 1.6%.
So in the example, component a was the driver that brought down the value of x out of the three.
Any help or suggestion is welcome.
## Answer by Kermittfrog (score 3, accepted)
https://quant.stackexchange.com/a/77620
IMHO, this part of my explanation is more well-thought out. For sake of transparency, I will leave the first version of my answer below - it still has some merit of its own, but does lack the "rigor" (alas, I am no mathematician).
A bit of background
As I understand it, we are looking for a way to integrate the total derivative of some function $f$ in multiple variables.
$$ \int \mathrm{d}f=\sum_i \int\frac{\partial f}{\partial x_i}\mathrm{d}x_i $$
In our example,
$$ \int \mathrm{d}f=\int\frac{\partial f}{\partial x} \mathrm{d}x+\int\frac{\partial f}{\partial x} \mathrm{d}y+\int\frac{\partial f}{\partial z} \mathrm{d}z $$
Solving this integral involves a path integral from the initial point $(x_0,y_0,z_0)$ to the point $(x_1,y_1,z_1)$. As this happens in three dimensions, there exist multiple paths that could get us there. We could first move along the $x$-axis, then along the $y$-axis, then the $z$-axis, or any other combination of paths, or we could even go "straight" through this 3d-object along a parameterised path.
Let's assume that we restrict ourselves to choosing only paths that traverse the edges, i.e. we only move along any given line segment, consecutively, then we would have the following possible combinations:
$$ \begin{align} (000)\to(100)\to(110)\to(111)\\ (000)\to(100)\to(101)\to(111)\\ (000)\to(010)\to(110)\to(111)\\ (000)\to(010)\to(011)\to(111)\\ (000)\to(001)\to(101)\to(111)\\ (000)\to(001)\to(011)\to(111) \end{align} $$
i.e., again, there are six possible paths between the two points - all equally likely. Let's make the calculation explicit along the first path:
$$ \int \mathrm{d}f=\int\frac{\partial f}{\partial x} \mathrm{d}x+\int\frac{\partial f}{\partial x} \mathrm{d}y+\int\frac{\partial f}{\partial z} \mathrm{d}z $$
As we move along $x$ first, we have
$$ \int\left.\frac{\partial f}{\partial x}\right|_{y=y_0,z=z_0} \mathrm{d}x=f(x_1,y_0,z_0)-f(x_0,y_0,z_0) $$
As we only moved along $x$, $y$ and $z$ stay constant, i.e. $dy=dz=0$. Having moved from $x_0\to x_1$, we now add the movement in $y$ direction:
$$ \int\left.\frac{\partial f}{\partial y}\right|_{x=x_1,z=z_0} \mathrm{d}y=f(x_1,y_1,z_0)-f(x_1,y_0,z_0) $$
Ultimately, we move along the $z$ dimension: $$ \int\left.\frac{\partial f}{\partial z}\right|_{x=x_1,y=y_1} \mathrm{d}z=f(x_1,y_1,z_1)-f(x_1,y_1,z_0) $$
Adding these terms we obtain:
$$ \begin{align} \int\mathrm{d}f & =\left(f(x_1,y_0,z_0)-f(x_0,y_0,z_0)\right) \\ & + \left(f(x_1,y_1,z_0)-f(x_1,y_0,z_0)\right)\\ & + \left(f(x_1,y_1,z_1)-f(x_1,y_1,z_0)\right) \end{align} $$
Do note that this is exactly the formula you have provided above. But as there are $k!$ possible paths, along the edges in $k$ dimensions, we may weigh them equally.
Original answer
The general concept here is to attribute the change in a given function $\Delta f \equiv f(\mathbf{x}_1)-f(\mathbf{x}_0) $ between two points onto per-variable changes. This ansatz uses a combination of forward and backward difference approximations to derivatives at various points.
Let me explain this in the threevariate case. Let $x,y,z$ and $\Delta x\equiv x_1-x_0, \Delta y \equiv y_1-y_0, \Delta z \equiv z_1-z_0$ denote the variables of interest and their corresponding differneces. To ease notation, we write $f(111)$ to mean $f(x_1,y_1,z_1)$, $f(000)$ to mean $f(x_0,y_0,z_0)$ and so on.
We begin by restating the identity $\Delta f$ thru adding zeros:
$$ \begin{align} \Delta f &\equiv f(x_1,y_1,z_1)-f(x_0,y_0,z_0)\\ &\equiv f(111)-f(000)\\ &= f(111)-f(000)\\ &\pm f(110)\\ &\pm f(101)\\ &\pm f(011)\\ &\pm f(100)\\ &\pm f(010)\\ &\pm f(001)\\ &=\frac{1}{3}\left(f(111)-f(110)+f(111)-f(101)+f(111)-f(011)\right)\\ &+\frac{1}{6}\left(f(110)-f(010)+f(110)-f(100)\right)\\ &+\frac{1}{6}\left(f(101)-f(100)+f(101)-f(001)\right)\\ &+\frac{1}{6}\left(f(011)-f(010)+f(011)-f(001)\right)\\ &+\frac{1}{3}\left(f(100)-f(000)+f(010)-f(000)+f(001)-f(000)\right)\\ \end{align} $$
Next, multiplying the terms by $\frac{\Delta x}{\Delta x}, \frac{\Delta y}{\Delta y},\frac{\Delta z}{\Delta z}$, we introduce various forward and backwards difference approximations to the partial derivatves, evaluated at all combinations of the start/end parameters:
$$ \begin{align} \Delta f &= \frac{\Delta x}{3}\left(\frac{f(111)-f(011)}{\Delta x}+\frac{1}{2}\left(\frac{f(110)-f(010)}{\Delta x}+\frac{f(101)-f(001)}{\Delta x}\right)+\frac{f(100)-f(000)}{\Delta x}\right)\\ &+\frac{\Delta y}{3}\left(\frac{f(111)-f(101)}{\Delta y}+\frac{1}{2}\left(\frac{f(110)-f(100)}{\Delta y}+\frac{f(011)-f(001)}{\Delta y}\right)+\frac{f(010)-f(000)}{\Delta y}\right)\\ &+\frac{\Delta z}{3}\left(\frac{f(111)-f(110)}{\Delta z}+\frac{1}{2}\left(\frac{f(101)-f(100)}{\Delta z}+\frac{f(011)-f(010)}{\Delta z}\right)+\frac{f(001)-f(000)}{\Delta z}\right) \end{align} $$
Generally, a $k$-variate function will require a total of $2^k$ (here: $k=3$) function calls for this method to work.
Note that your ansatz does not incorporate all possible difference approximations. If I apply the "full" approach outlined above, I get
$$ \begin{align} \Delta_a=&-6.41\%\\ \Delta_b=&1.51\%\\ \Delta_c=&3.31\% \end{align} $$
## Answer by hyg17 (score 0)
https://quant.stackexchange.com/a/77746
As described in your answer, the partial differentials are path dependent as illustrated.
In this case there are k = 3 variables for x showing 3! = 6 possible paths (a,b,c) , (a,c,b), ... , (c,a,b), (c,b,a).
The average of each path coincides with the "full approach".Shown 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.