Plot the theoretical ACF corresponding to an ARMA model
plotArmaTrueacf.Rd
Compute the roots and theoretical ACF corresponding to an ARMA model
Arguments
- object
either a numeric vector or a list with components 'ar' and 'ma'. If 'object' is numeric, it is interpreted as a model with no 'ma' part.
- lag.max
the maximum number of lags for which to calculate the ACF or PACF.
- pacf
logical. Should the partial autocorrelations be returned?
- plot
logical. Should the ACF (or PACF) be plotted?
- xlab, ylab, ylim, type
arguments for 'plot'
- complex.eps
a small positive number used to identify complex conjugates: Let 'roots' = the vector of p roots of the characteristic polynomial of the autoregressive part of 'object'. This is used by 'findConjugates': x[i] and x[j] are considered conjugate if their relative difference exceeds complex.eps but the relative difference of their conjugates is less than complex.eps.
We use 'solve' in the 'polynom' package, because it was substially more accurate for cases we tested in R 2.6.0 than 'polyroot'.
- ...
optional arguments passed to 'plot'.
Details
1. Compute and test stationarity. An ARMA process is stationary if all the roots of its AR component lie inside the unit circle (Box and Jenkins, 1970). If the process is not stationary, a warning is issued, and no plot is produced.
2. Compute and plot the theoretical ACF.
3. Analyze periodicity of any complex roots
Value
a list with the following components
- roots
a complex vector of the roots sorted by modulus and sign of the immaginary part.
- acf, pacf
a named numeric vector of the estimated ACF (or PACF of 'pacf = TRUE').
- periodicity
a data.frame with one row for each complex conjugate pair of roots and columns 'damping' and 'period'.
References
George E. P. Box and Gwilym M. Jenkins (1970) Time Series Analysis, Forecasting and Control (Holden-Day, sec. 3.4.1. Stationarity and invertibility properties of Mixed autoregressive-moving average processes)
Ruey Tsay (2005) Analysis of Financial Time Series, 2nd ed. (Wiley, ch. 2)
Examples
# Tsay, Figure 2.3
op <- par(mfcol = c(1, 2))
plotArmaTrueacf(.8, lag.max = 8)
#> $roots
#> [1] 0.8
#>
#> $acf
#> 0 1 2 3 4 5 6 7
#> 1.0000000 0.8000000 0.6400000 0.5120000 0.4096000 0.3276800 0.2621440 0.2097152
#> 8
#> 0.1677722
#>
#> $periodicity
#> [1] damping period
#> <0 rows> (or 0-length row.names)
#>
title("(a)")
plotArmaTrueacf(-.8, lag.max = 8)
#> $roots
#> [1] -0.8
#>
#> $acf
#> 0 1 2 3 4 5 6
#> 1.0000000 -0.8000000 0.6400000 -0.5120000 0.4096000 -0.3276800 0.2621440
#> 7 8
#> -0.2097152 0.1677722
#>
#> $periodicity
#> [1] damping period
#> <0 rows> (or 0-length row.names)
#>
title("b")
par(op)
# Tsay, Figure 2.4
op <- par(mfrow = c(2,2))
plotArmaTrueacf(c(1.2, -.35))
#> $roots
#> [1] 0.7 0.5
#>
#> $acf
#> 0 1 2 3 4 5
#> 1.000000000 0.888888889 0.716666667 0.548888889 0.407833333 0.297288889
#> 6 7 8 9 10 11
#> 0.214005000 0.152754889 0.108404117 0.076620729 0.054003434 0.037986865
#> 12 13 14 15 16 17
#> 0.026683037 0.018724241 0.013130027 0.009202547 0.006447548 0.004516166
#> 18 19 20
#> 0.003162757 0.002214650 0.001550616
#>
#> $periodicity
#> [1] damping period
#> <0 rows> (or 0-length row.names)
#>
title("(a)")
plotArmaTrueacf(c(.6, -.4))
#> $roots
#> [1] 0.3+0.5567764i 0.3-0.5567764i
#>
#> $acf
#> 0 1 2 3 4
#> 1.000000e+00 4.285714e-01 -1.428571e-01 -2.571429e-01 -9.714286e-02
#> 5 6 7 8 9
#> 4.457143e-02 6.560000e-02 2.153143e-02 -1.332114e-02 -1.660526e-02
#> 10 11 12 13 14
#> -4.634697e-03 3.861285e-03 4.170650e-03 9.578759e-04 -1.093534e-03
#> 15 16 17 18 19
#> -1.039271e-03 -1.861489e-04 3.040191e-04 2.568710e-04 3.251496e-05
#> 20
#> -8.323941e-05
#>
#> $periodicity
#> damping period
#> 1 0.6324555 5.836244
#>
title("(b)")
plotArmaTrueacf(c(.2, .35))
#> $roots
#> [1] -0.5 0.7
#>
#> $acf
#> 0 1 2 3 4 5
#> 1.0000000000 0.3076923077 0.4115384615 0.1900000000 0.1820384615 0.1029076923
#> 6 7 8 9 10 11
#> 0.0842950000 0.0528766923 0.0400785885 0.0265225600 0.0193320180 0.0131492996
#> 12 13 14 15 16 17
#> 0.0093960662 0.0064814681 0.0045849168 0.0031854972 0.0022418203 0.0015632881
#> 18 19 20
#> 0.0010972947 0.0007666098 0.0005373751
#>
#> $periodicity
#> [1] damping period
#> <0 rows> (or 0-length row.names)
#>
title("(c)")
plotArmaTrueacf(c(-.2, .35))
#> $roots
#> [1] -0.7 0.5
#>
#> $acf
#> 0 1 2 3 4
#> 1.0000000000 -0.3076923077 0.4115384615 -0.1900000000 0.1820384615
#> 5 6 7 8 9
#> -0.1029076923 0.0842950000 -0.0528766923 0.0400785885 -0.0265225600
#> 10 11 12 13 14
#> 0.0193320180 -0.0131492996 0.0093960662 -0.0064814681 0.0045849168
#> 15 16 17 18 19
#> -0.0031854972 0.0022418203 -0.0015632881 0.0010972947 -0.0007666098
#> 20
#> 0.0005373751
#>
#> $periodicity
#> [1] damping period
#> <0 rows> (or 0-length row.names)
#>
title("(d)")
par(op)
# Tsay, Example 2.1
data(q.gnp4791)
(fit.ar3 <- ar(q.gnp4791, aic = FALSE, order = 3))
#>
#> Call:
#> ar(x = q.gnp4791, aic = FALSE, order.max = 3)
#>
#> Coefficients:
#> 1 2 3
#> 0.3463 0.1770 -0.1421
#>
#> Order selected 3 sigma^2 estimated as 9.676e-05
plotArmaTrueacf(fit.ar3)
#> $roots
#> [1] -0.5198738+0.0000000i 0.4330640+0.2928575i 0.4330640-0.2928575i
#>
#> $acf
#> 0 1 2 3 4
#> 1.000000e+00 3.768704e-01 2.539120e-01 1.252511e-02 -4.277277e-03
#> 5 6 7 8 9
#> -3.534199e-02 -1.477390e-02 -1.076216e-02 -1.319312e-03 -2.621925e-04
#> 10 11 12 13 14
#> 1.204899e-03 5.582584e-04 4.437810e-04 8.125443e-05 2.734832e-05
#> 15 16 17 18 19
#> -3.920653e-05 -2.028084e-05 -1.784643e-05 -4.197719e-06 -1.730075e-06
#> 20
#> 1.193835e-06
#>
#> $periodicity
#> damping period
#> 1 0.5227905 10.56699
#>