4

I assume, the first equation is about creating 2 correlated standard normal random variables. Then $X_1 = Z_1$ and $X_2 = \rho Z_1 + \sqrt{1- \rho^2}Z_2 $ are correlated with correlation $\rho$. One can prove this by calculateing the covariance. $$\text{Cov}(X_1, X_2) = \mathbb{E}(X_1X_2) - \mathbb{E}(X_1) \mathbb{E}(X_2) = \rho \mathbb{E}(Z_1^2) + 0 = \rho$$...


4

Your biggest problem is with computing the pairwise correlations of returns. Suppose for simplicity that you have 2 assets A and B. For asset A, you have closing prices for all 3 days $t_0$, $t_1$, and $t_2$. If you also have dividends, you calculate A's total return from $t_0$ to $t_1$: $$R_{A,t_0,t_1}=\frac{P_{A,t_1}+D_{A,t_1}-P_{A,t_0}}{P_{A,t_0}}$$. and ...


3

The problem with sample correlation estimator defined as: $$r_{sample} =\frac{\sum\left(X_i - \bar{X}\right)\left(Y_i - \bar{Y}\right)}{\sqrt{\sum\left(X_i-\bar{X}\right)^2\left(Y_i-\bar{Y}\right)^2}}.$$ is that it is biased. The bias is in fact downward i.e. $r_{sample}$ tends to be lower than population $\rho$. Therefore when we average biased estimator we ...


1

Given the question text, my reply would be: Compute the correlation between all (or just a random subset, if 600^2 computations is too much) pairs of stocks. Sort the pairs, and choose stocks from the top until you have n distinct ones. It would help to state what you are trying to achieve. Is it to pick stocks representative of the market? If so, you ...


1

It was my code :/ VBA is brutal for this work, but my company only lets me use VBA at the moment.


1

Let your linear system be defined by the latent multivariate state variable $x_t$, progressing in an AR(1) fashion, and let your observation at time step $t$ be linear in the latent state: $$ \begin{align} x_{t+1}&=Ax_t+u_t\\ y_{t}&=Hx_t+v_t\\ \end{align} $$ with $u_t\sim N(0,Q)$ and $v_t\sim N(0,R)$ time-and-state-independent process noise. Let $K_t$...


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