Type: | Package |
Title: | Robust ARIMA Modeling |
Imports: | methods, splusTimeDate, splusTimeSeries |
Version: | 0.2.7 |
Description: | Functions for fitting a linear regression model with ARIMA errors using a filtered tau-estimate. The methodology is described in Maronna et al (2017, ISBN:9781119214687). |
License: | BSD_3_clause + file LICENSE |
URL: | https://github.com/spkaluzny/robustarima |
BugReports: | https://github.com/spkaluzny/robustarima/issues |
Encoding: | UTF-8 |
LazyData: | true |
NeedsCompilation: | yes |
Packaged: | 2024-09-20 23:35:56 UTC; spk |
Author: | Stephen Kaluzny [aut, cre], Bill Dunlap [ctb], TIBCO Software Inc. [aut, cph] |
Maintainer: | Stephen Kaluzny <spkaluzny@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2024-09-23 13:30:03 UTC |
Robust Fit of a REGARIMA Model and Outliers Detection
Description
Returns an object of class "arima.rob"
that represents a robust fit of a linear
regression model with ARIMA errors using a filtered tau-estimate. The error
model may have seasonal differences and one seasonal moving average
parameter. It also returns the detected outliers and level shifts.
Usage
arima.rob(formula, data, contrasts=NULL, start=NULL, end=NULL,
p=0, q=0, d=0, sd=0, freq=1, sfreq=NULL, sma=FALSE,
max.p=NULL, auto.ar=FALSE, n.predict=20, tol=10^(-6),
max.fcal=2000, iter=FALSE, innov.outlier=FALSE, critv=NULL, ...)
Arguments
formula |
a |
data |
a data frame or a |
contrasts |
the same as the |
start |
a character string which can be passed to |
end |
a character string which can be passed to |
p |
the autoregressive order of the errors model.
The default is |
q |
the moving average order of the errors model.
The default is |
d |
the number of regular differences in the ARIMA model.
It must be |
sd |
the number of seasonal differences. It must be |
freq |
the frequency of |
sfreq |
the seasonality frequency of |
sma |
logical flag: if |
auto.ar |
logical flag: If |
max.p |
the maximum order of the autoregressive stationary model that approximates
the ARMA stationary model. If |
n.predict |
the maximum number of future periods for which we wish to compute the
predictions. The default is |
tol |
the tolerance for convergence. |
max.fcal |
the maximum number of function evaluations. |
iter |
a logical flag or the number of iterations to
execute |
innov.outlier |
logical flag: if |
critv |
the critical value for detecting outliers.
If |
... |
extra arguments passed to or from other methods. |
Value
an object of class "arima.rob"
representing the fit and the outliers detected.
See arima.rob.object
for details of
the components of the object.
Warning
When either d
or
sd
is greater than zero, the interpretation
of the intercept in the formula
is
different from its usual interpretation:
it represents the coefficient of the lowest order power of the time trend
which can be identified. For example, if
d=2
and
sd=0
, the
intercept represents the coefficient of the
term t^2
.
References
Bianco, A., Garcia Ben, M., Martinez, E., and Yohai, V. (1996). Robust procedures for regression models with ARIMA errors. COMPSTAT 96, Proceedings in Computational Statistics. Ed. Albert Prat, pages. 27-38. Physica-Verlag, Heidelberg.
Bianco, A., Garcia Ben, M., Martinez, E., and Yohai, V. (1997). Outlier detection in regression models with ARIMA errors using robust estimates. mimeo.
Chang, I., Tiao, G. C., and Chen, C. (1988). Estimation of time series parameters in the presence of outliers. Technometrics, 30:193-204.
Maronna, R. A., Martin, R. D., Yohai, V. J., Salibián-Barrera. M. (2017). Robust Statistics: Theory and Practice (with R), 2nd Edition, Wiley.
Martin, R. D., Samarov, A., and Vandaele, W. (1983). Robust methods for ARIMA models. in Applied Time Series Analysis of Economic Data, E. Zellner, ed.
Yohai, V. Y., and Zamar, R. H. (1988). High breakdown-point estimates of regression by means of the minimization of an efficient scale. Journal of the American Statistical Association, 83:406-413.
See Also
Examples
frip.rr <- arima.rob(log(frip.dat) ~ 1, p=2, d=1)
Robust Fitting of a REGARIMA Model
Description
This is an internal function called iteratively by arima.fit
.
Users are not likely to ever call it directly.
Usage
arima.rob.fit(formula, data, contrasts = NULL, start = NULL, end = NULL,
p = 0, q = 0, d = 0, sd = 0, freq = 1, sfreq = NULL, sma = FALSE,
max.p = NULL, auto.ar = FALSE, n.predict = 20, y.cleaned = NULL,
tol = 10^(-6), max.fcal = 2000, method = "fit", ...)
Arguments
formula |
a |
data |
a data frame or a |
contrasts |
the same as the |
start |
a character string which can be passed to |
end |
a character string which can be passed to |
p |
the autoregressive order of the errors model.
The default is |
q |
the moving average order of the errors model.
The default is |
d |
the number of regular differences in the ARIMA model.
It must be |
sd |
the number of seasonal differences. It must be |
freq |
the frequency of |
sfreq |
the seasonality frequency of |
sma |
logical flag: if |
auto.ar |
logical flag: If |
max.p |
the maximum order of the autoregressive stationary model that approximates
the ARMA stationary model. If |
n.predict |
the maximum number of future periods for which we wish to compute the
predictions. The default is |
y.cleaned |
the cleaned response series. |
tol |
the tolerance for convergence. |
max.fcal |
the maximum number of function evaluations. |
method |
a string that specifies the method. |
... |
extra arguments passed to or from other methods. |
Value
an object of class "arima.rob"
.
See link{arima.rob.object}
.
See Also
Examples
# See arima.rob for example
Robust REGARIMA Model and Outliers Detection Objects
Description
These are objects of class "arima.rob"
which represent
the robust fit of a
regression model with ARIMA errors. It also contains information about the
detected outliers.
Arguments
The following components must be included in a legitimate
"arima.rob"
object:
x |
the model matrix. |
y |
the response variable. |
model |
a list with the following named components: |
regcoef |
the estimates of regression coefficients. |
regcoef.cov |
the estimated covariance matrix of the regression coefficients. |
innov |
the estimated innovations. |
innov.acf |
a series whose autocorrelations or partial autocorrelations are the robust estimates of the innovation autocorrelations or partial autocorrelations. |
regresid |
the estimated regression residuals cleaned of additive outliers by the robust filter. |
regresid.acf |
a series whose autocorrelations or partial autocorrelations are the robust estimates of the autocorrelations or partial autocorrelations of the differenced regression residuals. |
sigma.innov |
a robust estimate of the innovation scale. |
sigma.regresid |
an estimate of the scale of the differenced regression residuals. |
sigma.first |
the first estimate of the innovation scale based only on the scale of the differenced model and the ARMA parameters. |
tuning.c |
the bandwidth of the robust filter. |
y.robust |
the response series cleaned of outliers by the robust filter. |
y.cleaned |
the response series cleaned of additive outliers and level shifts after the outliers detection procedure. |
predict.error |
the fitted and predicted regression errors. |
predict.scales |
the standard deviations of the fitted and predicted regression errors. |
n.predict |
the number of predicted observations, which is equal to the
|
tauef |
the inverse of the estimated efficiency factor of the tau-estimate with respect to the LS-estimate. |
inf |
information about the outcome of the last optimization procedure: |
innov.outlier |
logical flag, the same as the |
outliers |
an object of class |
outliers.iter |
optionally a list of objects of class |
n0 |
the number of missing innovations at the beginning. |
call |
an image of the call that produced the object, but with the arguments all
named and with the actual formula included as
the |
assign |
the same as the |
contrasts |
the same as the |
terms |
the same as the |
rank |
the same as the |
Generation
This class of objects is returned from the
arima.rob
function.
Methods
coef
, formula
,
outliers
,
predict
, print
, summary
.
See Also
arima.rob
,
outliers
,
outliers.object
.
Use coef on an arima.rob Object
Description
This is a method for the function
coef()
for objects inheriting from
class "arima.rob"
.
See coef
or
coef.default
for the general behavior of this
function and for the interpretation of object.
Usage
## S3 method for class 'arima.rob'
coef(object, ...)
Arguments
object |
an object of class |
... |
extra arguments passed to or from other methods. The coef method here ignore these arguments. |
Value
a named vector of the model coefficients.
Monthly Industrial Production of France
Description
A "timeSeries"
vector containing the monthly industrial production
of France from January 1960 to December 1989.
Usage
frip.dat
Format
A "timeSeries"
vector
Monthly Imports and Import Taxes of Argentina
Description
The import.dat
data frame has 96 rows and 2 columns.
The sample runs from January 1983 to December 1990.
Usage
import.dat
Format
A data frame with 96 observations and 2 columns:
- taxes
-
monthly import taxes of Argentina.
- import
-
monthly imports of Argentina.
Monthly Import Taxes of Argentina
Description
The newtaxes.dat
data frame has 10 rows and 1 column.
The sample runs from January to October 1992.
Usage
newtaxes.dat
Format
A data frame with 10 rows and 1 column:
- taxes
-
monthly import taxes of Argentina.
Outliers Extraction for an <code>arima.rob</code> Object
Description
Returns an object of class "outliers"
.
Usage
outliers(object, iter=NULL)
Arguments
object |
an object of class |
iter |
a number specifying from which iteration to extract the detected outliers,
if the |
Value
an object of class "outliers"
.
If iter
is NULL
,
the object contains
all the detected outliers (and level shifts).
If iter
is not
NULL
, the
object contains the outliers (and level shifts) detected in iteration
iter
.
See outliers.object
for
components of the returned object.
See Also
outliers.object
,
arima.rob
,
arima.rob.object
.
Examples
frip.rr <- arima.rob(log(frip.dat) ~ 1, p=2, d=1, iter=2)
frip.outliers.all <- outliers(frip.rr)
frip.outliers.2 <- outliers(frip.rr, iter=2)
Outliers Objects Extracted from <code>arima.rob</code> Objects
Description
These are objects of class "outliers"
extracted an object of class "arima.rob"
,
which contain information about the detected outliers (and level shifts).
Arguments
The following components must be included in a
legitimate "outliers"
object:
nout |
the number of outliers (and level shifts) detected. |
outlier.index |
the index of each detected outlier (or level shift). |
outlier.type |
the type of each detected outlier (or level shift): 1=innovation outlier, 2=additive outlier, 3=level shift. |
outlier.impact |
the size of each detected outlier (or level shift). |
outlier.t.statistics |
the t-statistics for each detected outlier (or level shift). |
outlier.positions |
the |
sigma0 |
the estimate of the innovation scale before correcting the outliers. |
sigma |
the estimate of the innovation scale after correcting the outliers. |
ierror |
the error indicator: if |
Generation
This class of objects is returned from the
outliers
function.
Methods
print
,
summary
.
See Also
outliers
arima.rob
,
arima.rob.object
.
Use predict on an arima.rob Object
Description
Predicts from a fitted "arima.rob"
object.
Usage
## S3 method for class 'arima.rob'
predict(object, n.predict=1, newdata=NULL,
olddata=NULL, se.fit=FALSE, ...)
Arguments
object |
an object of class |
n.predict |
the number of predictions to be returned. |
newdata |
a data frame containing the future values of exogenous variables, if any, at which predictions are required. |
olddata |
a data frame containing the original data used to fit
|
se.fit |
logical flag: if |
... |
extra arguments passed to or from other methods. The predict method here ignore these arguments. |
Details
This function is a method for the generic function predict
for class
"arima.rob"
.
It can be invoked by calling predict
for an object of the
appropriate class,
or directly by calling predict.arima.rob
regardless of the
class of the object.
Value
a list containing the following components:
values |
the predicted values. |
std.err |
the pointwise standard errors for the predictions (if |
See Also
Examples
import.rr <- arima.rob(import ~ taxes-1, data=import.dat, p=2, d=1)
import.hat <- predict(import.rr, 5, newdata=newtaxes.dat, se=TRUE)
Use print on an arima.rob Object
Description
This is a method for the function print()
for objects inheriting from
class "arima.rob"
.
See print
or
print.default
for the general behavior
of this function and for the interpretation of
x
.
Usage
## S3 method for class 'arima.rob'
print(x, digits = 4, ...)
Arguments
x |
an object of class |
digits |
the number of digits to display. |
... |
extra arguments passed to or from other methods. |
Value
invisibly returns x
.
Typically called for the printing side effect.
See Also
Use print on an outliers Object
Description
This is a method for the function print
for objects inheriting from class "outliers"
.
See print
or
print.default
for the general behavior
of this function and for the interpretation of
x
.
Usage
## S3 method for class 'outliers'
print(x, digits = 4, ...)
Arguments
x |
an object of class |
digits |
the number of digits to display. |
... |
extra arguments passed to or from other methods. |
Value
invisibly returns x
.
Typically called for the printing side effect.
See Also
Use print on a summary.arima.rob Object
Description
This is a method for the function print
for objects inheriting
from class "summary.arima.rob"
.
See print
or
print.default
for the general
behavior of this function and for the interpretation of
x
.
Usage
## S3 method for class 'summary.arima.rob'
print(x, digits = 4, ...)
Arguments
x |
an object of class |
digits |
the number of digits to display. |
... |
extra arguments passed to or from other methods. |
Value
invisibly returns x
.
Typically called for the printing side effect.
See Also
Use print on a summary.outliers Object
Description
This is a method for the function print()
for objects inheriting from
class "summary.outliers"
.
See print
or
print.default
for the general
behavior of this function and for the interpretation of
x
.
Usage
## S3 method for class 'summary.outliers'
print(x, digits = 4, ...)
Arguments
x |
an object of class |
digits |
the number of digits to display. |
... |
extra arguments passed to or from other methods. |
Value
invisibly returns x
.
Typically called for the printing side effect.
See Also
Summary Method for arima.rob Objects
Description
Returns a summary list for an "arima.rob"
object.
Usage
## S3 method for class 'arima.rob'
summary(object, correlation = FALSE, ...)
Arguments
object |
an object of class |
correlation |
a logical flag: if |
... |
extra arguments passed to or from other methods. The summary method here ignore these arguments. |
Details
This function is a method for the generic function
summary
for class
"arima.rob"
. It can be invoked by
calling summary
for an object of the
appropriate class, or directly by calling
summary.arima.rob
regardless of the
class of the object.
Value
an object of class "summary.arima.rob"
which
must contain the following components:
ARIMA.model |
the same list as the |
reg.coef |
a matrix with four columns, containing the regression coefficients, their standard errors, the t-statistics and the corresponding p-values. |
regcoef.cov |
the estimated covariance matrix for the regression coefficients. |
regcoef.corr |
the estimated correlation matrix for the regression coefficients.
This is only present if |
AR.coef |
a matrix with four columns, containing the AR coefficients, their standard errors, the t-statistics and the p-values. |
MA.coef |
a matrix with four columns, containing the MA coefficients, their standard errors, the t-statistics and the p-values. |
sMA.coef |
an array which contains the seasonal moving average parameter, its standard error, the t-statistic and the p-value. |
ARIMA.cov |
the estimated covariance matrix of the ARMA coefficients. |
ARIMA.corr |
the estimated correlation matrix of the ARMA coefficients.
This is only present if |
n |
the length of the time series. |
df |
the number of degrees of freedom for the model. |
sigma |
the estimate of the innovations scale. |
call |
the image of the original call to |
outliers |
an object of class |
See Also
arima.rob
,
arima.rob.object
,
summary
.
Examples
frip.rr <- arima.rob(log(frip.dat) ~ 1, p=2, d=1)
summary(frip.rr)
Summary Method for outliers Objects
Description
Returns an object of class "summary.outliers"
containing a summary list
for an "outliers"
object.
A null value will be returned if printing is invoked.
Usage
## S3 method for class 'outliers'
summary(object, ...)
Arguments
object |
an object of class |
... |
extra arguments passed to or from other methods. The summary method here ignore these arguments. |
Details
This function is a method for the generic function
summary
for class
"outliers"
. It can be invoked by
calling summary
for an object of the
appropriate class, or directly by calling
summary.outliers
regardless of
the class of the object.
Value
a list is returned with the following components:
nout |
number of outliers (and level shifts) detected. |
outliers.table |
the index (or |
sigma0 |
the estimate of the innovation scale before correcting outliers. |
sigma |
the estimate of the innovation scale after correcting outliers. |
See Also
outliers
,
outliers.object
,
summary
.
Examples
frip.rr <- arima.rob(log(frip.dat) ~ 1, p=2, d=1)
frip.outliers <- outliers(frip.rr)
summary(frip.outliers)
Use <code>vcov()</code> on an <code>arima.rob</code> Model Object
Description
This is a method for the function vcov()
for objects
inheriting from class "arima.rob"
.
See vcov
for the general behavior of this
function and for the interpretation of object
.
Usage
## S3 method for class 'arima.rob'
vcov(object, nterm=1000, ...)
Arguments
object |
an object inheriting from class |
nterm |
an interger specifying the number of terms. |
... |
extra arguments passed to or from other methods. The method here ignore these arguments. |
Value
the variance-covariance matrix of fitted arima.rob model returned
from a call arima.rob
.