acfpacf {perARMA} | R Documentation |
Plotting usual ACF and PACF
Description
Plots values of usual ACF and PACF functions with confidence
intervals. Function acfpacf
uses procedures acfpacf.acf
and
acfpacf.pacf
, which computes values of ACF and PACF function, respectively.
Usage
acfpacf(x, nac, npac, datastr,...)
acfpacf.acf(x, normflg)
acfpacf.pacf(x, m)
Arguments
x |
input time series, missing values are not permitted. |
nac |
number of ACF values to return (typically much less than length of |
npac |
number of PACF values to return (typically much less than length of |
datastr |
string name of data to be printed on the plot. |
normflg |
computing parameter for ACF values. These values are returned as a series |
m |
maximum lag to compute PACF values. Value for the first lag ( |
... |
other arguments: |
Details
Function 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.
Value
No return value, called for side effects
Note
Procedure acfpacf
is an implementation of the usual (meaning not periodic) ACF and PACF functions.
It happens that for PC time series the usual ACF and PACF are still useful in the identification of model orders and in some cases can be more sensitive than
the perodic versions. The ACF and PACF values inform about the correlations of the random part. It is possible to run acfpacf
on original data which include the peridic mean as a deterministic component. But typically the periodic mean can distort our understanding
(or view) of the random fluctuations, thus running acfpacf
additionally on the data after removing periodic mean is suggested.
It is possible to use also acfpacf.acf
, acfpacf.pacf
procedures to obtain values of
ACF and PACF functions, respectively. When subjected to a truly PC sequence, the usual
ACF and PACF produce an average of the instantaneous (time indexed)
values produced by periodic ACF and periodic PACF. Depending therefore on correlations
between these averaged quantities, the usual ACF and PACF may be more or
less sensitive that the instantaneous ones.
Author(s)
Harry Hurd
References
Box, G. E. P., Jenkins, G. M., Reinsel, G. (1994), Time Series Analysis, 3rd Ed., Prentice-Hall,
Englewood Cliffs, NJ.
Brockwell, P. J., Davis, R. A. (1991), Time Series: Theory and Methods, 2nd Ed., Springer: New York.
Bretz, F., Hothorn, T., Westfall, P. (2010), Multiple Comparisons Using R, CRC Press.
Westfall, P. H., Young, S. S. (1993), Resampling-Based Multiple Testing: Examples and Methods
for p-Value Adjustment, Wiley Series in Probability and Statistics.
See Also
Examples
data(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')