[R] (no subject)

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Wed Nov 17 21:18:10 CET 2004


On 17-Nov-04 Angela Re wrote:
> Good evening,
> I'm going to use R to calculate the P-value for Pearson coefficient. 
> Does it exist an already defined function?How can I do?Thanks for 
> helping me.
> Angela

cor.test is what you need (according to your statement).
The Pearson correlation is the default coefficient.

Example:

  u<-rnorm(10);v<-rnorm(10);X<-u+v;Y<-v;
  cor.test(X,Y)

          Pearson's product-moment correlation

  data:  X and Y 
  t = 2.9483, df = 8, p-value = 0.01847
  alternative hypothesis: true correlation is not equal to 0 
  95 percent confidence interval:
   0.1686027 0.9291072 
  sample estimates:
        cor 
  0.7216238 

enter

  ?cor.test

for details of the various different ways of using this function.

Hoping this helps,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861  [NB: New number!]
Date: 17-Nov-04                                       Time: 19:28:43
------------------------------ XFMail ------------------------------




More information about the R-help mailing list