Confidence and acceptance intervals in package sarima
confint.Rd
Compute confidence and acceptance intervals for sample autocorrelations under assumptions chosen by the user.
Usage
# S4 method for SampleAutocorrelations
confint(object, parm, level = 0.95, se = FALSE, maxlag, ..., assuming)
Arguments
- object
an object containing sample autocorrelations (sacfs).
- parm
which parameters to include, as for
stats::confint
.- level
coverage level, such as 0.95.
- se
If
TRUE
return also standard errors.- assuming
-
under what assumptions to do the computations? Currently can be
"iid"
,"garch"
, a fitted model, or a theoretical model, see Details. - maxlag
maximal lag to include
- ...
further arguments for
se
.
Details
For lags not fixed by the assumed model the computed intervals are confidence intervals.
The autocorrelations postulated by the null model (argument
assuming
) are usually fixed for some lags. For such lags it
doesn't make sense to talk about confidence intervals. We use the
term acceptance interval in this case since the sacfs for such
lags fall in the corresponding intervals with high probability if the
null model is correct.
If assuming
is "iid"
(strong white noise), then all
autocorrelations in the null model are fixed (to zero) and the limits
of the resulting acceptance intervals are ethose from the familiar
plots produced by base-R's function acf
.
If assuming
is a fitted MA(q) model, e.g. obtained from
arima()
, then for lags \(1,\ldots,q\) we get
confidence intervals, while for lags greater than \(q\) the
intervals are acceptance intervals.
The autocorrelations of ARMA models with non-trivial autoregressive part may also have structural patterns of zeroes (for example some seasonal models), leading to acceptance intervals for such lags.
If assuming
specifies a theoretical (non-fitted) model, then
the autocorrelation function of the null model is completely fixed and
we get acceptance intervals for all lags.
The return value is a matrix with one row for each requested lag,
containg the lag, lower bound, upper bound, estimate for acf(lag) and
the value of acf(lag) under H0 (if fixed) and NA
if not fixed
under H0. The null model is stored as attribute "assuming"
.
Note: When assuming = "garch"
it is currently
necessary to submit the time series from which the autocorrelations
were computed as argument x
.
Value
a matrix as described in section ‘Details’;
if se = TRUE
, a column giving the standard errors of the sample
autocorrelations is appended.
See also
vignette("white_noise_tests", package = "sarima")
vignette("garch_tests_example", package = "sarima")
Examples
set.seed(1234)
v1 <- arima.sim(n = 100, list(ma = c(0.8, 0.1), sd = 1))
v1.acf <- autocorrelations(v1, maxlag = 10)
confint(v1.acf, parm = 1:4, assuming = "iid")
#> Lag 2.5 % 97.5 % Estimate H0_fixed
#> Lag_1 1 -0.1959964 0.1959964 0.6194318 0
#> Lag_2 2 -0.1959964 0.1959964 0.1960955 0
#> Lag_3 3 -0.1959964 0.1959964 0.1071118 0
#> Lag_4 4 -0.1959964 0.1959964 0.1348527 0
#> attr(,"assuming")
#> [1] "iid"
confint(v1.acf, assuming = "iid", maxlag = 4) # same
#> Lag 2.5 % 97.5 % Estimate H0_fixed
#> Lag_1 1 -0.1959964 0.1959964 0.6194318 0
#> Lag_2 2 -0.1959964 0.1959964 0.1960955 0
#> Lag_3 3 -0.1959964 0.1959964 0.1071118 0
#> Lag_4 4 -0.1959964 0.1959964 0.1348527 0
#> attr(,"assuming")
#> [1] "iid"
## a fitted MA(2) - rho_1, rho_2 not fixed, the rest fixed
ma2fitted <- arima(v1, order = c(0,0,2), include.mean=FALSE)
confint(v1.acf, assuming = ma2fitted, maxlag = 4)
#> Lag 2.5 % 97.5 % Estimate H0_fixed
#> Lag_1 1 0.48912998 0.7497336 0.6194318 NA
#> Lag_2 2 -0.04684288 0.4390339 0.1960955 NA
#> Lag_3 3 -0.24926724 0.2492672 0.1071118 0
#> Lag_4 4 -0.24926724 0.2492672 0.1348527 0
#> attr(,"assuming")
#>
#> Call:
#> arima(x = v1, order = c(0, 0, 2), include.mean = FALSE)
#>
#> Coefficients:
#> ma1 ma2
#> 0.9902 0.1126
#> s.e. 0.0884 0.0910
#>
#> sigma^2 estimated as 0.9474: log likelihood = -139.99, aic = 285.99
## a theoretical MA(2) model, all acfs fixed under H0
ma2 <- MaModel(ma = c(0.8, 0.1), sigma2 = 1)
confint(v1.acf, assuming = ma2, maxlag = 4)
#> Lag 2.5 % 97.5 % Estimate H0_fixed
#> Lag_1 1 0.7463301 1.0136699 0.6194318 0.88
#> Lag_2 2 -0.1394966 0.3394966 0.1960955 0.10
#> Lag_3 3 -0.2460700 0.2460700 0.1071118 0.00
#> Lag_4 4 -0.2460700 0.2460700 0.1348527 0.00
#> attr(,"assuming")
#> An object of class "MaModel"
#> mean: 0
#> sigmaSq: 1
#>
#> slot "ar":
#> An object of class "BJFilter"
#> order: 0
#> Coefficients:
#> numeric(0)
#>
#> slot "ma":
#> An object of class "SPFilter"
#> order: 2
#> Coefficients:
#> [1] 0.8 0.1
# a weak white noise null
confint(v1.acf, assuming = "garch", maxlag = 4, x = v1)
#> Lag 2.5 % 97.5 % Estimate H0_fixed
#> Lag_1 1 -0.2414976 0.2414976 0.6194318 0
#> Lag_2 2 -0.1919697 0.1919697 0.1960955 0
#> Lag_3 3 -0.1882971 0.1882971 0.1071118 0
#> Lag_4 4 -0.1626543 0.1626543 0.1348527 0
#> attr(,"assuming")
#> [1] "garch"