[R] About Pearson correlation functions

Mahmood Naderan-Tahan m@hmood@n@der@n @end|ng |rom ugent@be
Sun May 30 21:12:29 CEST 2021


Thanks. It seems that the differences I saw in some of my data points were related to the number of digits and rounding.


Regards,
Mahmood

________________________________
From: Bill Dunlap <williamwdunlap using gmail.com>
Sent: Sunday, May 30, 2021 7:00:52 PM
To: Mahmood Naderan-Tahan
Cc: r-help using r-project.org
Subject: Re: [R] About Pearson correlation functions

You didn't say how the values differed.  If one in the plot is a rounded version of the other then adding the ggpur::ggscatter() argument
   cor.coeff.args=list(digits=7)
will fix things up.

-Bill

On Sun, May 30, 2021 at 9:18 AM Mahmood Naderan-Tahan <mahmood.naderan using ugent.be<mailto:mahmood.naderan using ugent.be>> wrote:
Hi

Maybe this is not directly related to R, but I appreciate you can help me with an idea. I use the following ggscatter function to plot a Pearson correlation Coefficient and it works fine. In the chart I see both R-value and P-value.


    ggscatter(mydata, x = "V1", y = "V2", add = "reg.line", conf.int<http://conf.int> = TRUE, cor.coef = TRUE, cor.method = "pearson")


On the other hand, when I use this command


    res <- cor.test(mydata$V1, mydata$V2, method = "pearson")


The R and P values are different from ggscatter.


I would like to know:


1- Why they are different?

2- How to print P and R values of ggscatter on terminal?



Regards,
Mahmood

        [[alternative HTML version deleted]]

______________________________________________
R-help using r-project.org<mailto:R-help using r-project.org> mailing list -- To UNSUBSCRIBE and more, see
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]]



More information about the R-help mailing list