7

To supplement the other answer, yes there are optimization reasons for the covariance matrix being symmetric positive definite (SPD). All positive definite matrices are invertible and its inverse is also positive definite. This guarantees a unique global minimum in a quadratic optimization problem (MVO). Lots of material available on the topic: https://www....


6

Positive definite matrix $A$ is defined as $x^TAx > 0$ for all vectors $x$. Since a term $w^T\Sigma w$ in Markowitz (and other models as well) expresses variance in returns, it is a measure of dispersion. Any measure of dispersion has to be positive (or maybe zero but it is a case where there is no uncertainty and hence no risk). Negative dispersion is ...


6

Suppose the covariance matrix is $V$ (which is n by n) and the weights are $w$ (of length n). Then the Portfolio Variance is $V_p = w^T V w$ and the Risk Contribution (in terms of variance) of asset $k$ is $RC_k=w_k \sum_j V[k,j]w_j$ in words this is "the weight of asset k times the inner product of the k-th row of $V$ and the weight vector". (Sometimes ...


6

What does 'simulate a covariance matrix' mean? If the question means, generate an arbitrary correlation matrix for 1000 stocks, then we can choose any symmetric matrix with all 1s down the diagonal, so long as every element is between -1 and 1 and the matrix is positive semi-definite. The large size of the matrix means that putting random values in every ...


5

This is the result of the Sherman-Morrison inversion for the sum of an invertible matrix and an outer product. You will find this (and many other helpful methods) in the Matrix Cookbook. Specifically, this is equation 160 on p 18: $$ \left(\boldsymbol{A}+\boldsymbol{bc}^T\right)^{-1}=\boldsymbol{A}^{-1}-\frac{\boldsymbol{A}^{-1}\boldsymbol{bc}^T\boldsymbol{A}...


5

here is how to get covariance matrix from correlations:


5

I'm not a Python programmer, however, reading the reference manual of np.var, you're using the "biased" version of the variance estimator. Instead use the unbiased variance estimator: import numpy as np from numpy.random import randn X = randn(1000,3) Sigma = np.cov(X.T) w = np.array([0.2,0.3,0.5]) print(np.var(X@w, ddof=1)) ...


5

If you assume that a financial asset price has a change that is a wiener process then you can view the future value of that asset as the initial value plus the sum of the independent daily changes (for equity or returns based then you would need log version of this): $$ S_t = S_0 + \sum \Delta S_i $$ where $\Delta S_i = S_i - S_{i-1} $ is a wiener process. ...


4

Just to expand on Alex answer. Empirically it is simply not true. Focusing on the diagonal of the variance-covariance matrix, we know that there is a large variance risk premium. Take a look at table 3 from Carr and Wu (2009). Regarding covariances we do not have much evidence, because there are no options on every single pair of stocks. However, we do know ...


3

OK, so think of it this way... Your standard (Markowitz) covariance matrix is a sample observation. That may or not be close to the population sigmas and correlations of your sampled markets. Even if close, the sample-vs-population errors will create asset allocation errors. The identity matrix here is the "complete strategic ignorance" covariance ...


3

You can think of it in Bayesian terms. To start with, knowing nothing at all about stocks, you might assume that stock returns are i.i.d with unit variance. This would be your prior. It is very simple and is well behaved because the identity is invertible. Then you would gather some empirical data on stock returns and measure the actual variances and ...


3

I will just clarify Point 2 in StackG excellent answer. (It's really a comment, but it's too long and has too much math symbols to fit in the comment field.) Suppose you're given a covariance matrix $C$ for the returns of $n$ assets. (1000 $\times$ 1000 is 1 million entries - should not be too large for modern computers to work with, but do be mindful of ...


3

There is nothing wrong mathematically (nor ethically) with this objective function. However, this objective is weird in a couple of ways. First, there is no weighting on these which implies you prefer to minimize these terms in accordance with their orders of magnitude. As has been pointed out, the correlation term is likely much larger so your optimization ...


3

I think what you are effectively looking at is $$\ \begin{align} \log(S_{AUDCAD})&=\log(S_{AUDUSD})\pm\log(S_{USDCAD})\\ \Rightarrow z&=x\pm y \end{align} $$ Thus, $$ \sigma_z^2=\mathrm{E}\left(\left(x\pm y\right)^2\right)- [\mathrm{E}(x\pm y)]^2 =\sigma_x^2+\sigma_y^2\pm 2\sigma_{xy} $$ Hence, $$ \tag{1} \sigma_{xy}=\frac{\sigma_z^2-\sigma_x^2-\...


2

For the same reason you can't meaningfully measure covariance/correlation using price of individual assets...correlation (covariance by extension) represents the comovement in deviations from individual means. You can't represent that if the mean continues to change (ie, series considered aren't stationary). Same goes for multiple assets as is represented ...


2

The relationship between covariance, standard deviation and correlation is: $$ corr(x,y) = \frac{cov(x,y)}{\sigma_x \sigma_y}$$ So to construct your matrix you will have the variances in the diagonal: $$ cov(x,x) = corr(x,x) \times \sigma_x \times \sigma_x = 1 \times \sigma_x^2 = \sigma_x^2 $$ And for the covariances: $$ cov(x,y) = corr(x,y) \times \...


2

The interpretation and units problem, ie the lack of an easily intuitive answer, is precisely why quants/econometricians etc. tend to shy away from talking too much about covariances [even if they are absolutely necessary; and frequently used]. Thus if anything involving covariances has to interpreted, let alone explained, the default is usually to express ...


2

Here, I try to help a bit with the matrix norm question. Assume an $M$-dimensional multivariate normally distributed return vector $\widetilde{R}$. The covariance of these returns is $\Sigma$, and the expected returns are $\check{R}$. The probability density function of $R$ is $$ f(R;\check{R},\Sigma)=\left(2\pi\right)^{-\frac{M}{2}}\left|\Sigma\right|^{-\...


2

When $x_i$ is the return of the $i$th asset, the returns of portfolio $\vec{w}$ are $\sum_i w_i x_i$. The covariance of the returns of two portfolios, $\vec{w}$ and $\vec{v}$ are then $$ \sum_i \sum_j w_i v_j \operatorname{cov}\left(x_i, x_j\right). $$ Now note that $\Sigma_{i,j} = \operatorname{cov}\left(x_i,x_j\right)$. The rest is confirming that this ...


2

I don't have a survey, but I think most people who look at the total returns (price and dividends) of stocks, look at 3-5 years of history. Depending on what you intend to do with your covariance matrix, 1 or 2 years of daily history may be too little. It's quite normal that if you look at 3-5 years of history, some series will have some short gaps. There ...


2

As a first step it is helpful to draw a 'time circle' from 0000 to 2359 GMT/UTC and plot on this circle the opening and closing times of the major markets/exchanges. This gives an overview of the situation and makes it easy to answer questions like "at xxxx GMT what markets are open and what markets are closed". (Actually you may need to have ...


1

While the close vote might be reasonable, there is mathematical arguments that show there is a limit to how negatively correlated a set of assets can be. It is even a classic quant interview question: Let the correlation matrix be $$\Omega = \rho \mathbf{1} + (1-\rho)I_d,$$ where $\mathbf 1$ is the $d \times d$ matrix with 1's everywhere. What is the range ...


1

After having tried this with randomly generated vectors, I am consistently seeing the correlation matrix of randomly generated numbers, regardless of which distribution they are sampled from, are always more well-conditioned than the covariance matrix. Which is strange because the covariance matrix exists before the correlation matrix: the correlation ...


1

Yes, you can compare matrix condition numbers if evaluating them for the same problem, for example taking the matrix's inverse. For L2: For the additional mathematical characterization of conditioning and its impact, check out the first half of these lecture notes from a class I took: https://github.com/mandli/intro-numerical-methods/blob/master/...


1

Usually, when one talks about exponential smoothing, they talk about it's halflife. So, for example, suppose we exponentially smooth some quantity ( argument carries over to covariance matrix but I'd rather just rather consider the scalar quantity case ) and call the exponentially smoothed estimate $\hat{smth_t}.$ So, this means that we have: $\hat{...


1

I don’t see how just calculation of Portfolio variance would need an invertible var-covar matrix, I mean you don’t even have to use the matrix notation to calculate it. It may be so that lower time frames would output unstable values of the individual variances and pairwise correlations. However there are certain methods to achieve a stable covariance ...


Only top voted, non community-wiki answers of a minimum length are eligible