Title: | Time Varying GARCH Modelling |
---|---|
Description: | Simulation, estimation and inference for univariate and multivariate TV(s)-GARCH(p,q,r)-X models, where s indicates the number and shape of the transition functions, p is the ARCH order, q is the GARCH order, r is the asymmetry order, and 'X' indicates that covariates can be included; see Campos-Martins and Sucarrat (2024) <doi:10.18637/jss.v108.i09>. In the multivariate case, variances are estimated equation by equation and dynamic conditional correlations are allowed. The TV long-term component of the variance as in the multiplicative TV-GARCH model of Amado and Terasvirta (2013) <doi:10.1016/j.jeconom.2013.03.006> introduces non-stationarity whereas the GARCH-X short-term component describes conditional heteroscedasticity. Maximisation by parts leads to consistent and asymptotically normal estimates. |
Authors: | Susana Campos-Martins [aut, cre], Genaro Sucarrat [ctb] |
Maintainer: | Susana Campos-Martins <[email protected]> |
License: | GPL (>= 2) |
Version: | 2.4.2 |
Built: | 2025-03-09 03:25:15 UTC |
Source: | https://github.com/cran/tvgarch |
Simulation, estimation and inference for univariate and multivariate TV(s)-GARCH(p,q,r)-X models, where s indicates the number and shape of the transition functions, p is the ARCH order, q is the GARCH order, r is the asymmetry order, and 'X' indicates that covariates can be included; see Campos-Martins and Sucarrat (2024) <doi:10.18637/jss.v108.i09>. The TV long-term component, as in the multiplicative TV-GARCH model of Amado and Terasvirta (2013) <doi:10.1016/j.jeconom.2013.03.006>, introduces non-stationarity whereas the GARCH-X short-term component describes conditional heteroscedasticity. Maximisation by parts leads to consistent and asymptotically normal estimates. In the multivariate case, conditional variances are estimated equation by equation and dynamic conditional correlations are allowed.
Package: | tvgarch |
Type: | Package |
Version: | 2.4.2 |
Date: | 2024-04-03 |
License: | GPL>=2 |
Susana Campos-Martins, https://sites.google.com/site/susanacamposmartins
Maintainer: Susana Campos-Martins
Contributor: Genaro Sucarrat
Cristina Amado and Timo Terasvirta (2013) Modelling volatility by variance decomposition, Journal of Econometrics 175, 142-153.
Susana Campos-Martins and Genaro Sucarrat (2024) Modeling Nonstationary Financial Volatility with the R Package tvgarch, Journal of Statistical Software 108, 1-38.
tvgarchTest
,
tvgarch
,
mtvgarch
,
tvgarchSim
,
mtvgarchSim
set.seed(123) ## Simulate from a TV(1)-GARCH(1,1) model (default): ySim <- tvgarchSim(n = 1500) ## Test a GARCH(1,1) model against a TV(1)-GARCH(1,1) model: yTest <- tvgarchTest(y = ySim) yTest ## Estimate a TV(1)-GARCH(1,1) model (default): yEst <- tvgarch(y = ySim) yEst
set.seed(123) ## Simulate from a TV(1)-GARCH(1,1) model (default): ySim <- tvgarchSim(n = 1500) ## Test a GARCH(1,1) model against a TV(1)-GARCH(1,1) model: yTest <- tvgarchTest(y = ySim) yTest ## Estimate a TV(1)-GARCH(1,1) model (default): yEst <- tvgarch(y = ySim) yEst
Extraction functions for objects of class 'mtvgarch'.
## S3 method for class 'mtvgarch' coef(object, spec = c("tvgarch", "garch", "tv", "cc"), ...) ## S3 method for class 'mtvgarch' fitted(object, spec = c("tvgarch", "garch", "tv", "cc"), as.zoo = TRUE, ...) ## S3 method for class 'mtvgarch' logLik(object, ...) ## S3 method for class 'mtvgarch' nobs(object, ...) ## S3 method for class 'mtvgarch' plot(x, spec = c("tvgarch", "garch", "tv"), ...) ## S3 method for class 'mtvgarch' predict(object, n.ahead = 10, newxtv = NULL, newxreg = NULL, newindex = NULL, n.sim = 5000, as.zoo = TRUE, verbose = FALSE, ...) ## S3 method for class 'mtvgarch' print(x, ...) ## S3 method for class 'mtvgarch' quantile(x, probs = 0.025, type = 7, as.zoo = TRUE, ...) ## S3 method for class 'mtvgarch' residuals(object, as.zoo = TRUE, ...) ## S3 method for class 'mtvgarch' summary(object, ...) ## S3 method for class 'mtvgarch' toLatex(object, digits = 4, ...) ## S3 method for class 'mtvgarch' vcov(object, spec = c("tvgarch", "garch", "tv", "cc"), ...)
## S3 method for class 'mtvgarch' coef(object, spec = c("tvgarch", "garch", "tv", "cc"), ...) ## S3 method for class 'mtvgarch' fitted(object, spec = c("tvgarch", "garch", "tv", "cc"), as.zoo = TRUE, ...) ## S3 method for class 'mtvgarch' logLik(object, ...) ## S3 method for class 'mtvgarch' nobs(object, ...) ## S3 method for class 'mtvgarch' plot(x, spec = c("tvgarch", "garch", "tv"), ...) ## S3 method for class 'mtvgarch' predict(object, n.ahead = 10, newxtv = NULL, newxreg = NULL, newindex = NULL, n.sim = 5000, as.zoo = TRUE, verbose = FALSE, ...) ## S3 method for class 'mtvgarch' print(x, ...) ## S3 method for class 'mtvgarch' quantile(x, probs = 0.025, type = 7, as.zoo = TRUE, ...) ## S3 method for class 'mtvgarch' residuals(object, as.zoo = TRUE, ...) ## S3 method for class 'mtvgarch' summary(object, ...) ## S3 method for class 'mtvgarch' toLatex(object, digits = 4, ...) ## S3 method for class 'mtvgarch' vcov(object, spec = c("tvgarch", "garch", "tv", "cc"), ...)
object |
an object of class 'mtvgarch'. |
spec |
specifies whether the function should extract specific results. If "tv", extracts results for the TV component and if "garch" extracts results for the GARCH-X component of TV-GARCH-X model. If "tvgarch", extracts results for TV-GARCH-X model. Only relevant for TV-GARCH-X models. Otherwise, extracts results for GARCH-X models. If "cc", extracts results concerning the conditional correlations. "cc" is not valid in plot.mtvgarch(). |
x |
an object of class 'mtvgarch'. |
as.zoo |
logical. If |
n.ahead |
integer that determines how many steps ahead predictions should be generated. |
newxtv |
|
newxreg |
vector or matrix with the out-of-sample regressor values. |
newindex |
|
n.sim |
integer, the number of simulations. |
verbose |
logical. If |
probs |
vector of probabilities. |
type |
integer that determines the algorithm used to compute the
quantile, see |
digits |
integer, the number of digits in the printed LaTeX code. |
... |
additional arguments. |
coef: |
parameter estimates. |
fitted: |
fitted conditional variances and correlations. |
logLik: |
optimised log-likelihood (normal density) values. |
nobs: |
number of observations used in the estimation. |
plot: |
plots of the fitted conditional volatilities. |
predict: |
variance predictions. Column order differs when spillovers are allowed. |
print: |
print of the estimation results. |
quantile: |
fitted quantiles, i.e. the conditional standard deviation times the empirical quantile of the standardised innovations. |
residuals: |
volatility standardised residuals. |
summary: |
summary of estimation results. |
vcov: |
coefficient variance-covariance matrices. |
Susana Campos-Martins
Cristina Amado and Timo Terasvirta (2013) Modelling volatility by variance decomposition, Journal of Econometrics 175, 142-153.
Christian Francq and Jean-Michel Zakoian (2016) Estimating multivariate volatility models equation by equation, J. R. Stat. Soc. Ser. B Stat. Methodol 78, 613-635.
Susana Campos-Martins and Genaro Sucarrat (2024) Modeling Nonstationary Financial Volatility with the R Package tvgarch, Journal of Statistical Software 108, 1-38.
mtvgarch
,
mtvgarchSim
,
tvgarch
,
garchx
,
zoo
set.seed(12345) ## Simulate from a bivariate CCC-TV(1)-GARCH(1,1) model (default): mySim <- mtvgarchSim(n = 1500) ## Estimate a CCC-TV(1)-GARCH(1,1) model: myEst <- mtvgarch(y = mySim) ## Print estimation results: print(myEst) ## Extract and store conditional variances: sigma2Est <- fitted(myEst) ## Plot: plot(myEst) ## Generate predictions: predict(myEst)
set.seed(12345) ## Simulate from a bivariate CCC-TV(1)-GARCH(1,1) model (default): mySim <- mtvgarchSim(n = 1500) ## Estimate a CCC-TV(1)-GARCH(1,1) model: myEst <- mtvgarch(y = mySim) ## Print estimation results: print(myEst) ## Extract and store conditional variances: sigma2Est <- fitted(myEst) ## Plot: plot(myEst) ## Generate predictions: predict(myEst)
Extraction functions (S3 methods) for objects of class 'tvgarch'.
## S3 method for class 'tvgarch' coef(object, spec = c("tvgarch", "garch", "tv"), ...) ## S3 method for class 'tvgarch' fitted(object, spec = c("tvgarch", "garch", "tv"), as.zoo = TRUE, ...) ## S3 method for class 'tvgarch' logLik(object, ...) ## S3 method for class 'tvgarch' nobs(object, ...) ## S3 method for class 'tvgarch' plot(x, spec = c("tvgarch", "garch", "tv"), ...) ## S3 method for class 'tvgarch' predict(object, n.ahead = 10, newxtv = NULL, newxreg = NULL, newindex = NULL, n.sim = 5000, as.zoo = TRUE, verbose = FALSE, ...) ## S3 method for class 'tvgarch' print(x, ...) ## S3 method for class 'tvgarch' quantile(x, probs = 0.025, names = TRUE, type = 7, as.zoo = TRUE, ...) ## S3 method for class 'tvgarch' residuals(object, as.zoo = TRUE, ...) ## S3 method for class 'tvgarch' summary(object, ...) ## S3 method for class 'tvgarch' toLatex(object, digits = 4, ...) ## S3 method for class 'tvgarch' vcov(object, spec = c("tvgarch", "garch", "tv"), ...)
## S3 method for class 'tvgarch' coef(object, spec = c("tvgarch", "garch", "tv"), ...) ## S3 method for class 'tvgarch' fitted(object, spec = c("tvgarch", "garch", "tv"), as.zoo = TRUE, ...) ## S3 method for class 'tvgarch' logLik(object, ...) ## S3 method for class 'tvgarch' nobs(object, ...) ## S3 method for class 'tvgarch' plot(x, spec = c("tvgarch", "garch", "tv"), ...) ## S3 method for class 'tvgarch' predict(object, n.ahead = 10, newxtv = NULL, newxreg = NULL, newindex = NULL, n.sim = 5000, as.zoo = TRUE, verbose = FALSE, ...) ## S3 method for class 'tvgarch' print(x, ...) ## S3 method for class 'tvgarch' quantile(x, probs = 0.025, names = TRUE, type = 7, as.zoo = TRUE, ...) ## S3 method for class 'tvgarch' residuals(object, as.zoo = TRUE, ...) ## S3 method for class 'tvgarch' summary(object, ...) ## S3 method for class 'tvgarch' toLatex(object, digits = 4, ...) ## S3 method for class 'tvgarch' vcov(object, spec = c("tvgarch", "garch", "tv"), ...)
object |
an object of class 'tvgarch'. |
spec |
specifies whether the function should extract specific results. If "tv", extracts results for the TV component and if "garch" extracts results for the GARCH-X component of TV-GARCH-X model. If "tvgarch", extracts results for TV-GARCH-X model. Only relevant for TV-GARCH-X models. Otherwise, extracts results for GARCH-X models. |
x |
an object of class 'tvgarch'. |
as.zoo |
logical. If |
n.ahead |
integer that determines how many steps ahead predictions should be generated. |
newxtv |
|
newxreg |
vector or matrix with the out-of-sample regressor values. |
newindex |
a |
n.sim |
integer, the number of simulations. |
verbose |
logical. If |
probs |
vector of probabilities. |
names |
logical, whether to return names or not. |
type |
integer that determines the algorithm used to compute the
quantile, see |
digits |
integer, the number of digits in the printed LaTeX code. |
... |
additional arguments. |
coef: |
parameter estimates. |
fitted: |
fitted conditional variance. |
logLik: |
optimised log-likelihood (normal density) value. |
nobs: |
the number of observations used in the estimation. |
plot: |
plot of the fitted conditional volatility. |
predict: |
variance predictions. |
print: |
print of the estimation results. |
quantile: |
fitted quantiles, i.e. the conditional standard deviation times the empirical quantile of the standardised innovations. |
residuals: |
volatility standardised residuals. |
summary: |
summary of estimation results. |
vcov: |
coefficient variance-covariance matrix. |
Susana Campos-Martins
Cristina Amado and Timo Terasvirta (2013) Modelling volatility by variance decomposition, Journal of Econometrics 175, 142-153.
Cristina Amado and Timo Terasvirta (2014) Modelling changes in the unconditional variance of long stock return series, Journal of Empirical Finance 25, 15-35.
Susana Campos-Martins and Genaro Sucarrat (2024) Modeling Nonstationary Financial Volatility with the R Package tvgarch, Journal of Statistical Software 108, 1-38.
tvgarchTest
,
tvgarch
,
tvgarchSim
,
zoo
set.seed(123) ## Simulate from a TV(1)-GARCH(1,1) model (default): ySim <- tvgarchSim(n = 1500) ## Estimate a TV(1)-GARCH(1,1) model: yEst <- tvgarch(y = ySim) ## Print estimation results: print(yEst) ## Extract and store conditional variances: sigma2Est <- fitted(yEst) ## Plot: plot(yEst) ## Generate predictions: predict(yEst)
set.seed(123) ## Simulate from a TV(1)-GARCH(1,1) model (default): ySim <- tvgarchSim(n = 1500) ## Estimate a TV(1)-GARCH(1,1) model: yEst <- tvgarch(y = ySim) ## Print estimation results: print(yEst) ## Extract and store conditional variances: sigma2Est <- fitted(yEst) ## Plot: plot(yEst) ## Generate predictions: predict(yEst)
Extraction functions for objects of class 'tvgarchTest'. Results from the estimation of the model under the null hypothesis, i.e., a GARCH(1,1) model, can be extracted similar to an object of class 'tvgarch' with the exception of functions print.tvgarchTest() and summary.tvgarchTest().
## S3 method for class 'tvgarchTest' coef(object, ...) ## S3 method for class 'tvgarchTest' fitted(object, as.zoo = TRUE, ...) ## S3 method for class 'tvgarchTest' logLik(object, ...) ## S3 method for class 'tvgarchTest' nobs(object, ...) ## S3 method for class 'tvgarchTest' plot(x, ...) ## S3 method for class 'tvgarchTest' predict(object, n.ahead = 10, newxreg = NULL, newindex = NULL, n.sim = 5000, as.zoo = TRUE, verbose = FALSE, ...) ## S3 method for class 'tvgarchTest' print(x, ...) ## S3 method for class 'tvgarchTest' quantile(x, probs = 0.025, names = TRUE, type = 7, as.zoo = TRUE, ...) ## S3 method for class 'tvgarchTest' residuals(object, as.zoo = TRUE, ...) ## S3 method for class 'tvgarchTest' summary(object, ...) ## S3 method for class 'tvgarchTest' toLatex(object, digits = 4, ...) ## S3 method for class 'tvgarchTest' vcov(object, ...)
## S3 method for class 'tvgarchTest' coef(object, ...) ## S3 method for class 'tvgarchTest' fitted(object, as.zoo = TRUE, ...) ## S3 method for class 'tvgarchTest' logLik(object, ...) ## S3 method for class 'tvgarchTest' nobs(object, ...) ## S3 method for class 'tvgarchTest' plot(x, ...) ## S3 method for class 'tvgarchTest' predict(object, n.ahead = 10, newxreg = NULL, newindex = NULL, n.sim = 5000, as.zoo = TRUE, verbose = FALSE, ...) ## S3 method for class 'tvgarchTest' print(x, ...) ## S3 method for class 'tvgarchTest' quantile(x, probs = 0.025, names = TRUE, type = 7, as.zoo = TRUE, ...) ## S3 method for class 'tvgarchTest' residuals(object, as.zoo = TRUE, ...) ## S3 method for class 'tvgarchTest' summary(object, ...) ## S3 method for class 'tvgarchTest' toLatex(object, digits = 4, ...) ## S3 method for class 'tvgarchTest' vcov(object, ...)
object |
an object of class 'tvgarchTest'. |
x |
an object of class 'tvgarchTest'. |
as.zoo |
logical. If |
n.ahead |
integer that determines how many steps ahead predictions should be generated. |
newxreg |
vector or matrix with the out-of-sample regressor values. |
newindex |
a |
n.sim |
integer, the number of simulations. |
verbose |
logical. If |
probs |
vector of probabilities. |
names |
logical, whether to return names or not. |
type |
integer that determines the algorithm used to compute the
quantile, see |
digits |
integer, the number of digits in the printed LaTeX code. |
... |
additional arguments. |
coef: |
parameter estimates. |
fitted: |
fitted conditional variance. |
logLik: |
optimised log-likelihood (normal density) value. |
nobs: |
the number of observations used in the estimation. |
plot: |
plot of the fitted conditional volatility. |
predict: |
variance predictions. |
quantile: |
fitted quantiles, i.e. the conditional standard deviation times the empirical quantile of the standardised innovations. |
residuals: |
volatility standardised residuals. |
summary: |
summary of test result. |
vcov: |
coefficient variance-covariance matrix. |
Susana Campos-Martins
Cristina Amado and Timo Terasvirta (2013) Modelling volatility by variance decomposition, Journal of Econometrics 175, 142-153.
Cristina Amado and Timo Terasvirta (2014) Modelling changes in the unconditional variance of long stock return series, Journal of Empirical Finance 25, 15-35.
Susana Campos-Martins and Genaro Sucarrat (2024) Modeling Nonstationary Financial Volatility with the R Package tvgarch, Journal of Statistical Software 108, 1-38.
tvgarchTest
,
tvgarchSim
,
tvgarch
,
zoo
set.seed(123) ## Simulate from a TV(1)-GARCH(1,1) model (default): ySim <- tvgarchSim(n = 1500) ## Test a GARCH(1,1) model against a TV(1)-GARCH(1,1) model: yTest <- tvgarchTest(y = ySim) ## Print test and estimation results: print(yTest) ## Estimated number of locations summary(yTest) ## Extract and plot estimation results for GARCH(1,1) used in the test: sigma2Test <- fitted(yTest) plot(yTest) ## Estimate a TV(s)-GARCH(1,1) model: s <- summary(yTest) yEst <- tvgarch(y = ySim, order.g = s)
set.seed(123) ## Simulate from a TV(1)-GARCH(1,1) model (default): ySim <- tvgarchSim(n = 1500) ## Test a GARCH(1,1) model against a TV(1)-GARCH(1,1) model: yTest <- tvgarchTest(y = ySim) ## Print test and estimation results: print(yTest) ## Estimated number of locations summary(yTest) ## Extract and plot estimation results for GARCH(1,1) used in the test: sigma2Test <- fitted(yTest) plot(yTest) ## Estimate a TV(s)-GARCH(1,1) model: s <- summary(yTest) yEst <- tvgarch(y = ySim, order.g = s)
combos
produces a matrix of combinations of 1 to n variables in ascending order. combinations
enumerates the possible combinations of a specified size
from the elements of a vector.
combos(n) combinations(n, r, v = 1:n, set = TRUE, repeats.allowed = FALSE)
combos(n) combinations(n, r, v = 1:n, set = TRUE, repeats.allowed = FALSE)
n |
an integer: the number of variables ( |
r |
size of the target vectors |
v |
source vector. Defaults to |
set |
logical flag indicating whether duplicates should be removed from
the source vector |
repeats.allowed |
logical flag indicating whether the constructed
vectors may include duplicated values. Defaults to |
combos
lists hierarchy of all possible combinations of n variables in ascending
order, starting with 1 variable, then all combinations of 2 variables,
and so on until the one combination with all n variables. It is used by function
tvgarch
to constrain the size coefficients when s > 1 required to guarantee the variance is positive for all t.
When using combinations
, the number of combinations increases rapidly with
n
and r
! To use values of n
above about 45, you will need to increase R's
recursion limit. See the expression
argument to the options
command for details
on how to do this. The source code is adapted from the function with the same name
in the package gtools. There, it is stated that the code of the function is
from an email by Brian D Ripley <[email protected]> to r-help dated Tue,
14 Dec 1999 11:14:04 +0000 (GMT) in response to Alex Ahgarin [email protected].
Original version was named "subsets" and was Written by Bill Venables
combos: |
a matrix with zeroes in empty elements and 1 in all full elements. |
combinations: |
a matrix where each row contains a vector of length
|
combos
by Chris Walsh [email protected], with modifications by Susana
Campos-Martins. Original versions of combinations
by Bill Venables
[email protected]. Extended to handle repeats.allowed
by Gregory R. Warnes [email protected].
Venables, Bill. "Programmers Note", R-News, Vol 1/1, Jan. 2001. https://cran.r-project.org/doc/Rnews/
combos(3) combinations(3,2,letters[1:3]) combinations(3,2,letters[1:3],repeats=TRUE)
combos(3) combinations(3,2,letters[1:3]) combinations(3,2,letters[1:3],repeats=TRUE)
Auxiliary functions used in the estimation of the multivariate TV(s)-GARCH(p,q,r)-X model. Not intended for the average user.
dccObj(par.dcc, z, sigma2, flag)
dccObj(par.dcc, z, sigma2, flag)
par.dcc |
numeric |
z |
|
sigma2 |
|
flag |
|
The values of the objective function or fitted dynamic conditional correlations.
Susana Campos-Martins
Susana Campos-Martins and Genaro Sucarrat (2024) Modeling Nonstationary Financial Volatility with the R Package tvgarch, Journal of Statistical Software 108, 1-38.
Robert F. Engle (2002) Dynamic conditional correlation: A simple class of multivariate generalized autoregressive conditional heteroskedasticity models, Journal of Business and Economic Statistics 20, 339-350.
mtvgarch
, fitted.mtvgarch
, residuals.mtvgarch
Equation by equation estimation of a multivariate multiplicative TV-GARCH-X model with dnamic conditional correlations. For each variance equation, the long-term or unconditional component (TV) and the short-term or conditional variance component (GARCH-X) are estimated separately using maximization by parts, where the iterative algorithm proceeds until convergence. Conditional on the variance estimates, the dynamic conditional correlations are estimated by maximum likelihood.
mtvgarch(y, order.g = c(1, 1), order.h = NULL, order.x = NULL, initial.values = list(), xtv = NULL, xreg = NULL, opt = 2, upper.speed = NULL, tvgarch = FALSE, dcc = FALSE, turbo = TRUE, trace = FALSE)
mtvgarch(y, order.g = c(1, 1), order.h = NULL, order.x = NULL, initial.values = list(), xtv = NULL, xreg = NULL, opt = 2, upper.speed = NULL, tvgarch = FALSE, dcc = FALSE, turbo = TRUE, trace = FALSE)
y |
numeric matrix, time series or |
order.g |
integer matrix with each row indicating the order.g for each series; number of locations in each transition function of the TV components. |
order.h |
integer matrix with each row indicating the order.h for each
series; the first column controls the GARCH order, the second the ARCH order and
the third the asymmetry order of the GARCH-X components. If |
order.x |
|
initial.values |
a list containing the initial parameter values passed on
to the optimisation routines (constrOptim for the TV component and
nlminb for the GARCH-X component). If list(), the default, then the
values are chosen automatically. TV component: |
xtv |
|
xreg |
numeric vector, time series or zoo object to include as covariates in the GARCH-X component. |
opt |
integer indicating whether the speed parameter in the TV component should be scaled. If 0, no scaling; if 1, speed/sd(xtv); if 2, exp(speed). |
upper.speed |
|
tvgarch |
|
dcc |
logical. If |
turbo |
logical. If |
trace |
logical. If |
An object of class 'mtvgarch'.
Susana Campos-Martins
Cristina Amado and Timo Terasvirta (2013) Modelling volatility by variance decomposition, Journal of Econometrics 175, 142-153.
Susana Campos-Martins and Genaro Sucarrat (2024) Modeling Nonstationary Financial Volatility with the R Package tvgarch, Journal of Statistical Software 108, 1-38.
Christian Francq and Jean-Michel Zakoian (2016) Estimating multivariate volatility models equation by equation, J. R. Stat. Soc. Ser. B Stat. Methodol 78, 613-635.
Robert F. Engle (2002) Dynamic conditional correlation: A simple class of multivariate generalized autoregressive conditional heteroskedasticity models, Journal of Business and Economic Statistics 20, 339-350.
tvgarch
,
garchx
,
nlminb
,
constrOptim
set.seed(12345) ## Simulate from a bivariate CCC-TV(1)-GARCH(1,1) model (default): mySim <- mtvgarchSim(n = 1000) ## Estimate a CCC-TV(1)-GARCH(1,1) model (default): myEst <- mtvgarch(y = mySim) ## Print estimation results: print(myEst) ## Extract coefficients: coef(myEst) ## Plot conditional volatilities: plot(myEst) ## Generate predictions: predict(myEst)
set.seed(12345) ## Simulate from a bivariate CCC-TV(1)-GARCH(1,1) model (default): mySim <- mtvgarchSim(n = 1000) ## Estimate a CCC-TV(1)-GARCH(1,1) model (default): myEst <- mtvgarch(y = mySim) ## Print estimation results: print(myEst) ## Extract coefficients: coef(myEst) ## Plot conditional volatilities: plot(myEst) ## Generate predictions: predict(myEst)
Simulate from a multivariate multiplicative TV(s)-GARCH(p,q,r)-X model.
mtvgarchSim(n, m = 2, order.g = c(1,1), order.h = c(1,1,0, 1,1,0), order.x = NULL, intercept.g = c(1.2,1), size = c(3,5), speed = c(10,25), location = c(0.5,0.8), intercept.h = c(0.2,0.3), arch = c(0.10,0.05), garch = c(0.80,0.90), asym = NULL, xtv = NULL, xreg = NULL, par.xreg = NULL, R = c(1,0.6,0.6,1), dcc = FALSE, par.dcc = NULL, opt = 0, as.zoo = TRUE, verbose = FALSE, innovations = NULL)
mtvgarchSim(n, m = 2, order.g = c(1,1), order.h = c(1,1,0, 1,1,0), order.x = NULL, intercept.g = c(1.2,1), size = c(3,5), speed = c(10,25), location = c(0.5,0.8), intercept.h = c(0.2,0.3), arch = c(0.10,0.05), garch = c(0.80,0.90), asym = NULL, xtv = NULL, xreg = NULL, par.xreg = NULL, R = c(1,0.6,0.6,1), dcc = FALSE, par.dcc = NULL, opt = 0, as.zoo = TRUE, verbose = FALSE, innovations = NULL)
n |
integer. |
m |
integer indicating the dimenson of the multivariate series. |
order.g |
integer matrix with each row indicating the number of locations in each transition function of the TV components; m rows and max.s columns. |
order.h |
integer matrix with each row indicating the |
order.x |
|
intercept.g |
|
size |
|
speed |
|
location |
|
intercept.h |
numeric matrix. |
arch |
|
garch |
|
asym |
|
xtv |
|
xreg |
numeric vector, matrix, time series or zoo object to include as covariates in the GARCH-X component. |
par.xreg |
|
R |
matrix of (constant) conditional correlations. |
dcc |
logical. If |
par.dcc |
numeric vector containing the ARCH- and GARCH-type coefficients in the dynamic conditional correlations. |
opt |
integer indicating whether the speed parameter in the TV component should be scaled. If 0, no scaling; if 1, speed/sd(xtv); if 2, exp(speed). Only relevant for TV-GARCH models. |
as.zoo |
logical. If |
verbose |
logical, if |
innovations |
|
An object of class 'zoo' (if as.zoo = TRUE
), otherwise a matrix or a list
(if verbose = TRUE
), with the simulated values.
Susana Campos-Martins
mtvgarch
,
tvgarch
,
garchx
,
zoo
set.seed(12345) ## Simulate from a bivariate CCC-TV(1)-GARCH(1,1) model (default): mySim1 <- mtvgarchSim(n = 1500) ## Simulate from a bivariate CCC-TV(1)-GARCH(1,1)-X model ## (with volatility spillovers) mySim2 <- mtvgarchSim(n = 1500, order.x = c(0,1,1,0), par.xreg = c(0.03,0.04))
set.seed(12345) ## Simulate from a bivariate CCC-TV(1)-GARCH(1,1) model (default): mySim1 <- mtvgarchSim(n = 1500) ## Simulate from a bivariate CCC-TV(1)-GARCH(1,1)-X model ## (with volatility spillovers) mySim2 <- mtvgarchSim(n = 1500, order.x = c(0,1,1,0), par.xreg = c(0.03,0.04))
Quasi Maximum Likelihood (ML) estimation of a univariate multiplicative TV(s)-GARCH(p,q,r)-X model, where s indicates the number and the shape of the transition functions, r is the asymmetry order, p is the ARCH order, q is the GARCH order, and 'X' indicates that covariates can be included. Any transition variable, deterministic or stochastic, can be used to drive the transitions between the variance states. The TV long-term component introduces non-stationarity in the variance process, where the GARCH-X short-term component describes conditional heteroscedasticity. Maximization by parts leads to consistent and asymptotically normal estimates.
tvgarch(y, order.g = 1, order.h = c(1,1,0), xtv = NULL, xreg = NULL, initial.values = list(), opt = 2, upper.speed = NULL, tvgarch = FALSE, turbo = FALSE, trace = FALSE)
tvgarch(y, order.g = 1, order.h = c(1,1,0), xtv = NULL, xreg = NULL, initial.values = list(), opt = 2, upper.speed = NULL, tvgarch = FALSE, turbo = FALSE, trace = FALSE)
y |
numeric |
order.g |
|
order.h |
|
initial.values |
a list containing the initial parameter values passed on
to the optimisation routines (constrOptim for the TV component and
nlminb for the GARCH-X component). If list(), the default, then the
values are chosen automatically. TV component: |
xtv |
|
xreg |
numeric |
opt |
|
upper.speed |
|
tvgarch |
|
turbo |
|
trace |
|
An object of class 'tvgarch'.
Susana Campos-Martins
Cristina Amado and Timo Terasvirta (2013) Modelling volatility by variance decomposition, Journal of Econometrics 175, 142-153.
Cristina Amado and Timo Terasvirta (2014) Modelling changes in the unconditional variance of long stock return series, Journal of Empirical Finance 25, 15-35.
Susana Campos-Martins and Genaro Sucarrat (2024) Modeling Nonstationary Financial Volatility with the R Package tvgarch, Journal of Statistical Software 108, 1-38.
garchx
,
tvgarchSim
,
nlminb
,
constrOptim
set.seed(123) ## Simulate from a TV(1)-GARCH(1,1) model (default): ySim <- tvgarchSim(n = 1500) ## Estimate a TV(1)-GARCH(1,1) model: yEst <- tvgarch(y = ySim) ## Print estimation results: print(yEst) ## Extract coefficients: coef(yEst) ## Plot conditional volatilities: plot(yEst) ## Extract log-likelihood: logLik(yEst) ## Extract and store standardised residuals: etaEst <- residuals(yEst) ## Generate predictions: predict(yEst)
set.seed(123) ## Simulate from a TV(1)-GARCH(1,1) model (default): ySim <- tvgarchSim(n = 1500) ## Estimate a TV(1)-GARCH(1,1) model: yEst <- tvgarch(y = ySim) ## Print estimation results: print(yEst) ## Extract coefficients: coef(yEst) ## Plot conditional volatilities: plot(yEst) ## Extract log-likelihood: logLik(yEst) ## Extract and store standardised residuals: etaEst <- residuals(yEst) ## Generate predictions: predict(yEst)
Auxiliary functions used in the estimation of the univariate and multivariate TV(s)-GARCH(p,q,r)-X model. Not intended for the average user.
tv(speed, location, xtv = NULL, n = NULL, opt = 0, order.g = NULL, as.zoo = TRUE, verbose = FALSE) tvObj(par.g, fixed.par.g, xtv, opt, order.g, fixed.h, y, iter0, flag) garchObj(par.h, xreg, order.h, fixed.g, y, flag) tvgarchObj(par, fixed.par.g, y, order.g, xtv, opt, iter.fit.h, flag)
tv(speed, location, xtv = NULL, n = NULL, opt = 0, order.g = NULL, as.zoo = TRUE, verbose = FALSE) tvObj(par.g, fixed.par.g, xtv, opt, order.g, fixed.h, y, iter0, flag) garchObj(par.h, xreg, order.h, fixed.g, y, flag) tvgarchObj(par, fixed.par.g, y, order.g, xtv, opt, iter.fit.h, flag)
speed |
|
location |
|
xtv |
|
n |
|
opt |
|
order.g |
a scalar in |
as.zoo |
|
verbose |
|
par.g |
numeric |
fixed.par.g |
|
par |
|
fixed.h |
numeric |
y |
numeric |
iter0 |
|
flag |
|
par.h |
numeric |
order.h |
|
xreg |
numeric |
fixed.g |
numeric |
iter.fit.h |
a list of class 'garchx'. |
The values of the objective function or fitted variance components.
Susana Campos-Martins
tvgarch
, fitted.tvgarch
,
residuals.tvgarch
Simulate from a univariate multiplicative TV(s)-GARCH(p,q,r)-X model.
tvgarchSim(n, order.g = 1, order.h = c(1,1,0), intercept.g = 1.2, size = 5, speed = 25, location = 0.5, xtv = NULL, intercept.h = 0.2, arch = 0.1, garch = 0.8, asym = NULL, xreg = NULL, opt = 0, as.zoo = TRUE, verbose = FALSE, innovations = NULL)
tvgarchSim(n, order.g = 1, order.h = c(1,1,0), intercept.g = 1.2, size = 5, speed = 25, location = 0.5, xtv = NULL, intercept.h = 0.2, arch = 0.1, garch = 0.8, asym = NULL, xreg = NULL, opt = 0, as.zoo = TRUE, verbose = FALSE, innovations = NULL)
n |
|
order.g |
|
order.h |
|
intercept.g |
|
size |
|
speed |
|
location |
|
xtv |
|
opt |
|
intercept.h |
numeric with the value of the intercept in the GARCH-X component. |
arch |
|
garch |
|
asym |
|
xreg |
|
as.zoo |
|
verbose |
|
innovations |
|
An object of class 'zoo' (if as.zoo = TRUE
), otherwise a vector or a matrix
(if verbose = TRUE
), with the simulated values.
Susana Campos-Martins
set.seed(123) ## Simulate from a TV(1)-GARCH(1,1) model (default): ySim1 <- tvgarchSim(n = 1500) ## Simulate from a TV(2)-GARCH(1,1) model: ySim2 <- tvgarchSim(n = 1500, order.g = c(1,2), size = c(0.5,-0.4), speed = c(1.5,2), location = c(0.2, 0.5,0.8)) ## Simulate from a GARCH(1,1) model: ySim3 <- tvgarchSim(n = 1500, order.g = NULL) ## Simulate from a TV(1)-GARCH(1,1,1)-X model: ySim4 <- tvgarchSim(n = 1500, order.h = c(1,1,1), asym = 0.025, xreg = ySim3^2)
set.seed(123) ## Simulate from a TV(1)-GARCH(1,1) model (default): ySim1 <- tvgarchSim(n = 1500) ## Simulate from a TV(2)-GARCH(1,1) model: ySim2 <- tvgarchSim(n = 1500, order.g = c(1,2), size = c(0.5,-0.4), speed = c(1.5,2), location = c(0.2, 0.5,0.8)) ## Simulate from a GARCH(1,1) model: ySim3 <- tvgarchSim(n = 1500, order.g = NULL) ## Simulate from a TV(1)-GARCH(1,1,1)-X model: ySim4 <- tvgarchSim(n = 1500, order.h = c(1,1,1), asym = 0.025, xreg = ySim3^2)
Compute the non-robust and robust Lagrange-Multiplier (LM-)type test statistics for examining the null hypothesis of constant long-term variance, GARCH(1,1), against the alternative of a smoothly changing long-term component, TV-GARCH(1,1).
tvgarchTest(y, xtv = NULL, alpha = 0.05)
tvgarchTest(y, xtv = NULL, alpha = 0.05)
y |
numeric |
xtv |
|
alpha |
the significance level. |
An object of class 'tvgarchTest'.
Susana Campos-Martins
Cristina Amado and Timo Terasvirta (2017) Specification and testing of multiplicative time varying GARCH models with applications, Econometric Reviews 36:4, 421-446.
set.seed(12345) ## Simulate from a TV(1)-GARCH(1,1) model (default): ySim <- tvgarchSim(n = 1500) ## Test of a TV(1)-GARCH(1,1) model: yTest <- tvgarchTest(y = ySim) orderG1 <- summary(yTest) ## Estimate a TV(1)-GARCH(1,1) model: yEst <- tvgarch(y = ySim, order.g = orderG1)
set.seed(12345) ## Simulate from a TV(1)-GARCH(1,1) model (default): ySim <- tvgarchSim(n = 1500) ## Test of a TV(1)-GARCH(1,1) model: yTest <- tvgarchTest(y = ySim) orderG1 <- summary(yTest) ## Estimate a TV(1)-GARCH(1,1) model: yEst <- tvgarch(y = ySim, order.g = orderG1)