ARCHModels.ARCHModelsModule

The ARCHModels package for Julia. For documentation, see https://s-broda.github.io/ARCHModels.jl/dev.

ARCHModels.DOW29Constant
DOW29

Stock returns, in procent, from 03/19/2008 through 04/11/2019, for tickers AAPL, IBM, XOM, KO, MSFT, INTC, MRK, PG, VZ, WBA, V, JNJ, PFE, CSCO, TRV, WMT, MMM, UTX, UNH, NKE, HD, BA, AXP, MCD, CAT, GS, JPM, CVX, DIS.

ARCHModels.ARCHType
ARCH{q, T<:AbstractFloat} <: UnivariateVolatilitySpec{T}

ARCH{q}(coefs) -> UnivariateVolatilitySpec

Construct an ARCH specification with the given parameters.

Example:

julia> ARCH{2}([1., .3, .4])
TGARCH{0, 0, 2} specification.

──────────────────────────
               ω   α₁   α₂
──────────────────────────
Parameters:  1.0  0.3  0.4
──────────────────────────
ARCHModels.ARCHLMTestType
ARCHLMTest(am::UnivariateARCHModel, p=max(o, p, q, ...))

Conduct Engle's (1982) LM test for autoregressive conditional heteroskedasticity with p lags in the test regression.

ARCHModels.ARCHLMTestType
ARCHLMTest <: HypothesisTest

Engle's (1982) LM test for autoregressive conditional heteroskedasticity.

ARCHModels.ARCHLMTestMethod
ARCHLMTest(u::Vector, p::Integer)

Conduct Engle's (1982) LM test for autoregressive conditional heteroskedasticity with p lags in the test regression.

ARCHModels.ARMAType
ARMA{p, q, T} <: MeanSpec{T}

An ARMA(p, q) mean specification.

ARCHModels.ARMAMethod
ARMA{p, q}(coefs::Vector)

Create an ARMA(p, q) model.

ARCHModels.CCCType
CCC{VS<:UnivariateVolatilitySpec, T<:AbstractFloat, d} <: MultivariateVolatilitySpec{T, d}

DCC(Qbar, coefs, univariatespecs; method=:largescale)

Construct a CCC specification with the given parameters. coefs must be passed as a length-zero Vector of the same element type as Qbar.

ARCHModels.DCCType
DCC{p, q, VS<:UnivariateVolatilitySpec, T<:AbstractFloat, d} <: MultivariateVolatilitySpec{T, d}
ARCHModels.DCCMethod
DCC{p, q}(Qbar, coefs, univariatespecs; method=:largescale)

Construct a DCC(p, q) specification with the given parameters.

ARCHModels.DQTestType
DQTest <: HypothesisTest

Engle and Manganelli's (2004) out-of-sample dynamic quantile test.

ARCHModels.DQTestMethod
DQTest(data, vars, level, p=1)

Conduct Engle and Manganelli's (2004) out-of-sample dynamic quantile test with p lags in the test regression. vars shoud be a vector of out-of-sample Value at Risk predictions at level level.

ARCHModels.EGARCHType
EGARCH{o, p, q, T<:AbstractFloat} <: UnivariateVolatilitySpec{T}
ARCHModels.EGARCHMethod
EGARCH{o, p, q}(coefs) -> UnivariateVolatilitySpec

Construct an EGARCH specification with the given parameters.

Example:

julia> EGARCH{1, 1, 1}([-0.1, .1, .9, .04])
EGARCH{1, 1, 1} specification.

─────────────────────────────────
                ω   γ₁   β₁    α₁
─────────────────────────────────
Parameters:  -0.1  0.1  0.9  0.04
─────────────────────────────────
ARCHModels.GARCHType
GARCH{p, q, T<:AbstractFloat} <: UnivariateVolatilitySpec{T}

GARCH{p, q}(coefs) -> UnivariateVolatilitySpec

Construct a GARCH specification with the given parameters.

Example:

julia> GARCH{2, 1}([1., .3, .4, .05 ])
GARCH{2, 1} specification.

────────────────────────────────
               ω   β₁   β₂    α₁
────────────────────────────────
Parameters:  1.0  0.3  0.4  0.05
────────────────────────────────
ARCHModels.InterceptType
Intercept{T} <: MeanSpec{T}

A mean specification with just an intercept.

ARCHModels.InterceptMethod
Intercept(mu)

