Skip to content

Does R have a formal test for long vs short memory process? ---acf confidence intervals

6 messages · elton wang, Spencer Graves, Brian G. Peterson +1 more

#
Brian,
For acf chart, how to see the value of confidence
intervals? any reference on the calculation of this?
are they just 1/sqrt(size)? 

Below is my R screen, no information on confidence
intervals.
Length Class  Mode     
acf    31     -none- numeric  
type    1     -none- character
n.used  1     -none- numeric  
lag    31     -none- numeric  
series  1     -none- character
snames  0     -none- NULL

        
--- "Brian G. Peterson" <brian at braverock.com> wrote:

            
____________________________________________________________________________________
Be a better friend, newshound, and
#
The confidence intervals seem to be computed in plot.acf, not in 
acf.  Do "getAnywhere(plot.acf)", then search for 'clim'.  That just 
identified the following for me: 

    clim0 <- if (with.ci)
        qnorm((1 + ci)/2)/sqrt(x$n.used)
    else c(0, 0)

...

                clim <- clim0 * sqrt(cumsum(c(1, 2 * x$acf[-1,
                  i, i]^2)))

...

            clim <- if (with.ci.ma && i == j)
                clim0 * sqrt(cumsum(c(1, 2 * x$acf[-1, i, j]^2)))
            else clim0


      I'm not certain what all this means, but it looks like it should 
contain the answer to your question. 

      Hope this helps. 
      Spencer
elton wang wrote:
#
I had time to investigate this this morning, and came to the same 
conclusion as Spencer.  Sorry for the earlier confusion.

You can see all the code for acf,pacf, and plot.acf here:

https://svn.r-project.org/R/trunk/src/library/stats/R/acf.R

It would be nice if the summary() or print() method for class acf 
included the confidence interval, as I originally thought it did.

Regards,

   - Brian
Spencer Graves wrote:
#
Thanks for Brian and Spencer's help!
I tried to understand the two formulas below by google
and books I have but have no success so far. Can
anyone give me a hint how to reach these results? 

Sorry for asking if this is too basic...
--- "Brian G. Peterson" <brian at braverock.com> wrote:

            
https://svn.r-project.org/R/trunk/src/library/stats/R/acf.R
____________________________________________________________________________________
____________________________________________________________________________________
Looking for last minute shopping deals?
#
On Friday 08 February 2008 8:05:20 am elton wang wrote:
?plot.acf
Confidence limits assume a white noise input by default.

? ? "The confidence interval plotted in 'plot.acf' is based on an
? ? ?_uncorrelated_ series and should be treated with appropriate
? ? ?caution. ?Using 'ci.type = "ma"' may be less potentially
? ? ?misleading."

HTH,

pcc
#
Peter Carl wrote:
The ci.type of "white" uses a simple volatility model un the acf series 
to calculate the confidence intervals.  The "ma" or correlation model 
uses the volatility of the correlation of the lags of series to 
calculate the confidence intervals.

     with.ci <- ci > 0 && x$type != "covariance"
     with.ci.ma <- with.ci && ci.type == "ma" && x$type == "correlation"
     if(with.ci.ma && x$lag[1,1,1] != 0) {
         warning("can use ci.type=\"ma\" only if first lag is 0")
         with.ci.ma <- FALSE
     }
     clim0 <- if (with.ci) qnorm((1 + ci)/2)/sqrt(x$n.used) else c(0, 0)

Regards,

   - Brian