Compute a correlation matrix from an existing covariance matrix

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Compute a correlation matrix from an existing covariance matrix

Marc Bernard
Dear All,
   
  I am wondering if there is an R function to convert a covariance matrix to a correlation matrix. I have a covariance matrix sigma and I want to compute the corresponding correlation matrix R from sigma.
   
  Thank you very much,
   
  Bernard

               
---------------------------------

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Compute a correlation matrix from an existing covariance matrix

Liaw, Andy
See ?cov2cor.

Andy

From: Marc Bernard

>
> Dear All,
>    
>   I am wondering if there is an R function to convert a
> covariance matrix to a correlation matrix. I have a
> covariance matrix sigma and I want to compute the
> corresponding correlation matrix R from sigma.
>    
>   Thank you very much,
>    
>   Bernard
>
>
> ---------------------------------
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Compute a correlation matrix from an existing covariance matrix

Peter Dalgaard
In reply to this post by Marc Bernard
Marc Bernard <[hidden email]> writes:

> Dear All,
>    
>   I am wondering if there is an R function to convert a covariance matrix to a correlation matrix. I have a covariance matrix sigma and I want to compute the corresponding correlation matrix R from sigma.

You mean something like cov2cor()?

(BTW, why doesn't the page for cor/var/cov/cov2cor show up on
help.search("covariance") or help.search("correlation") for me??)

--
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([hidden email])                  FAX: (+45) 35327907

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Compute a correlation matrix from an existing covariance matrix

Kjetil Halvorsen
In reply to this post by Marc Bernard
Marc Bernard wrote:
> Dear All,
>    
>   I am wondering if there is an R function to convert a covariance matrix to a correlation matrix. I have a covariance matrix sigma and I want to compute the corresponding correlation matrix R from sigma.
>    

Does cov2cor  do what you want?

Kjetil

>   Thank you very much,
>    
>   Bernard
>
>
> ---------------------------------
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Compute a correlation matrix from an existing covariance matrix

Peter Dalgaard
In reply to this post by Peter Dalgaard
Peter Dalgaard <[hidden email]> writes:

> (BTW, why doesn't the page for cor/var/cov/cov2cor show up on
> help.search("covariance") or help.search("correlation") for me??)

It's there now. Must have been a temporary condition, possibly in the
user...

--
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([hidden email])                  FAX: (+45) 35327907

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html