Create an instance of Intercept. mu can be passed as a scalar or vector.

ARCHModels.MeanSpecType
MeanSpec{T}

Abstract supertype that mean specifications inherit from.

ARCHModels.MultivariateARCHModelType
MultivariateARCHModel{T<:AbstractFloat,
     				  d,
					  VS<:MultivariateVolatilitySpec{T, d},
					  SD<:MultivariateStandardizedDistribution{T, d},
					  MS<:MeanSpec{T}
					 } <: ARCHModel
ARCHModels.MultivariateARCHModelMethod
MultivariateARCHModel(spec::MultivariateVolatilitySpec, data::Matrix;
      			  	  dist=MultivariateStdNormal,
				  	  meanspec::[NoIntercept{T}() for _ in 1:d]
	  			  	  fitted::Bool=false
				  	  )

Create a MultivariateARCHModel.

ARCHModels.MultivariateStdNormalType
MultivariateStdNormal{T, d} <: MultivariateStandardizedDistribution{T, d}

The multivariate standard normal distribution.

ARCHModels.NoInterceptType
NoIntercept{T} <: MeanSpec{T}

A mean specification without an intercept (i.e., the mean is zero).

ARCHModels.NoInterceptMethod
NoIntercept(T::Type=Float64)
NoIntercept{T}()
NoIntercept(v::Vector)

Create an instance of NoIntercept.

ARCHModels.RegressionMethod
Regression(coefs::Vector, X::Matrix; coefnames=[β₀, β₁, …])
Regression(X::Matrix; coefnames=[β₀, β₁, …])
Regression{T}(X::Matrix; coefnames=[β₀, β₁, …])

Create a regression model.

ARCHModels.StandardizedType
Standardized{D<:ContinuousUnivariateDistribution, T}  <: StandardizedDistribution{T}

A wrapper type for standardizing a distribution from Distributions.jl.

ARCHModels.StandardizedDistributionType
StandardizedDistribution{T} <: Distributions.Distribution{Univariate, Continuous}

Abstract supertype that standardized distributions inherit from.

ARCHModels.StdGEDType
StdGED{T} <: StandardizedDistribution{T}

The standardized (mean zero, variance one) generalized error distribution.

ARCHModels.StdGEDMethod
StdGED(p)

Create a standardized generalized error distribution parameter p. p can be passed as a scalar or vector.

ARCHModels.StdNormalType
StdNormal(T::Type=Float64)
StdNormal(v::Vector)
StdNormal{T}()

Construct an instance of StdNormal.

ARCHModels.StdNormalType
StdNormal{T} <: StandardizedDistribution{T}

The standard Normal distribution.

ARCHModels.StdSkewTType
StdSkewT{T} <: StandardizedDistribution{T}

Hansen's standardized (mean zero, variance one) Skewed Student's t distribution.

ARCHModels.StdSkewTMethod
StdSkewT(v,λ)

Create a standardized skewed t distribution with v degrees of freedom and λ shape parameter. ν,λ` can be passed as scalars or vectors.

ARCHModels.StdTType
StdT{T} <: StandardizedDistribution{T}

The standardized (mean zero, variance one) Student's t distribution.

ARCHModels.StdTMethod
StdT(ν)

Create a standardized t distribution with ν degrees of freedom. ν` can be passed as a scalar or vector.

ARCHModels.TGARCHType
TGARCH{o, p, q, T<:AbstractFloat} <: UnivariateVolatilitySpec{T}
ARCHModels.TGARCHMethod
TGARCH{o, p, q}(coefs) -> UnivariateVolatilitySpec

Construct a TGARCH specification with the given parameters.

Example:

julia> TGARCH{1, 1, 1}([1., .04, .9, .01])
TGARCH{1, 1, 1} specification.

─────────────────────────────────
               ω    γ₁   β₁    α₁
─────────────────────────────────
Parameters:  1.0  0.04  0.9  0.01
─────────────────────────────────
ARCHModels.UnivariateARCHModelType
UnivariateARCHModel{T<:AbstractFloat,
          		    VS<:UnivariateVolatilitySpec,
          			SD<:StandardizedDistribution{T},
          			MS<:MeanSpec{T}
          			} <: ARCHModel
ARCHModels.UnivariateARCHModelMethod
UnivariateARCHModel(spec::UnivariateVolatilitySpec, data::Vector; dist=StdNormal(),
          			meanspec=NoIntercept(), fitted=false
          			)

