AutoregressiveModels.ARMAProcessType
ARMAProcess(ars, mas, intercept=nothing)

Return an autoregressive–moving-average process $y_t$ defined as

\[\left(1-\sum_{i=1}^p \rho_i L^i\right) = c + \left(1-\sum_{i=1}^q \varphi_i L^i\right) \varepsilon_t\]

where $\{\rho_i\}_i$, $\{\varphi_i\}_i$ and $c$ are specified with mas, ars and intercept respectively; $L$ is the lag operator. Notice the negative sign associated with the moving-average terms.

AutoregressiveModels.OLSType
OLS <: RegressionModel

Data from an ordinary least squares regression for vector autoregression estimation.

AutoregressiveModels.VARProcessType
VARProcess(B::AbstractMatrix, B0=nothing; copy::Bool=false)

Return a vector autoregressive process $Y_t$ defined as

\[Y_t = B_0 + \sum_{l=1}^p B_l Y_{t-l} + \ε_t\]

where the autoregressive coefficients $\{\B_l\}_l$ are collected in matrix B by column and the optional intercept $B_0$ is in a vector B0.

AutoregressiveModels.VARProcessMethod
VARProcess(r::VectorAutoregression; copy::Bool=false)

Construct a VARProcess based on the coefficient estimates from r.

AutoregressiveModels.biascorrectMethod
biascorrect(r::VectorAutoregression; kwargs...)

Correct the bias of the least-squares coefficient estimates in r with Pope's formula. The corrected estimates can be retrieved from the returned object with coefcorrected.

Reference

Pope, Alun L. 1990. "Biases of Estimators in Multivariate Non-Gaussian Autoregressions". Journal of Time Series Analysis 11 (3): 249-258.

AutoregressiveModels.bootstrap!Method
bootstrap!(stats, r::VectorAutoregression; kwargs...)

Conduct autoregressive bootstrap for statistics specified with stats while assuming the data generating process can be approximated by an estimated vector autoregressive model r.

Each statistic to be computed needs to be paired with an array for storing the output. The number of bootstrap iterations is determined by the last dimension of the array; while the other dimensions should match the size of the statistic. For example, if the statistic is a scalar, the output array should be a vector; it should be a matrix if the statistic is a vector. The statistic is specified as a function accepting a NamedTuple as the single argument, which contains a field out that points to a view of the array indexed by the last dimension, a field data that provides the current sample of bootstrap data, and a field r for the results of VAR estimation based on data if the keyword estimatevar is true (nothing otherwise). The provided function is called in each bootstrap iteration with such a NamedTuple containing the updated values and the computed statistics are expected to be saved in-place to out. For the sake of performance, unnecessary allocations should be avoided when defining such a function. The argument stats can be either a Pair of the pre-allocated output array and the statistic function or an iterable of Pairs if more than one statistic is needed for the same bootstrap procedure.

Keywords

  • initialindex::Union{Function,Integer}=randomindex: the row index of a data columns from r for selecting the initial lags to be used for the bootstrap data.
  • drawresid::Function=wilddraw!: a function that specifies how residuals are generated for the bootstrap data given the initial lags.
  • correctbias=false: conduct bias correction with biascorrect.
  • estimatevar::Bool=true: re-estimate VAR model specified in r with each sample of the bootstrap data.
  • ntasks::Integer=Threads.nthreads(): number of tasks spawned to conduct bootstrap iterations in concurrent chunks with multiple threads.
  • keepbootdata::Bool=false: collect and return each sample of bootstrap data generated (with possibly very large memory usage).
AutoregressiveModels.impulseFunction
impulse(arma::ARMAProcess, nhorz::Integer, ε0::Real=1.0)

Same as impulse!, but allocates an array for storing the results. The number of horizons needs to be specified explicitely.

AutoregressiveModels.impulse!Function
impulse!(out::AbstractArray, arma::ARMAProcess, ε0::Real=1.0)

Compute the responses of the arma process to the impulse specified with ε0 and store the results in out. The number of horizons to be computed is determined by the length of out. See also impulse and simulate!.

AutoregressiveModels.impulse!Method
impulse!(out, var::VARProcess, ε0::AbstractVecOrMat; kwargs...)
impulse!(out, var::VARProcess, ishock::Union{Integer, AbstractRange}; kwargs...)

Compute the responses of the var process to the impulse specified with ε0 or ishock and store the results in an array out. The number of horizons to be computed is determined by the second dimension of out. See also impulse and simulate!.

As a vector, ε0 specifies the magnitude of the impulse to each variable; columns in a matrix are interpreted as multiple impulses with results stored separately along the third dimension of array out. Alternatively, ishock specifies the index of a single variable that is affected on impact; a range of indices is intercepted as multiple impulses.

Keywords

  • nlag::Integer=arorder(var): the number of lags from var used for simulations.
AutoregressiveModels.impulse!Method
impulse!(out, r::VectorAutoregression, ε0::AbstractVecOrMat; kwargs...)
impulse!(out, r::VectorAutoregression, ishock::Union{Integer, AbstractRange}; kwargs...)

