tsoutliers (version 0.6-8)

outliers.regressors: Regressor Variables for the Detection of Outliers

Description

These functions create regressor variables to be used included in the regression where tests for presence will be applied.

Usage

outliers.regressors(pars, mo, n, weights = TRUE,
  delta = 0.7, freq = 12)

Value

A matrix containing the regressors by columms.

Arguments

pars

a list containing the parameters of the model. See details section in locate.outliers.

mo

a data frame defining the type, location and weight of the outliers to be created.

n

a numeric. The length of the variable that will contain the outlier.

weights

logical. If TRUE, the variables are weighted by the values in column "coefhat" of the data frame mo. Otherwise, unit weights are considered.

delta

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

freq

a numeric. The periodicity of the data. Used only for the seasonal level shift, "SLS".

Details

The variables returned by these functions are the regressors that take part in the second equation defined in locate.outliers, (equation (20) in Chen-Liu (1993), equation (3) in the documentat attached to the package).

Regressions are not actually run since the \(t\)-statistics can be obtained more conveniently as indicated in equation (14) in Chen-Liu (1993). These variables are used in function locate.outliers.iloop to adjust the residuals at each iteration.

The function outliers can be used to easily create the input argument mo.

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.

Kaiser, R., and Maravall, A. (1999). Seasonal Outliers in Time Series. Banco de España, Servicio de Estudios. Working paper number 9915. http://www.bde.es/f/webbde/SES/Secciones/Publicaciones/PublicacionesSeriadas/DocumentosTrabajo/99/Fic/dt9915e.pdf

See Also

locate.outliers, outliers, outliers.tstatistics, tso.

Examples

Run this code
# regression of the residuals from the ARIMA model 
# on the corresponding regressors for three additive outliers
# at the 5% level, the first AO is not significant, the others are significant
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)
mo <- outliers(rep("AO", 3), c(10, 79, 224))
xreg <- outliers.regressors(pars, mo, length(y))
summary(lm(residuals(fit) ~ 0 + xreg)) 

Run the code above in your browser using DataCamp Workspace