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 |
tar2.lags |
Vector of AR lags for the upper regime. It can be a subset of |
tma1.lags |
Vector of MA lags for the lower regime. It can be a subset of |
tma2.lags |
Vector of MA lags for the upper regime. It can be a subset of |
estimate.thd |
Logical. If |
threshold |
Threshold parameter. Used only if |
d |
Delay parameter. Defaults to |
pa |
Real number in |
pb |
Real number in |
method |
Optimization/fitting method, can be one of |
alpha |
Real positive number. Tuning parameter for robust estimation. Only used if |
qu |
Quantiles for initial trimmed estimation. Tuning parameter for robust estimation. Only used if |
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:
-
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. -
alpha
- Tuning parameter for robust estimation. -
qu
- Tuning parameter for robust estimation. -
call
- The matched call. -
convergence
- Convergence code from the optimization routine.
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 packagelbfgsb3c
. Improved version of the L-BFGS-B inoptim
.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 parametersalpha
andqu
. 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
-
Giannerini S, Goracci G (2021). “Estimating and Forecasting with TARMA models.” University of Bologna.
-
Chan K, Goracci G (2019). “On the Ergodicity of First-Order Threshold Autoregressive Moving-Average Processes.” J. Time Series Anal., 40(2), 256-264.
-
Goracci G, Ferrari D, Giannerini S, Ravazzolo F (2023). “Robust estimation for Threshold Autoregressive Moving-Average models.” Free University of Bolzano, University of Bologna. doi:10.48550/ARXIV.2211.08205.
-
Ferrari D, La-Vecchia D (2011). “On robust estimation via pseudo-additive information.” Biometrika, 99(1), 238-244. ISSN 0006-3444, doi:10.1093/biomet/asr061.
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)