Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

There may be a better name for this class of problem, and if so feel free to edit!

Imagine a matrix consisting of the following columns: daily return, $\alpha_t$, $factor^1_t$, $factor^2_t$, ... and $factor^n_t$. Each row is indexed by time.

The first identity is: $$Daily Return_t = \alpha_t + factor^1_t + factor^2_t + ... factor^n_t$$

The second identity is that "Annual arithmetic return" =

$$\Pi (1 + \alpha_t + factor^1_t + factor^2_t + ... factor^n_t) - 1$$ where the product is defined from '1 to t' (i.e. across all rows of the matrix).

If one expands the above equation, one can express the Annual Arithmetic return as the sum of 3 components: groupings of $\alpha$ terms, groupings of factor terms, and groupings of interaction terms (resulting from any product of an alpha term and a product term).

What is a computationally clever expression for the grouping of alpha terms, factor terms, and interaction terms respectively?

The solution to the single-factor two-period case suggests there is a clever matrix algebra trick.

2-period solution with one factor

annual arithmetic return =

$$(1 + \alpha_1 + factor_1) * (1 + \alpha_2 + factor_2) - 1$$

Expanding terms we can find we can express annual arithmetric return as the sum of grouping of three components:

Annual arithmetic return (as a sum of the three components) =

( $\alpha_1$ + $\alpha_1$$\alpha_2$ + $\alpha_2$ ) + ( $factor_2$ + $factor_1$ + $factor_1$*$factor_2$ ) + ( $factor_1$$\alpha_2$ + $\alpha_1$$factor_2$ )

For the same solution in matrix algebra terms, we take the outer-product of:

vector1 = (1 + $R_1$) = (1 + $\alpha_1$ + $factor_1$)

vector2 = (1 + $R_2$) = (1 + $\alpha_2$ + $factor_2$)

which produces the matrix:

$$ \begin{matrix} 1 & a{2} & NFC{2}\\ a{1} & a{1}*a{2} & a{1}*NFC{2}\\ NFC{1} & NFC{1}*a{2} & NFC{1}*NFC{2}\\ \end{matrix} $$

The annual arithmetic return is then the sum of the elements of the 3x3 matrix resulting from the outer cross-product of [ (vector1 * vector2) - 1 ]. The upper left portion of the matrix (see above) consists of the alpha contributions, and the top-right, bottom-left, and bottom-right contain the factor return contributions which can now be grouped with another matrix operation.

Is there a computationally clever way to scale this calculation for many periods and factors and group the terms? The challenging part is that collection and grouping of terms -- not the actual calculation of annual arithmetic return which is straightforward.

Perhaps a vectorirzed solution in R with the recursive use of the outer() function?

share|improve this question
You should probably read a bit the answers in math.stackexchange.com/questions/24241/… :) –  Mariano Suárez-Alvarez Nov 30 '11 at 4:13
Thanks for the link - interesting comments on variable naming –  Quant Guy Nov 30 '11 at 4:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.