Create a UnivariateARCHModel.

Example:

julia> UnivariateARCHModel(GARCH{1, 1}([1., .9, .05]), randn(10))

GARCH{1, 1} model with Gaussian errors, T=10.


─────────────────────────────────────────
                             ω   β₁    α₁
─────────────────────────────────────────
Volatility parameters:     1.0  0.9  0.05
─────────────────────────────────────────
ARCHModels.VolatilitySpecType
VolatilitySpec{T}

Abstract supertype of UnivariateVolatilitySpec{T} and MultivariateVolatilitySpec{T} .

ARCHModels.VaRsFunction
VaRs(am::UnivariateARCHModel, level=0.01)

Return the in-sample Value at Risk implied by am.

ARCHModels.correlationsMethod
correlations(am::MultivariateARCHModel)

Return the estimated conditional correlation matrices.

ARCHModels.covariancesMethod
covariances(am::MultivariateARCHModel)

Return the estimated conditional covariance matrices.

ARCHModels.meansMethod
means(am::UnivariateARCHModel)

Return the conditional means of the model.

ARCHModels.selectmodelMethod
selectmodel(::Type{<:ARMA}, data; kwargs...)  -> UnivariateARCHModel

Fit a number of ARMA{p, q} models to data and return that which minimizes the BIC.

Keyword arguments:

  • dist=StdNormal: the error distribution.
  • minlags=1: minimum lag length to try in each parameter of VS.
  • maxlags=3: maximum lag length to try in each parameter of VS.
  • criterion=bic: function that takes a UnivariateARCHModel and returns the criterion to minimize.
  • show_trace=false: print criterion to screen for each estimated model.
  • algorithm=BFGS(), autodiff=:forward, kwargs...: passed on to the optimizer.
ARCHModels.selectmodelMethod
selectmodel(::Type{VS}, data; kwargs...) -> UnivariateARCHModel

Fit the volatility specification VS with varying lag lengths and return that which minimizes the BIC.

Keyword arguments:

  • dist=StdNormal: the error distribution.
  • meanspec=Intercept: the mean specification, either as a type or instance of that type.
  • minlags=1: minimum lag length to try in each parameter of VS.
  • maxlags=3: maximum lag length to try in each parameter of VS.
  • criterion=bic: function that takes a UnivariateARCHModel and returns the criterion to minimize.
  • show_trace=false: print criterion to screen for each estimated model.
  • algorithm=BFGS(), autodiff=:forward, kwargs...: passed on to the optimizer.

Example

julia> selectmodel(EGARCH, BG96)

EGARCH{1, 1, 2} model with Gaussian errors, T=1974.

Mean equation parameters:
───────────────────────────────────────────────
      Estimate   Std.Error    z value  Pr(>|z|)
───────────────────────────────────────────────
μ  -0.00900018  0.00943948  -0.953461    0.3404
───────────────────────────────────────────────

Volatility parameters:
──────────────────────────────────────────────
      Estimate  Std.Error    z value  Pr(>|z|)
──────────────────────────────────────────────
ω   -0.0544398  0.0592073  -0.919478    0.3578
γ₁  -0.0243368  0.0270414  -0.899985    0.3681
β₁   0.960301   0.0388183  24.7384      <1e-99
α₁   0.405788   0.067466    6.0147      <1e-08
α₂  -0.207357   0.114161   -1.81636     0.0693
──────────────────────────────────────────────
ARCHModels.simulateFunction
simulate(am::ARCHModel; warmup=100, rng=Random.GLOBAL_RNG)
simulate(am::ARCHModel, T; warmup=100, rng=Random.GLOBAL_RNG)
simulate(spec::UnivariateVolatilitySpec, T; warmup=100, dist=StdNormal(), meanspec=NoIntercept(), rng=Random.GLOBAL_RNG)

Simulate a length-T time series from a UnivariateARCHModel. simulate(spec::MultivariateVolatilitySpec, T; warmup=100, dist=MultivariateStdNormal(), meanspec=[NoIntercept() for i = 1:d], rng=Random.GLOBAL_RNG) Simulate a length-T time series from a MultivariateARCHModel.

ARCHModels.simulate!Function
simulate!(am::ARCHModel; warmup=100, rng=Random.GLOBAL_RNG)

Simulate an ARCHModel, modifying am in place.

StatsAPI.fit!Method
fit!(am::ARCHModel; algorithm=BFGS(), autodiff=:forward, kwargs...)

