TARMA.fit: TARMA Modelling of Time Series

View source: R/TARMA.fit.R

TARMA.fitR Documentation

TARMA Modelling of Time Series

Description

\loadmathjax

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:
\mjdeqnX_t = \left\lbrace \beginarrayll \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 & \mathrmif X_t-d \leq \mathrmthd \\\ &\\\ \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 & \mathrmif X_t-d > \mathrmthd \endarray \right. X[t] = \phi[1,0] + \Sigma_i in I_1 \phi[1,i] X[t-i] + \Sigma_j in M_1 \theta[1,j] \epsilon[t-j] + \epsilon[t] – if X[t-d] <= thd \phi[2,0] + \Sigma_i in I_2 \phi[2,i] X[t-i] + \Sigma_j in M_2 \theta[2,j] \epsilon[t-j] + \epsilon[t] – if X[t-d] > thd where \mjeqn\phi_1,i\phi[1,i] and \mjeqn\phi_2,i\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. \mjeqn\theta_1,j\theta[1,j] and \mjeqn\theta_2,j\theta[2,j] are the TMA parameters and \mjeqnj \in M_1, M_2j 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:

  • fit - List with the following components

    • coef - Vector of estimated parameters which can be extracted by the coef method.

    • sigma2 - Estimated innovation variance.

    • var.coef - The estimated variance matrix of the coefficients coef, which can be extracted by the vcov method

    • residuals - Vector of residuals from the fit.

    • nobs - Effective sample size used for fitting the model.

  • se - Standard errors for the parameters. Note that they are computed conditionally upon the threshold so that they are generally smaller than the true ones.

  • thd - Estimated threshold.

  • aic - Value of the AIC for the minimised least squares criterion over the threshold range.

  • bic - Value of the BIC for the minimised least squares criterion over the threshold range.

  • rss - Minimised value of the target function. Coincides with the residual sum of squares for ordinary least squares estimation.

  • rss.v - Vector of values of the rss over the threshold range.

  • thd.range - Vector of values of the threshold range.

  • d - Delay parameter.

  • phi1 - Estimated AR parameters for the lower regime.

  • phi2 - Estimated AR parameters for the upper regime.

  • theta1 - Estimated MA parameters for the lower regime.

  • theta2 - Estimated MA parameters for the upper regime.

  • tlag1 - TAR lags for the lower regime

  • tlag2 - TAR lags for the upper regime

  • mlag1 - TMA lags for the lower regime

  • mlag2 - TMA lags for the upper regime

  • method - Estimation method.

  • innov - Innovation density model.

  • alpha - Tuning parameter for robust estimation.

  • qu - Tuning parameter for robust estimation.

  • call - The matched call.

  • convergence - Convergence code from the optimization routine.

  • innovpar - Parameter vector for the innovation density. Defaults to NULL.

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 \insertCiteFer12tseriesTARMA. 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

  • \insertRef

    Gia21tseriesTARMA

  • \insertRef

    Cha19tseriesTARMA

  • \insertRef

    Gor23btseriesTARMA

  • \insertRef

    Fer12tseriesTARMA

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)

tseriesTARMA documentation built on Oct. 8, 2024, 5:11 p.m.