R: Create the Pattern of Different Types of Outliers
outliers.effects
R Documentation
Create the Pattern of Different Types of Outliers
Description
These functions create a unit or weighted impulse for the five types
of outliers considered in the package.
Usage
outliers.effects(mo, n, weights = FALSE, delta = 0.7,
pars = NULL, n.start = 50, freq = 12)
Arguments
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 outliers 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.
pars
a list containing the parameters of the time series model fitted to the data.
Only for innovational outlier. See the details section in locate.outliers.
n.start
a numeric. The number of warming observations added to the
input passed to the Kalman filter. Only for innovational outlier and pars of
class "stsmSS".
freq
a numeric. The periodicity of the data. Only for seasonal level shift.
Details
These functions delineate the effect of each type of outlier on the observed data.
See the example below for a representation of the outliers.
The function outliers.effects operates directly on the output returned
by time. The remaining functions are called by
outliers.effects and can be used as a simpler interface to define some outliers.
They generate the type of outliers indicated by their names.
The column names of the data frame mo must follow the same convention as
the output returned by locate.outliers: the column containing the
observation at which the outlier sparks is named "ind";
the column containing the weights is named "coefhat" and the type
of outlier is specified in a column named "type". The column "ind"
should contain the index time point, not the time point in terms of year and season
as given by time.
Value
A n\timesnrow(mo) or n\timeslength(ind) matrix
containing by columns each outlier.
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.