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),
  estimate.thd = TRUE,
  threshold,
  d = 1,
  pa = 0.25,
  pb = 0.75,
  method = c("L-BFGS-B", "solnp", "lbfgsb3c", "robust"),
  alpha = 0,
  qu = c(0.05, 0.95),
  optim.control = list(trace = 0),
  ...
)

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).

estimate.thd

Logical. If TRUE estimates the threshold over the threshold range specified by pa and pb.

threshold

Threshold parameter. Used only if estimate.thd = FALSE.

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".

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 "robust".

optim.control

List of control parameters for the optimization method.

...

Additional arguments for the optimization.

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 reweighted 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

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

Author(s)

Simone Giannerini, simone.giannerini@unibo.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, 
       estimate.thd=FALSE, threshold=0.2)
fit1

## ---------------------------------------------------------------------------
## Contaminating 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,
            estimate.thd=FALSE, 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),estimate.thd = FALSE, 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.3-4 Index]