R: Test Statistics for the Significance of Outliers
outliers.tstatistics
R Documentation
Test Statistics for the Significance of Outliers
Description
This function computes the t-statistics to assess the significance
of different types of outliers at every possible time point.
The statistics can be based either on an ARIMA model,
arima, auto.arima, or a
structural time series model, stsmFit.
a list containing the parameters of the model.
See details section in locate.outliers.
resid
a time series. Residuals of the ARIMA model fitted to the data.
types
a character vector indicating the types of outliers to be considered.
sigma
a numeric or NULL. Standard deviation of residuals.
delta
a numeric. Parameter of the temporary change type of outlier.
n.start
a numeric. The number of warming observations added to the
input passed to the Kalman filter. Only for pars of class "stsmSS".
Details
Five types of outliers can be considered.
By default: "AO" additive outliers, "LS" level shifts,
and "TC" temporary changes are selected;
"IO" innovative outliers and "SLS" seasonal level shifts
can also be selected.
The test statistics are based on the second equation defined in locate.outliers.
These functions are the called by locate.outliers.
The approach described in Chen & Liu (1993) is implemented to compute
the t-statistics.
By default (sigma = NULL), the standard deviation of residuals
is computed as the mean absolute deviation of resid.
Value
For each function, a two-column matrix is returned.
The first column contains the estimate of the coefficients related to the type of outlier
and the second column contains the t-statistics.
The value of these statistics for each time point is stored by rows, thus
the number of rows is equal to the length of resid.
References
Chen, C. and Liu, Lon-Mu (1993).
‘Joint Estimation of Model Parameters and Outlier Effects in Time Series’.
Journal of the American Statistical Association,
88(421), pp. 284-297.
# given an ARIMA model detect potential outliers
# for a critical value equal to 3.5
data("hicp")
y <- log(hicp[["011600"]])
fit <- arima(y, order = c(1, 1, 0), seasonal = list(order = c(2, 0, 2)))
resid <- residuals(fit)
pars <- coefs2poly(fit)
tstats <- outliers.tstatistics(pars, resid)
# potential observations affected by an additive outliers
which(abs(tstats[,"AO","tstat"]) > 3.5)
# potential observations affected by a temporary change
which(abs(tstats[,"TC","tstat"]) > 3.5)
# potential observations affected by a level shift
which(abs(tstats[,"LS","tstat"]) > 3.5)