Skip to content

correlation matrix

7 messages · Eric Zivot, Joshua Ulrich, Arnaud Gaboury

#
I have a xts object with assets daily closing prices. I would like to
print an usual correlation matrix of each asset against others. The
PerformanceAnalytics::table.correlation() function let me with a very
ugly output.
Is there any other function from a package which will print a user
friendly correlation matrix?

Thank You for help
#
See the package corrplot - you get very nice visual plots of correlations and also printouts of all pairwise correlations. You may need to use coredata() to extract data as a matrix to be passed to the function corrplot().

-----Original Message-----
From: R-SIG-Finance <r-sig-finance-bounces at r-project.org> On Behalf Of arnaud gaboury
Sent: Friday, October 20, 2023 10:10 AM
To: r-sig-finance at r-project.org
Subject: [R-SIG-Finance] correlation matrix

I have a xts object with assets daily closing prices. I would like to print an usual correlation matrix of each asset against others. The
PerformanceAnalytics::table.correlation() function let me with a very ugly output.
Is there any other function from a package which will print a user friendly correlation matrix?

Thank You for help

_______________________________________________
R-SIG-Finance at r-project.org mailing list https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-sig-finance__;!!K-Hz7m0Vt54!jioZM9Nd6oeVy_gNe5CuRD11pqzHc3CDCt46IvWGkZ9xEmit-nl7pwBBf3VJGmxZcMFVq4bc5_F6k93OhMjgBC8$
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
#
On Fri, Oct 20, 2023 at 7:16?PM Eric Zivot <ezivot at uw.edu> wrote:
#
On Fri, Oct 20, 2023 at 7:16?PM Eric Zivot <ezivot at uw.edu> wrote:
Thank you so much for your quick answer. It works perfectly as expected
#
On Fri, Oct 20, 2023 at 12:20?PM Eric Zivot <ezivot at uw.edu> wrote:
Very cool package! No need to use coredata(). This works:

data(edhec, package = "PerformanceAnalytics")
corrplot::corrplot(cor(edhec))

  
    
#
On Fri, Oct 20, 2023 at 7:27?PM Joshua Ulrich <josh.m.ulrich at gmail.com> wrote:
Well, that's it not so bad, but I honestly prefer the  solution from
package corrplot
#
On Fri, Oct 20, 2023 at 1:32?PM arnaud gaboury <arnaud.gaboury at gmail.com> wrote:
That *is* a solution using the corrplot() function from the corrplot
package. I only used the edhec data from PerformanceAnalytics, and
only for convenience because I knew you had that package installed.