meermeyer at statistik.uni-wuppertal.de
2008-Sep-26 10:15 UTC
[Rd] bug in plot.acf, ci.type= "ma" (PR#13071)
Full_Name: Martin Meermeyer Version: 2.51 OS: Win XP SP3 Submission from: (NULL) (132.195.128.210) I think the confidence-bands in the plot.acf(..., ci.type="ma") must start at lag 1 due to the Bartlett-approximation. I think so since I?ve calculated these manually, see the following example: reihe <- arima.sim(n = 100, list(ma = c(0.5, 0.4))) reihe.acf <- acf(reihe, ci.type = c("ma")) reihe.acf <- as.vector(reihe.acf$acf) # Estimated variances of hat(rho)(2:h) using the Bartlett-approximation var.acf <- (1 + 2*cumsum(reihe.acf[-1]^2))/100 # Assuming white noise for hat(rho)(1), therefore estimated variance is 1/100 var.acf <- c(1/100, var.acf) # Calculate ci-bounds ki.acf <- 1.96*sqrt(var.acf) # Skip the last one ki.acf <- head(ki.acf, -1) # Add to the acf, first entry belongs to lag 1. lines(c(1:20),ki.acf,col=2,lty=2) # Numbers identical to actual function lines(c(0:19),-ki.acf,col=2,lty=2)