Learn R Programming

tsoutliers (version 0.6-8)

discard.outliers: Stage II of the Procedure: Discard Outliers

Description

This functions tests for the significance of a given set of outliers in a time series model that is fitted including the outliers as regressor variables.

Usage

discard.outliers(x, y, cval = NULL, 
  method = c("en-masse", "bottom-up"), 
  delta = 0.7, tsmethod.call = NULL, 
  fdiff = NULL, logfile = NULL, check.rank = FALSE)

Value

A list containing the following elements: xreg, the variables used as regressors; xregcoefs, the coefficients of the outlier regressors; xregtstats, the \(t\)-statistics of the outlier regressors;; iter, the number of iterations used by method "en-masse"; fit, the fitted model; outliers, the set of outliers after removing those that were not significant.

Arguments

x

a list. The output returned by locate.outliers.oloop.

y

a time series.

cval

a numeric. The critical value to determine the significance of each type of outlier.

method

a character. The method to discard/remove outliers. See details.

delta

a numeric. Parameter of the temporary change type of outlier.

tsmethod.call

an optional call object. The call to the function used to fit the time series model.

fdiff

currently ignored.

logfile

a character or NULL. It is the path to the file where tracking information is printed. Ignored if NULL.

check.rank

logical. If TRUE, variables generating perfect multicollinearity are removed (tentative implementation).

Details

In the regressions involved in this function, the variables included as regressors stand for the effects of the outliers on the data. These variables are the output returned by outliers.effects not by outliers.regressors, which returns the regressors used in the auxiliar regression where outliers are located (see second equation defined in locate.outliers).

The outliers are defined in input x. If there are regressor variables in tsmethod.call$xreg they are considered as other regressor variables that are included in the regression to test for the significance of outliers.

Given a set of potential outliers detected by locate.outliers and locate.outliers.oloop, three methods are considered in order to determine which outliers are not significant after refitting the model (including all the potential outliers):

  • "en-masse": The complete set of outliers is included as regressor variables and the model is fitted again. Those outliers that turn out to be not significant for the critical value cval are discarded/removed. The procedure is iterated until all the outliers are significant in the final set of outliers.

  • "bottom-up": First the, the outlier with larger \(t\)-statistic is included in the model. If it is significant the presence of the outlier is confirmed. Otherwise it is discarded. Then, the next outlier with larger \(t\)-statistic is included along with the first outlier and tested for significance. If after including a new outlier, e.g. the \(i\)-th outlier, the outliers that have been confirmed so far significant become not significant, then the \(i\)-th outlier is discarded regardless of the value of its \(t\)-statistic.

The option "en-masse" may be preferred to "bottom-up" when there are are several outliers, since it may be hard to fit an ARIMA model with many regressor variables.

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.

Gómez, V. and Maravall, A. (1996). Programs TRAMO and SEATS. Instructions for the user. Banco de España, Servicio de Estudios. Working paper number 9628. http://www.bde.es/f/webbde/SES/Secciones/Publicaciones/PublicacionesSeriadas/DocumentosTrabajo/96/Fich/dt9628e.pdf

See Also

locate.outliers, tso.

Examples

Run this code
if (FALSE) {
data("hicp")
y <- log(hicp[["011600"]])
fit <- arima(y, order = c(1, 1, 0), seasonal = list(order = c(2, 0, 2)))
# initial set of outliers
res <- locate.outliers.oloop(y, fit, types = c("AO", "LS", "TC"))
res$outliers
# given the model fitted above, the effect on the data of some of 
# the outliers is not significant (method = "en-masse")
discard.outliers(res, y, method = "en-masse", 
  tsmethod.call = fit$call)$outliers
# in this case, using method = "bottom-up" the first four 
# outliers with higher t-statistic are kept
discard.outliers(res, y, method = "bottom-up", 
  tsmethod.call = fit$call)$outliers
}

Run the code above in your browser using DataLab