Fit the uni- or multivariate ARCHModel specified by am, modifying am in place. Keyword arguments are passed on to the optimizer.

StatsAPI.fitMethod
fit(am::ARCHModel; algorithm=BFGS(), autodiff=:forward, kwargs...)

Fit the uni- or multivariate ARCHModel specified by am and return the result in a new instance of ARCHModel. Keyword arguments are passed on to the optimizer.

StatsAPI.fitMethod
fit(t::Type{<:ARMA}, data; kwargs...) -> UnivariateARCHModel

Fit an ARMA{p, q} model to data.

StatsAPI.fitMethod
fit(VS::Type{<:UnivariateVolatilitySpec}, data; dist=StdNormal, meanspec=Intercept,
    algorithm=BFGS(), autodiff=:forward, kwargs...)

Fit the ARCH model specified by VS to data. data can be a vector or a GLM.LinearModel (or GLM.TableRegressionModel).

Keyword arguments:

  • dist=StdNormal: the error distribution.
  • meanspec=Intercept: the mean specification, either as a type or instance of that type.
  • algorithm=BFGS(), autodiff=:forward, kwargs...: passed on to the optimizer.

Example: EGARCH{1, 1, 1} model without intercept, Student's t errors.

julia> fit(EGARCH{1, 1, 1}, BG96; meanspec=NoIntercept, dist=StdT)

EGARCH{1, 1, 1} model with Student's t errors, T=1974.


Volatility parameters:
──────────────────────────────────────────────
      Estimate  Std.Error    z value  Pr(>|z|)
──────────────────────────────────────────────
ω   -0.0162014  0.0186806  -0.867286    0.3858
γ₁  -0.0378454  0.018024   -2.09972     0.0358
β₁   0.977687   0.012558   77.8538      <1e-99
α₁   0.255804   0.0625497   4.08961     <1e-04
──────────────────────────────────────────────

Distribution parameters:
─────────────────────────────────────────
   Estimate  Std.Error  z value  Pr(>|z|)
─────────────────────────────────────────
ν   4.12423    0.40059  10.2954    <1e-24
─────────────────────────────────────────
StatsAPI.fitMethod
fit(::Type{SD}, data; algorithm=BFGS(), kwargs...)

Fit a standardized distribution to the data, using the MLE. Keyword arguments are passed on to the optimizer.

StatsAPI.fitMethod
fit(DCCspec::Type{<:DCC{p, q, VS<:UnivariateVolatilitySpec}}, data::Matrix;
    method=:largescale,  dist=MultivariateStdNormal, meanspec=Intercept,
    algorithm=BFGS(), autodiff=:forward, kwargs...)

Fit the DCC model specified by DCCspec to data. If p and q or VS are unspecified, then these default to 1, 1, and GARCH{1, 1}.

Keyword arguments:

  • method: one of :largescale or twostep
  • dist: the error distribution.
  • meanspec: the mean specification, as a type.
  • algorithm, autodiff, kwargs, ...: passed on to the optimizer.

Example: DCC{1, 1, GARCH{1, 1}} model:

julia> fit(DCC, DOW29)

29-dimensional DCC{1, 1} - GARCH{1, 1} - Intercept{Float64} specification, T=2785.

DCC parameters, estimated by largescale procedure:
────────────────────
       β₁         α₁
────────────────────
  0.88762  0.0568001
────────────────────

Calculating standard errors is expensive. To show them, use
`show(IOContext(stdout, :se=>true), <model>)`
StatsAPI.predictMethod
predict(am::MultivariateARCHModel, what=:covariance)

Form a 1-step ahead prediction from am. what controls which object is predicted. The choices are :covariance (the default) or :correlation.

StatsAPI.predictMethod
predict(am::UnivariateARCHModel, what=:volatility, horizon=1; level=0.01)

Form a horizon-step ahead prediction from am. what controls which object is predicted. The choices are :volatility (the default), :variance, :return, and :VaR. The VaR level can be controlled with the keyword argument level.

Not all prediction targets / volatility specifications support multi-step predictions.

StatsAPI.residualsMethod
residuals(am::MultivariateARCHModel; standardized = true, decorrelated = true)

Return the residuals.

StatsAPI.residualsMethod
residuals(am::UnivariateARCHModel; standardized=true)

Return the residuals of the model. Pass standardized=false for the non-devolatized residuals.