[R] Generating Correlation matrix

Maithili Shiva maithili_shiva at yahoo.com
Wed Feb 11 13:42:11 CET 2009


Dear Ms Sarah,

Thanks for your reply. Actually I am new to this R language and besides coping with the demending office commitments, whenever possible, I am trying to learn the R language on my own. 

Had it been Excel, I could have done in fraction of seconds however I need to use R language for this. Its the simple correlation I am looking for. 

I have a dataset of (say 500) observations EACH for these three variables viz. Equity, Forex and Bond. I have three different files (equity.csv, Forex.csv and Bond.csv) and need to generate the regular correlation among these variabls. I had attached these files in my earlier mail least knowing we can't do so. I did try to search help, but wasn't that confident about it so I am requesting for the guidance.

With regards

Maithili




--- On Wed, 2/11/09, Sarah Goslee <sarah.goslee at gmail.com> wrote:

> From: Sarah Goslee <sarah.goslee at gmail.com>
> Subject: Re: [R] Generating Correlation matrix
> To: "Maithili Shiva" <maithili_shiva at yahoo.com>
> Cc: r-help at r-project.org
> Date: Wednesday, February 11, 2009, 11:37 AM
> Assuming you want "ordinary" correlations -
> Pearson or Spearman - and not
> some financial thing I've never heard of, searching the
> help for correlation
> would have gotten you to cor(), and probably also to other
> more elaborate
> constructions.
> 
> If your problem is more complex than that, we need a better
> description
> of the difficulty, along with example code for as far as
> you can get yourself.
> 
> Sarah
> 
> On Wed, Feb 11, 2009 at 5:44 AM, Maithili Shiva
> <maithili_shiva at yahoo.com> wrote:
> > Dear R helpers,
> >
> > I have generated a portfolio of Equity, Dollar Rate
> and say zero coupon bond. I have calculated the daily
> returns based on the prices available for last two years.
> >
> > Now, I have three seperate csv files (Equity.csv,
> Dollar.csv and Bond.csv) containing the respective returns.
> I need to calculate the correlation matrix between the
> retuns of these assets. Please guide me how this can be done
> in R.
> >
> > I have attached the three csv files.
> >
> > Thanking in advance
> >
> > With regards
> >
> > Maithili
> >
> >
> >
> >
> 
> 
> 
> -- 
> Sarah Goslee
> http://www.functionaldiversity.org




More information about the R-help mailing list