0
$\begingroup$

$X_t$ is a vector and follows the following Vasicek process. $$ dX_t=(mu-K\cdot X_t)dt+Sigma_x\cdot dZ_t \\ $$ What is the variance of $X_t$?

In scalar form the answer is $\frac{Sigma_x^2}{2\cdot K}\cdot (1-e^{-2Kt})$. But what about in matrix form?

I am reading a Vasicek interest model paper and asked the author for the code to see how he calculated this and below is his Matlab code:

[V,D] = eig(K);
sigma_x = chol(Q)';
sigma_y = V \ sigma_x * sigma_x'/(V') ;
sigma = zeros(3,3) ;
for i = 1:3
    for j = 1:3
        sigma(i,j) = sigma_y(i,j)/(D(i,i) + D(j,j)) *(exp((D(i,i) + D(j,j))/12) -1) ;
    end
end
Q = V * sigma * V' ;

I guess I see the general concept but still don't understand why this had to be done element-wise. And why isn't there a identity matrix involved, only scalar 1.

Below is my Python version of the above code for those who prefer Python.

D, V = np.linalg.eig(K)
D = np.diag(D)
sigma_x = np.linalg.cholesky(Q) # lower triangular matrix
sigma_y = np.linalg.inv(V) @ sigma_x @ sigma_x.T @ np.linalg.inv(V.T)
sigma = np.zeros((3,3))

for i in range(3):
    for j in range(3):
        sigma[i,j] = sigma_y[i,j] / (D[i,i] + D[j,j]) * (np.exp((D[i,i] + D[j,j])/12) - 1)

Q = V @ sigma @ V.T

12 is there to adjust for time length. Thank you.

$\endgroup$
6
  • $\begingroup$ How do you define the variance of an arbitrary random vector $X$ ? MSE is probably a better forum to post this question. $\endgroup$
    – Kurt G.
    Commented Apr 24, 2022 at 19:31
  • $\begingroup$ @KurtG. vector X is just 3 by 1 vector that follows above AR(1) process. And the variance is calculated using closed form solution to vasicek process. I will try MSE. Thank you. $\endgroup$
    – JH Y
    Commented Apr 24, 2022 at 19:45
  • $\begingroup$ What is in your opinion the definition of the variance of $(X_1,X_2,X_3)$ if there is any ? Hint: have you heard about covariance ? $\endgroup$
    – Kurt G.
    Commented Apr 24, 2022 at 19:47
  • $\begingroup$ @KurtG. Yes, I am aware of covariance. $\endgroup$
    – JH Y
    Commented Apr 24, 2022 at 19:52
  • $\begingroup$ Recommendation : ask that question in MSE and ask about covariance. That python code adds zero clarity. Better to define the ingredients of the SDE rigorously. $\endgroup$
    – Kurt G.
    Commented Apr 24, 2022 at 19:54

0

You must log in to answer this question.