1
$\begingroup$

I am looking to use the CopulaDistribution fucntion, with a "MultiNormal" kernal. However, for the input, O require a covariance matrix. However, I only have a correlation matrix. Is there a way to convert one to the other?

$\endgroup$
0

1 Answer 1

4
$\begingroup$

You also need StandardDeviation to get the covariance matrix from the correlation matrix:

corToCov[mat_, sd_] := Transpose[sd Transpose[sd mat]]

Example:

data = RandomReal[5, {10, 5}];
cormat = Correlation[data];
covmat = Covariance[data];
sd = StandardDeviation[data];
covmat ==  corToCov[cormat, sd]
(* True *)

To get the correlation matrix from a covariance matrix (Correlation >> Properties and Relations):

covToCor[cov_, sd_] := Transpose[Transpose[cov/sd]/sd];
cormat == covToCor[covmat, sd]
(* True *)
$\endgroup$
2
  • $\begingroup$ What if I do not have the data. All I have is correlation matrix. $\endgroup$
    – Jim
    Dec 5, 2014 at 1:16
  • 3
    $\begingroup$ @Jim, i don't know how one can recover the covariance matrix from a correlation matrix without knowing the standard deviation. $\endgroup$
    – kglr
    Dec 5, 2014 at 1:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.