TARMA.fit {tseriesTARMA}R Documentation

TARMA Modelling of Time Series

Description

Implements a Least Squares fit of full subset two-regime TARMA(p1,p2,q1,q2) model to a univariate time series

Usage

TARMA.fit(
  x,
  tar1.lags = c(1),
  tar2.lags = c(1),
  tma1.lags = c(1),
  tma2.lags = c(1),
  threshold = NULL,
  d = 1,
  pa = 0.25,
  pb = 0.75,
  method = c("L-BFGS-B", "solnp", "lbfgsb3c", "robust", "trimmed"),
  alpha = 0,
  qu = c(0.05, 0.95),
  innov = c("norm", "student"),
  optim.control = list(trace = 0),
  irls.control = list(maxiter = 100, tol = 1e-04),
  ...
)

Arguments

x

A univariate time series.

tar1.lags

Vector of AR lags for the lower regime. It can be a subset of 1 ... p1 = max(tar1.lags).

tar2.lags

Vector of AR lags for the upper regime. It can be a subset of 1 ... p2 = max(tar2.lags).

tma1.lags

Vector of MA lags for the lower regime. It can be a subset of 1 ... q1 = max(tma1.lags).

tma2.lags

Vector of MA lags for the upper regime. It can be a subset of 1 ... q2 = max(tma2.lags).

threshold

Threshold parameter. If NULL estimates the threshold over the threshold range specified by pa and pb.

d

Delay parameter. Defaults to 1.

pa

Real number in [0,1]. Sets the lower limit for the threshold search to the 100*pa-th sample percentile. The default is 0.25

pb

Real number in [0,1]. Sets the upper limit for the threshold search to the 100*pb-th sample percentile. The default is 0.75

method

Optimization/fitting method, can be one of "L-BFGS-B", "solnp", "lbfgsb3c", "robust", "trimmed".

alpha

Real positive number. Tuning parameter for robust estimation. Only used if method is robust.

qu

Quantiles for (initial) trimmed estimation. Tuning parameter for robust estimation. Only used if method is either robust or trimmed.

innov

Innovation density for robust estimation. can be one of "norm", "student". Only used if method is "robust".

optim.control

List of control parameters for the main optimization method.

irls.control

List of control parameters for the irls optimization method (see details).

...

Additional arguments.

Details

Implements the Least Squares fit of the following two-regime TARMA(p1,p2,q1,q2) process:
\[X_{t} = \left\lbrace \begin{array}{ll} \phi_{1,0} + \sum_{i \in I_1} \phi_{1,i} X_{t-i} + \sum_{j \in M_1} \theta_{1,j} \varepsilon_{t-j} + \varepsilon_{t} & \mathrm{if } X_{t-d} \leq \mathrm{thd} \\ &\\ \phi_{2,0} + \sum_{i \in I_2} \phi_{2,i} X_{t-i} + \sum_{j \in M_2} \theta_{2,j} \varepsilon_{t-j} + \varepsilon_{t} & \mathrm{if } X_{t-d} > \mathrm{thd} \end{array} \right. \] where \(\phi_{1,i}\) and \(\phi_{2,i}\) are the TAR parameters for the lower and upper regime, respectively, and I1 = tar1.lags and I2 = tar2.lags are the corresponding vectors of TAR lags. \(\theta_{1,j}\) and \(\theta_{2,j}\) are the TMA parameters and \(j \in M_1, M_2\), where M1 = tma1.lags and M2 = tma2.lags, are the vectors of TMA lags.
The most demanding routines have been reimplemented in Fortran and dynamically loaded.

Value

A list of class TARMA with components:

Fitting methods

method has the following options:

L-BFGS-B

Calls the corresponding method of optim. Linear ergodicity constraints are imposed.

solnp

Calls the function solnp. It is a nonlinear optimization using augmented Lagrange method with linear and nonlinear inequality bounds. This allows to impose all the ergodicity constraints so that in theory it always return an ergodic solution. In practice the solution should be checked since this is a local solver and there is no guarantee that the minimum has been reached.

lbfgsb3c

Calls the function lbfgsb3c in package lbfgsb3c. Improved version of the L-BFGS-B in optim.

robust

Robust M-estimator of Ferrari and La Vecchia (Ferrari and La-Vecchia 2011). Based on the L-BFGS-B in optim and an additional iterative re-weighted least squares step to estimate the robust weights. Uses the tuning parameters alpha and qu. Robust standard errors are derived from the sandwich estimator of the variance/covariance matrix of the estimates. The IRLS step can be controlled through the parameters maxiter (maximum number of iterations) and tol (target tolerance). These can be passed using irls.control.

trimmed

Experimental: Estimator based on trimming the sample using the tuning parameters qu (lower and upper quantile).

Where possible, the conditions for ergodicity and invertibility are imposed to the optimization routines but there is no guarantee that the solution will be ergodic and invertible so that it is advisable to check the fitted parameters.

Author(s)

Simone Giannerini, simone.giannerini@uniud.it

Greta Goracci, greta.goracci@unibz.it

References

See Also

TARMA.fit2 for Maximum Likelihood estimation of TARMA models with common MA part. print.TARMA for print methods for TARMA fits. predict.TARMA for prediction and forecasting. plot.tsfit for plotting TARMA fits and forecasts.

Examples


## a TARMA(1,1,1,1) model
set.seed(13)
x    <- TARMA.sim(n=200, phi1=c(0.5,-0.5), phi2=c(0.0,0.5), theta1=-0.5, theta2=0.7, d=1, thd=0.2)
fit1 <- TARMA.fit(x,tar1.lags=1, tar2.lags=1, tma1.lags=1, tma2.lags=1, d=1)

## --------------------------------------------------------------------------
## In the following examples the threshold is fixed to speed up computations
## --------------------------------------------------------------------------

## --------------------------------------------------------------------------
## Least Squares fit
## --------------------------------------------------------------------------

set.seed(26)
n    <- 200
y    <- TARMA.sim(n=n, phi1=c(0.6,0.6), phi2=c(-1.0,0.4), theta1=-0.7, theta2=0.5, d=1, thd=0.2)

fit1 <- TARMA.fit(y,tar1.lags=1, tar2.lags=1, tma1.lags=1, tma2.lags=1, d=1, threshold=0.2)
fit1

## ---------------------------------------------------------------------------
## Contaminate the data with one additive outlier
## ---------------------------------------------------------------------------
x     <- y           # contaminated series
x[54] <- x[54] + 10

## ---------------------------------------------------------------------------
## Compare the non-robust LS fit with the robust fit
## ---------------------------------------------------------------------------

fitls  <- TARMA.fit(x,tar1.lags=1, tar2.lags=1, tma1.lags=1, tma2.lags=1, d=1, threshold=0.2)
fitrob <- TARMA.fit(x,tar1.lags=1, tar2.lags=1, tma1.lags=1, tma2.lags=1, d=1,
            method='robust',alpha=0.7,qu=c(0.1,0.95), threshold=0.2)

par.true <- c(0.6,0.6,-1,0.4,-0.7,0.5)
pnames   <- c("int.1", "ar1.1", "int.2", "ar2.1", "ma1.1", "ma2.1")
names(par.true) <- pnames

par.ls  <- round(fitls$fit$coef,2)  # Least Squares
par.rob <- round(fitrob$fit$coef,2) # robust

rbind(par.true,par.ls,par.rob)

[Package tseriesTARMA version 0.5-1 Index]