TARMA.fit | R Documentation |
Implements a Least Squares fit of full subset two-regime TARMA(p1,p2,q1,q2)
model to a univariate time series
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),
...
)
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 |
threshold |
Threshold parameter. 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 |
innov |
Innovation density for robust estimation. can be one of |
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. |
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.
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
.
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.
Simone Giannerini, simone.giannerini@uniud.it
Greta Goracci, greta.goracci@unibz.it
Gia21tseriesTARMA
Cha19tseriesTARMA
Gor23btseriesTARMA
Fer12tseriesTARMA
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.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.