Learn R Programming

lgarch (version 0.2)

lgarch: Estimate a log-GARCH model

Description

Fit a log-GARCH model by Gaussian Quasi Maximum Likelihood (QML) or Nonlinear Least Squares (NLS) via the ARMA representation, see Sucarrat, Gronneberg and Escribano (2013). Zero-values on y are treated as missing values, as suggested in Sucarrat and Escribano (2013). Estimation is via the nlminb function, whereas a numerical estimate of the Hessian is obtained with optimHess for the computation of the variance-covariance matrix

Usage

lgarch(y, arch = 1, garch = 1, xreg = NULL, initial.values = NULL,
  backcast.values = list(lny2 = NULL, lnz2 = NULL, xreg = NULL), lower = NULL,
  upper = NULL, nlminb.control = list(), vcov = TRUE, method="ml",
  objective.penalty = NULL, solve.tol = .Machine$double.eps, c.code = TRUE)

Arguments

y
numeric vector, typically a financial return series or the error of a regression
arch
the arch order (i.e. an integer equal to or greater than 0). The default is 1. NOTE: in the current version the order canno be greater than 1
garch
the garch order (i.e. an integer equal to or greater than 0). The default is 1. NOTE: in the current version the order canno be greater than 1
xreg
a vector or a matrix with the conditioning variables
initial.values
NULL (default) or a vector with the initial values
backcast.values
initial values used for the recursions during optimisation. If the values are NULL, then the values are automatically chosen
lower
NULL (default) or a vector with the lower bounds of the parameter space. If NULL, then the values are automatically chosen
upper
NULL (default) or a vector with the upper bounds of the parameter space. If NULL, then the values are automatically chosen
nlminb.control
list of control options passed on to the nlminb optimiser
vcov
logical. If TRUE (default), then the variance-covariance matrix is computed. This is needed for subsequent extraction of the variance-covariance matrix. The FALSE options makes estimation faster, but the variance-covariance matrix cannot be extracted subs
method
Estimation method, either "ml" (default), i.e. Gaussian QML, or "ls", i.e. Nonlinear Least Squares
objective.penalty
NULL (default) or a numeric value. If NULL, then the log-likelihood value associated with the initial values is used. Sometimes estimation can result in NA and/or +/-Inf values, which are fatal for simulations. The value objective.penalty is the value ret
solve.tol
The function solve is used for the inversion of the Hessian in computing the variance-covariance matrix. The value solve.tol is passed on to solve and is the tol
c.code
logical. TRUE (default) is (much) faster since it makes use of compiled C-code

Value

  • A list of class 'lgarch'

References

Sucarrat and Escribano (2013), 'Unbiased QML Estimation of Log-GARCH Models in the Presence of Zero Returns', MPRA Paper 50699: http://mpra.ub.uni-muenchen.de/50699/ Sucarrat, Gronneberg and Escribano (2013), 'Estimation and Inference in Univariate and Multivariate Log-GARCH-X Models When the Conditional Density is Unknown', MPRA Paper 49344: http://mpra.ub.uni-muenchen.de/49344/

See Also

lgarchSim, coef.lgarch, fitted.lgarch, logLik.lgarch, print.lgarch, residuals.lgarch and vcov.lgarch

Examples

Run this code
##simulate 500 observations w/default parameter values:
set.seed(123)
y <- lgarchSim(500)

##estimate a log-garch(1,1):
mymod <- lgarch(y)

##print results:
print(mymod)

##extract coefficients:
coef(mymod)

##extract Gaussian log-likelihood (zeros excluded) of the log-garch model:
logLik(mymod)

##extract Gaussian log-likelihood (zeros excluded) of the arma representation:
logLik(mymod, arma=TRUE)

##extract variance-covariance matrix:
vcov(mymod)

##extract and plot the fitted conditional standard deviation:
sigmahat <- fitted(mymod)
plot(sigmahat)

##extract and plot standardised residuals:
zhat <- residuals(mymod)
plot(zhat)

##extract and plot all the fitted series:
myhat <- fitted(mymod, verbose=TRUE)
plot(myhat)

Run the code above in your browser using DataLab