Re: [R] Correlation Help

From: milton ruser <milton.ruser_at_gmail.com>
Date: Mon, 23 Jun 2008 17:07:39 -0300

Hi Michael,

May be you have NA on your dataset.

x<-runif(20)
y<-runif(20)

cor(x,y)

x[10]<-NA
x

cor(x,y) # SEE the error because NA
cor(x,y, use = "pairwise.complete.obs")

Good luck,

miltinho
brazil

On 6/23/08, Tong, Michael <MTONG_at_templeton.com> wrote:
>
> Hi,
>
> I have recently been using the R program and encountered a recurring
> problem. I have been trying calculate the correlation of a 16 column table.
> Everytime I type in cor(test), where test is data that I uploaded into R
> using the read.table function, I get an error:
>
> Error in cor(test) : missing observations in cov/cor
> In addition: Warning message:
> In cor(test) : NAs introduced by coercion
>
> Can anyone tell me what I am doing wrong and what I need to do to correct
> this?
>
> Also I intend on running the T-Stats, P-Stats, Information Coefficient and
> Information Ratios once I get the correlation table calculated. If you know
> which packages, if any, have are able to calculate this, that would be
> helpful.
>
> Thanks.
>
> Best,
>
> Michael Tong
> Futures Associate
> Quantitative Research Services
> Franklin Templeton Investments, Inc.
> 600 Fifth Ave
> New York, NY 10020
> (212) 632-4254
> mtong_at_templeton.com
>
> Notice: All email and instant messages (including attachments) sent to
> or from Franklin Templeton Investments (FTI) personnel may be retained,
> monitored and/or reviewed by FTI and its agents, or authorized
> law enforcement personnel, without further notice or consent.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 23 Jun 2008 - 20:10:20 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 23 Jun 2008 - 21:31:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive