> I used the function cor to calculate the pearson correlation coefficient > between variables. However, the resulting values do not correspond to the > outcome of my excel-calculations, for which I used the formula > Cor(x,y)=Cov(x,y)/(SD(x)*SD(y)) So my question is: How does the function > "cor" compute the pearson correlation coefficient? It would help if you specified exactly what you enter in R and what R's output is. In any case, in R the correlation coefficient (using the Person method) corresponds exactly to the formula you give, as a quick test shows: > x=rnorm(100) > y=rnorm(100)+x > cov(x,y)/(sd(x)*sd(y)) [1] 0.7561354 > cor(x,y) [1] 0.7561354
If Excel gives you something else, I'd rather doubt Excel than R. Claus -- Claus Wilke Section of Integrative Biology and Center for Computational Biology and Bioinformatics University of Texas at Austin 1 University Station C0930 Austin, TX 78712 [EMAIL PROTECTED] 512 471 6028 ______________________________________________ [email protected] 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.

