acfpacf uses procedures acfpacf.acf and
acfpacf.pacf, which computes values of ACF and PACF function, respectively.acfpacf(x, nac, npac, datastr,...)
acfpacf.acf(x, normflg)
acfpacf.pacf(x, m)x).x).acf(k) for k = 0, ..., nr, where nr
is length of x. Parameter normflg can be equal to:
0 - acf(k) valpacf(1)) is equal to acf(2), which is the lag 1 acf
value, and then for computing values for k = 2, ..., m the Toeplitz structure
of the projection equaplfg, acalpha, pacacalpha, valcol, thrcol, thrmhcol, where
plfg is plotting flag, this parameter should be positive number to plot computed acfpacf returns plot of ACF and PACF values with two types of
thresholds for input acalpha and pacalpha, respectively. The first one
denoted by thr is given for ACF values by $Pr[acf(j)>thr] = \alpha/2$ and $Pr[acf(j)<-thr] = \alpha/2$
where acf(k) is the ACF value at lag k. This threshold corresponds to type I
error for null hypothesis that acf(k) = 0. The plot allows to check if any of
the ACF values are significantly non-zero. Actual
threshold calculations are based on the following asymptotic result:
if $X_t$ is $IID (0,\sigma^2)$, then for large $n$, $\hat{\rho}(k)$ for
$k << n$ are $IID N(0,1/n)$ (see Brockwell, P. J., Davis, R. A., 1991, Time Series: Theory and Methods, example 7.2.1, p. 222).
Thus, under the null hypothesis, the plots for thr = qnorm(1-acalpha/2,0,1/sqrt(nr))
should exhibit a proportion of roughly acalpha points that lie outside
the interval [-thr, thr]. Threshold for PACF is based on the same results.
On the other hand we can also interpret the plots as a multiple hypothesis testing problem to compute second
threshold thrm. Suppose, we decided to plot some number of nonzero lags (equal to nac)
of the ACF function. If the estimated acf values estimates
are IID then we have nac independent tests of acf(k) = 0. The probability that at least one of values
lies outside the interval [-thr, thr] is equal to 1-Pr[all lie inside], which is [1-(1-acalpha)]^nac.
Finally, the last expression is approximately
equal to nac*acalpha. To get a threshold thrmh such that 1-Pr[all lie inside] = acalpha we
take the threshold as
thrmh = qnorm (1-(acalpha/2)/nac, 0, 1/sqrt(nr)) (for more details check the Bonferroni correction).
For the PACF, the threshold thrm calculation is based on Theorem 8.1.2
of Time Series: Theory and Methods, p. 241, which states that the PACF values for an AR sequence are
asymptotically normal.peracf, perpacfdata(volumes)
# for original data
dev.set(which=1)
acfpacf(volumes,24,24,'volumes')
# for data after removing periodic mean
pmean_out<-permest(t(volumes),24, 0.05, NaN,'volumes',pp=0)
xd=pmean_out$xd
dev.set(which=1)
acfpacf(xd,24,24,'volumes')Run the code above in your browser using DataLab