[R] Rmpfr correlation

tri@g m@iii@g oii gvd@et@dk tri@g m@iii@g oii gvd@et@dk
Sun Jul 12 11:42:33 CEST 2020


Dear friends - I'm calculating buffer capacities by different methods and
need very high precision and package Rmpfr is working beautifully. However,
I have not been able to find out how to keep precision when finding
correlations.

library(Rmpfr)

KA <- mpfr(10^-4.6, 128)

x <- rnorm(100)*KA

y <- rnorm(100)*x

cor(x,y) # "x" must be numeric

cor(as.numeric(x),as.numeric(y))# 0.2918954

 

In my concrete application I get cor = 1 for
cor(as.numeric(dff$BB),as.numeric(BBVS)) even though I have 

 

str(summary((dff$BB)-(BBVS)))
Class 'summaryMpfr' [package "Rmpfr"] of length 6 and precision 128
 4.61351010833e-8 7.33418976521e-7 1.31009046563e-5 3.76407022709e-5
5.72386764888e-5 ...

 

I am on windows 10

R version 3.6.1
 
Best wishes
Troels Ring,
Aalborg, Denmark

 

 


This email has been scanned by BullGuard antivirus protection.
For more info visit www.bullguard.com
<http://www.bullguard.com/tracking.aspx?affiliate=bullguard&buyaffiliate=smt
p&url=/> 

	[[alternative HTML version deleted]]



More information about the R-help mailing list