0

I am trying to figure out how to increase precision of an output of a function. I need to have output of acf function with at least 5 digits accuracy, while it gives me 3.

v = c(1.1,3.2,2.1,4.5) 
acfv = acf(v) 
acfv

The only precision-adjusting function I know is options(digits=...), which works only for explicit calculations in global environment. Can anybody help me?

Moysey Abramowitz
  • 352
  • 1
  • 7
  • 19
  • Reproducible example please –  Jan 16 '16 at 05:45
  • v = c(1.1,3.2,2.1,4.5) acfv = acf(v) acfv – Moysey Abramowitz Jan 16 '16 at 06:22
  • So acf returns output with 2-digits precision and I need higher precision (e.g. 5). – Moysey Abramowitz Jan 16 '16 at 06:23
  • You are mixing number of shown digits from printing results with precision of values (computer arithmetic). That are two different things. http://www.validlab.com/goldberg/paper.pdf and http://stackoverflow.com/questions/6033184/how-computer-does-floating-point-arithmetic – jogo Jan 16 '16 at 09:51

1 Answers1

1

You are just looking at the print-method output. The acf values are stored in full numeric precision:

> acfv$acf
, , 1

           [,1]
[1,]  1.0000000
[2,] -0.3399337
[3,]  0.2900897
[4,] -0.4501561
IRTFM
  • 258,963
  • 21
  • 364
  • 487