Reference guide
Index
ARCHModels.ARCHModels
ARCHModels.BG96
ARCHModels.DOW29
ARCHModels.ARCH
ARCHModels.ARCHLMTest
ARCHModels.ARCHLMTest
ARCHModels.ARCHLMTest
ARCHModels.ARCHModel
ARCHModels.ARMA
ARCHModels.ARMA
ARCHModels.CCC
ARCHModels.DCC
ARCHModels.DCC
ARCHModels.DQTest
ARCHModels.DQTest
ARCHModels.EGARCH
ARCHModels.EGARCH
ARCHModels.GARCH
ARCHModels.Intercept
ARCHModels.Intercept
ARCHModels.MeanSpec
ARCHModels.MultivariateARCHModel
ARCHModels.MultivariateARCHModel
ARCHModels.MultivariateStandardizedDistribution
ARCHModels.MultivariateStdNormal
ARCHModels.MultivariateVolatilitySpec
ARCHModels.NoIntercept
ARCHModels.NoIntercept
ARCHModels.Regression
ARCHModels.Regression
ARCHModels.Standardized
ARCHModels.StandardizedDistribution
ARCHModels.StdGED
ARCHModels.StdGED
ARCHModels.StdNormal
ARCHModels.StdNormal
ARCHModels.StdSkewT
ARCHModels.StdSkewT
ARCHModels.StdT
ARCHModels.StdT
ARCHModels.TGARCH
ARCHModels.TGARCH
ARCHModels.UnivariateARCHModel
ARCHModels.UnivariateARCHModel
ARCHModels.UnivariateVolatilitySpec
ARCHModels.VolatilitySpec
ARCHModels.VaRs
ARCHModels.correlations
ARCHModels.covariances
ARCHModels.means
ARCHModels.selectmodel
ARCHModels.selectmodel
ARCHModels.simulate
ARCHModels.simulate!
ARCHModels.volatilities
StatsAPI.fit
StatsAPI.fit
StatsAPI.fit
StatsAPI.fit
StatsAPI.fit
StatsAPI.fit!
StatsAPI.predict
StatsAPI.predict
StatsAPI.residuals
StatsAPI.residuals
Public API
ARCHModels.ARCHModels
— ModuleThe ARCHModels package for Julia. For documentation, see https://s-broda.github.io/ARCHModels.jl/dev.
ARCHModels.BG96
— ConstantBG96
Data from Bollerslev and Ghysels (JBES 1996).
ARCHModels.DOW29
— ConstantDOW29
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.ARCH
— TypeARCH{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.ARCHLMTest
— TypeARCHLMTest(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.ARCHLMTest
— TypeARCHLMTest <: HypothesisTest
Engle's (1982) LM test for autoregressive conditional heteroskedasticity.
ARCHModels.ARCHLMTest
— MethodARCHLMTest(u::Vector, p::Integer)
Conduct Engle's (1982) LM test for autoregressive conditional heteroskedasticity with p lags in the test regression.
ARCHModels.ARCHModel
— TypeARCHModel <: StatisticalModel
ARCHModels.ARMA
— TypeARMA{p, q, T} <: MeanSpec{T}
An ARMA(p, q) mean specification.
ARCHModels.ARMA
— MethodARMA{p, q}(coefs::Vector)
Create an ARMA(p, q) model.
ARCHModels.CCC
— TypeCCC{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.DCC
— TypeDCC{p, q, VS<:UnivariateVolatilitySpec, T<:AbstractFloat, d} <: MultivariateVolatilitySpec{T, d}
ARCHModels.DCC
— MethodDCC{p, q}(Qbar, coefs, univariatespecs; method=:largescale)
Construct a DCC(p, q) specification with the given parameters.
ARCHModels.DQTest
— TypeDQTest <: HypothesisTest
Engle and Manganelli's (2004) out-of-sample dynamic quantile test.
ARCHModels.DQTest
— MethodDQTest(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.EGARCH
— TypeEGARCH{o, p, q, T<:AbstractFloat} <: UnivariateVolatilitySpec{T}
ARCHModels.EGARCH
— MethodEGARCH{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.GARCH
— TypeGARCH{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.Intercept
— TypeIntercept{T} <: MeanSpec{T}
A mean specification with just an intercept.
ARCHModels.Intercept
— MethodIntercept(mu)
Create an instance of Intercept. mu
can be passed as a scalar or vector.
ARCHModels.MeanSpec
— TypeMeanSpec{T}
Abstract supertype that mean specifications inherit from.
ARCHModels.MultivariateARCHModel
— TypeMultivariateARCHModel{T<:AbstractFloat,
d,
VS<:MultivariateVolatilitySpec{T, d},
SD<:MultivariateStandardizedDistribution{T, d},
MS<:MeanSpec{T}
} <: ARCHModel
ARCHModels.MultivariateARCHModel
— MethodMultivariateARCHModel(spec::MultivariateVolatilitySpec, data::Matrix;
dist=MultivariateStdNormal,
meanspec::[NoIntercept{T}() for _ in 1:d]
fitted::Bool=false
)
Create a MultivariateARCHModel.
ARCHModels.MultivariateStandardizedDistribution
— TypeMultivariateStandardizedDistribution{T, d} <: Distribution{Multivariate, Continuous}
Abstract supertype that multivariate standardized distributions inherit from.
ARCHModels.MultivariateStdNormal
— TypeMultivariateStdNormal{T, d} <: MultivariateStandardizedDistribution{T, d}
The multivariate standard normal distribution.
ARCHModels.MultivariateVolatilitySpec
— TypeMultivariateVolatilitySpec{T, d} <: VolatilitySpec{T}
Abstract supertype that multivariate volatility specifications inherit from.
ARCHModels.NoIntercept
— TypeNoIntercept{T} <: MeanSpec{T}
A mean specification without an intercept (i.e., the mean is zero).
ARCHModels.NoIntercept
— MethodNoIntercept(T::Type=Float64)
NoIntercept{T}()
NoIntercept(v::Vector)
Create an instance of NoIntercept.
ARCHModels.Regression
— TypeRegression{k, T} <: MeanSpec{T}
A linear regression as mean specification.
ARCHModels.Regression
— MethodRegression(coefs::Vector, X::Matrix; coefnames=[β₀, β₁, …])
Regression(X::Matrix; coefnames=[β₀, β₁, …])
Regression{T}(X::Matrix; coefnames=[β₀, β₁, …])
Create a regression model.
ARCHModels.Standardized
— TypeStandardized{D<:ContinuousUnivariateDistribution, T} <: StandardizedDistribution{T}
A wrapper type for standardizing a distribution from Distributions.jl.
ARCHModels.StandardizedDistribution
— TypeStandardizedDistribution{T} <: Distributions.Distribution{Univariate, Continuous}
Abstract supertype that standardized distributions inherit from.
ARCHModels.StdGED
— TypeStdGED{T} <: StandardizedDistribution{T}
The standardized (mean zero, variance one) generalized error distribution.
ARCHModels.StdGED
— MethodStdGED(p)
Create a standardized generalized error distribution parameter p
. p
can be passed as a scalar or vector.
ARCHModels.StdNormal
— TypeStdNormal(T::Type=Float64)
StdNormal(v::Vector)
StdNormal{T}()
Construct an instance of StdNormal.
ARCHModels.StdNormal
— TypeStdNormal{T} <: StandardizedDistribution{T}
The standard Normal distribution.
ARCHModels.StdSkewT
— TypeStdSkewT{T} <: StandardizedDistribution{T}
Hansen's standardized (mean zero, variance one) Skewed Student's t distribution.
ARCHModels.StdSkewT
— MethodStdSkewT(v,λ)
Create a standardized skewed t distribution with v
degrees of freedom and λ
shape parameter. ν,λ
` can be passed as scalars or vectors.
ARCHModels.StdT
— TypeStdT{T} <: StandardizedDistribution{T}
The standardized (mean zero, variance one) Student's t distribution.
ARCHModels.StdT
— MethodStdT(ν)
Create a standardized t distribution with ν
degrees of freedom. ν
` can be passed as a scalar or vector.
ARCHModels.TGARCH
— TypeTGARCH{o, p, q, T<:AbstractFloat} <: UnivariateVolatilitySpec{T}
ARCHModels.TGARCH
— MethodTGARCH{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.UnivariateARCHModel
— TypeUnivariateARCHModel{T<:AbstractFloat,
VS<:UnivariateVolatilitySpec,
SD<:StandardizedDistribution{T},
MS<:MeanSpec{T}
} <: ARCHModel
ARCHModels.UnivariateARCHModel
— MethodUnivariateARCHModel(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.UnivariateVolatilitySpec
— TypeUnivariateVolatilitySpec{T} <: VolatilitySpec{T} end
Abstract supertype that univariate volatility specifications inherit from.
ARCHModels.VolatilitySpec
— TypeVolatilitySpec{T}
Abstract supertype of UnivariateVolatilitySpec{T} and MultivariateVolatilitySpec{T} .
ARCHModels.VaRs
— FunctionVaRs(am::UnivariateARCHModel, level=0.01)
Return the in-sample Value at Risk implied by am
.
ARCHModels.correlations
— Methodcorrelations(am::MultivariateARCHModel)
Return the estimated conditional correlation matrices.
ARCHModels.covariances
— Methodcovariances(am::MultivariateARCHModel)
Return the estimated conditional covariance matrices.
ARCHModels.means
— Methodmeans(am::UnivariateARCHModel)
Return the conditional means of the model.
ARCHModels.selectmodel
— Methodselectmodel(::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 ofVS
.maxlags=3
: maximum lag length to try in each parameter ofVS
.criterion=bic
: function that takes aUnivariateARCHModel
and returns the criterion to minimize.show_trace=false
: printcriterion
to screen for each estimated model.algorithm=BFGS(), autodiff=:forward, kwargs...
: passed on to the optimizer.
ARCHModels.selectmodel
— Methodselectmodel(::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 ofVS
.maxlags=3
: maximum lag length to try in each parameter ofVS
.criterion=bic
: function that takes aUnivariateARCHModel
and returns the criterion to minimize.show_trace=false
: printcriterion
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.simulate
— Functionsimulate(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!
— Functionsimulate!(am::ARCHModel; warmup=100, rng=Random.GLOBAL_RNG)
Simulate an ARCHModel, modifying am
in place.
ARCHModels.volatilities
— Methodvolatilities(am::UnivariateARCHModel)
Return the conditional volatilities.
StatsAPI.fit!
— Methodfit!(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.fit
— Methodfit(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.fit
— Methodfit(t::Type{<:ARMA}, data; kwargs...) -> UnivariateARCHModel
Fit an ARMA{p, q}
model to data
.
StatsAPI.fit
— Methodfit(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.fit
— Methodfit(::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.fit
— Methodfit(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
ortwostep
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.predict
— Methodpredict(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.predict
— Methodpredict(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.residuals
— Methodresiduals(am::MultivariateARCHModel; standardized = true, decorrelated = true)
Return the residuals.
StatsAPI.residuals
— Methodresiduals(am::UnivariateARCHModel; standardized=true)
Return the residuals of the model. Pass standardized=false
for the non-devolatized residuals.