Skip to content

(no subject)

4 messages · Angela Re, Marc Schwartz, (Ted Harding)

#
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
#
On Wed, 2004-11-17 at 19:20 +0100, Angela Re wrote:
help.search("Pearson") shows you:

...
cor.test(stats)      Test for Association/Correlation Between
                     Paired Samples
...


See ?cor.test

HTH,

Marc Schwartz
#
On Wed, 2004-11-17 at 13:12 -0600, Marc Schwartz wrote:
Ack.  Too quick on the send key.


Please also use a sensible Subject for your posts. It helps others when
searching the list archives, among other things.

Marc
#
On 17-Nov-04 Angela Re wrote:
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 ------------------------------