Compute impulse responses to shocks specified with ε0 or ishock based on the estimation result in r and store the results in an array out. The number of horizons to be computed is determined by the second dimension of out. Responses to structural shocks identified based on temporal (short-run) restrictions can be computed if Cholesky factorization has been conducted for r. See also impulse and simulate!.

As a vector, ε0 specifies the magnitude of the impulse to each variable; columns in a matrix are interpreted as multiple impulses with results stored separately along the third dimension of array out. Alternatively, ishock specifies the index of a single variable that is affected on impact; a range of indices is intercepted as multiple impulses. With the keyword choleskyshock being true, any shock index specified is interpreted as referring to the structural shock instead of the reduced-form shock.

Keywords

  • nlag::Integer=arorder(var): the number of lags from var used for simulations.
  • choleskyshock::Bool=false: whether any shock index refers to a structural shock.
AutoregressiveModels.impulseMethod
impulse(var::VARProcess, ε0::AbstractVecOrMat, nhorz::Integer; kwargs...)
impulse(var::VARProcess, ishock::Union{Integer, AbstractRange}, nhorz::Integer; kwargs...)

Same as impulse!, but allocates an array for storing the results. The number of horizons needs to be specified explicitely.

AutoregressiveModels.impulseMethod
impulse(r::VectorAutoregression, ε0::AbstractVecOrMat, nhorz::Integer; kwargs...)
impulse(r::VectorAutoregression, ishock::Union{Integer, AbstractRange}, nhorz::Integer; kwargs...)

Same as impulse!, but allocates an array for storing the results. The number of horizons needs to be specified explicitely.

AutoregressiveModels.isstableFunction
isstable(var::VARProcess, offset::Real=0)

Return a Boolean value indicating whether var is stable, optionally with the comparison adjusted by offset for some tolerance.

AutoregressiveModels.residcholMethod
residchol(r::VectorAutoregression)

Return the lower-triangular matrix from Cholesky factorization of the residual variance-covariance matrix.

AutoregressiveModels.residvcovFunction
residvcov(r::VectorAutoregression, id1, id2=id1)

Return the variance-covariance estimate between the reduced-form errors from equation id1 and id2. The equations are indexed by the outcome variables, which can be variable names of type Symbol or integer indices.

AutoregressiveModels.simulateFunction
simulate(εs::AbstractArray, var::VARProcess, Y0=nothing; nlag::Integer=arorder(var))

Same as simulate!, but makes a copy of εs for results and hence does not overwrite εs.

AutoregressiveModels.simulateFunction
simulate(εs::AbstractArray, r::VectorAutoregression, Y0=nothing; kwargs...)

Same as simulate!, but makes a copy of εs for results and hence does not overwrite εs.

AutoregressiveModels.simulate!Function
simulate!(out::AbstractArray, εs::AbstractArray, arma::ARMAProcess, y0=nothing)

Simulate the arma process using the shocks specified in εs and initial values y0. Results are stored in out. If y0 is nothing or does not contain enough lags, zeros are used. See also simulate and impulse!.

AutoregressiveModels.simulate!Function
simulate!(εs::AbstractArray, var::VARProcess, Y0=nothing; kwargs...)

Simulate the var process using the shocks specified in εs and initial values Y0. Results are stored by overwriting εs in-place. If Y0 is nothing or does not contain enough lags, zeros are used. See also simulate and impulse!.

Keywords

  • nlag::Integer=arorder(var): the number of lags from var used for simulations.
AutoregressiveModels.simulate!Function
simulate!(εs::AbstractArray, r::VectorAutoregression, Y0=nothing; kwargs...)

Simulate the VARProcess with the coefficient estimates in r using the shocks specified in εs and initial values Y0. Results are stored by overwriting εs in-place. If Y0 is nothing or does not contain enough lags, zeros are used. See also simulate and impulse!.

Keywords

  • nlag::Integer=arorder(var): the number of lags from var used for simulations.
StatsAPI.coefFunction
coef(r::VectorAutoregression, yid, xid, lag::Integer=1)

Return the coefficient estimate of r for variable yid with respect to variable xid with lag lag. yid and xid can be variable names of type Symbol or integer indices. Unless var.nocons is true, the intercept term is always named :constant and has an index of 1.

StatsAPI.fitMethod
fit(::Type{<:VARProcess}, data, names, nlag::Integer; kwargs...)

Estimate vector autoregression with ordinary least squares using nlag lags of variables indexed by names from a Tables.jl-compatible data table.

Keywords

  • subset::Union{BitVector, Nothing}=nothing: subset of data to be used for estimation.
  • choleskyresid::Bool=false: conduct Cholesky factorization for the residual variance-covariance matrix.
  • adjust_dofr::Bool=true: adjust the degrees of freedom when computing the residual variance-covariance matrix.
  • nocons::Bool=false: do not include an intercept term in the estimation.
  • TF::Type=Float64: numeric type used for estimation.