15

I want to obtain the the limits that determine the significance of autocorrelation coefficients and partial autocorrelation coefficients, but I don't know how to do it.

I obtained the Partial autocorrelogram using this function pacf(data). I want that R print me the values indicated in the figure.

enter image description here

Erincon
  • 389
  • 1
  • 7
  • 21
  • 1
    This might be a better fit for http://stats.stackexchange.com – Stedy May 02 '15 at 00:23
  • 4
    You can find how they are calculating using `edit(stats:::plot.acf)`. –  May 02 '15 at 00:43
  • 1
    But, how can I print them in console? – Erincon May 02 '15 at 01:03
  • Provide a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). Provide sample data, show what functions you are running, and show what values you want to extract (desired output). – MrFlick May 02 '15 at 01:15
  • 3
    From the function `edit(stats:::plot.acf)`, `clim0 <- qnorm((1 + ci)/2)/sqrt(x$n.used)`, where `ci` is the level of significance [0,1] and `x$n.used` is the length of the serie. –  May 02 '15 at 01:47
  • There is no feature in `acf()` or `pacf()` that returns the confidence bounds used in the plot. The way to get them is to compute them yourself as @Pascal has shown. – Alex A. May 02 '15 at 04:35
  • @Erincon Did you find the answer to this question?? I am also stuck at the same point! – Vivek Apr 27 '21 at 04:06

3 Answers3

5

The limits that determine the significance of autocorrelation coefficients are: +/- of (exp(2*1.96/√(N-3)-1)/(exp(2*1.96/√(N-3)+1).

Here N is the length of the time series, and I used the 95% confidence level.

Xiaojie Zhou
  • 164
  • 2
  • 6
2

The correlation values that correspond to the m % confidence intervals chosen for the test are given by 0 ± i/√N where:

N is the length of the time series

i is the number of standard deviations we expect m % of the correlations to lie within under the null hypothesis that there is zero autocorrelation.

Since the observed correlations are assumed to be normally distributed:

Figure A1, Page 1011 here provides a nice example of how the above principle applies in practice.

Curious Watcher
  • 580
  • 6
  • 12
shekeine
  • 1,445
  • 10
  • 22
  • 1
    This doesn't really answer the question. The OP is likely familiar with what these bounds are but doesn't know how to get them from R, which is what the question is asking. – Alex A. May 04 '15 at 16:11
  • Getting the bounds in R is trivial once you know what they are so I think a brief explanation of the conceptual basis of these bounds was quite called for here. In any case, If the OP still needs help with how exactly to do this in R, she/he could say so and I or anyone else can extend my and @Pascal 's answer above with an example. – shekeine May 04 '15 at 16:41
  • The OP _did_ say so. That's what the question is asking--how to do it in R. – Alex A. May 04 '15 at 16:45
  • @AlexA. Do you have answer-editing privileges? If yes, go right ahead and add what you think is missing in my answer or give a new answer. Don't mind at all. – shekeine May 04 '15 at 16:57
1

After investigating acf and pacf functions and library psychometric with its CIz and CIr functions I found this simple code to do the task:

  1. Compute confidence interval for z Fisher:

    ciz = c(-1,1)*(-qnorm((1-alpha)/2)/sqrt(N-3))
    

here alpha is the confidence level (typically 0.95). N - number of observations.

  1. Compute confidence interval for R:

    cir = (exp(2*ciz)-1)/(exp(2*ciz)+1  
    
croxy
  • 4,082
  • 9
  • 28
  • 46
guest
  • 21
  • 2